qemu-patch-raspberry4/include
Peter Xu 077874e01f memory: Introduce memory listener hook log_clear()
Introduce a new memory region listener hook log_clear() to allow the
listeners to hook onto the points where the dirty bitmap is cleared by
the bitmap users.

Previously log_sync() contains two operations:

  - dirty bitmap collection, and,
  - dirty bitmap clear on remote site.

Let's take KVM as example - log_sync() for KVM will first copy the
kernel dirty bitmap to userspace, and at the same time we'll clear the
dirty bitmap there along with re-protecting all the guest pages again.

We add this new log_clear() interface only to split the old log_sync()
into two separated procedures:

  - use log_sync() to collect the collection only, and,
  - use log_clear() to clear the remote dirty bitmap.

With the new interface, the memory listener users will still be able
to decide how to implement the log synchronization procedure, e.g.,
they can still only provide log_sync() method only and put all the two
procedures within log_sync() (that's how the old KVM works before
KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 is introduced).  However with this
new interface the memory listener users will start to have a chance to
postpone the log clear operation explicitly if the module supports.
That can really benefit users like KVM at least for host kernels that
support KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2.

There are three places that can clear dirty bits in any one of the
dirty bitmap in the ram_list.dirty_memory[3] array:

        cpu_physical_memory_snapshot_and_clear_dirty
        cpu_physical_memory_test_and_clear_dirty
        cpu_physical_memory_sync_dirty_bitmap

Currently we hook directly into each of the functions to notify about
the log_clear().

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20190603065056.25211-7-peterx@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
2019-07-15 15:39:02 +02:00
..
authz Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
block block: include base when checking image chain for block allocation 2019-07-02 03:53:04 +02:00
chardev Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
crypto Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
disas Clean up a few header guard symbols 2019-06-12 13:20:20 +02:00
exec memory: Introduce memory listener hook log_clear() 2019-07-15 15:39:02 +02:00
fpu Supply missing header guards 2019-06-12 13:20:21 +02:00
hw virtio-balloon: fix QEMU 4.0 config size migration incompatibility 2019-07-12 10:56:26 -04:00
io Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
libdecnumber Clean up ill-advised or unusual header guards 2016-07-12 16:20:46 +02:00
migration vmstate: Add support for kernel integer types 2019-06-21 13:23:47 +02:00
monitor hw/core: Collect HMP command handlers in hw/core/ 2019-07-02 13:37:00 +02:00
net net/announce: Add optional ID 2019-07-02 10:21:06 +08:00
qapi qapi: remove qmp_unregister_command() 2019-02-18 14:44:05 +01:00
qemu bitmap: Add bitmap_copy_with_{src|dst}_offset() 2019-07-15 15:39:02 +02:00
qom Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
scsi Normalize header guard symbol definition. 2019-05-13 08:58:55 +02:00
standard-headers virtio-pmem: sync linux headers 2019-07-04 17:00:32 -04:00
sysemu vl: add qemu_add_vm_change_state_handler_prio() 2019-07-08 16:00:26 +02:00
ui Supply missing header guards 2019-06-12 13:20:21 +02:00
elf.h linux-user: elf: ELF_HWCAP for s390x 2019-06-07 14:53:26 +02:00
glib-compat.h slirp: Move g_spawn_async_with_fds_qemu compatibility to slirp/ 2019-02-07 15:49:08 +02:00
qemu-common.h Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
qemu-io.h Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
trace-tcg.h trace: get rid of generated-events.h/generated-events.c 2016-10-12 09:54:52 +02:00