qemu-e2k/include/exec
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
..
user
address-spaces.h
cpu_ldst_template.h cpu: Replace ENV_GET_CPU with env_cpu 2019-06-10 07:03:34 -07:00
cpu_ldst_useronly_template.h tcg: Release mmap_lock on translation fault 2019-07-14 12:19:01 +02:00
cpu_ldst.h tcg: Introduce set/clear_helper_retaddr 2019-07-14 12:19:00 +02:00
cpu-all.h Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
cpu-common.h Header cleanups 2019-05-03 13:03:04 +02:00
cpu-defs.h cpu: Remove CPU_COMMON 2019-06-10 07:03:42 -07:00
cputlb.h
exec-all.h Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
gdbstub.h
gen-icount.h cpu: Move icount_decr to CPUNegativeOffsetState 2019-06-10 07:03:42 -07:00
helper-gen.h
helper-head.h include/exec/helper-head.h: support "const void *" in helper calls 2019-02-21 10:22:24 -08:00
helper-proto.h
helper-tcg.h
hwaddr.h
ioport.h
log.h qom/cpu: Simplify how CPUClass:cpu_dump_state() prints 2019-04-18 22:18:59 +02:00
memattrs.h exec: Add target-specific tlb bits to MemTxAttrs 2019-02-05 16:52:37 +00:00
memory_ldst_cached.inc.h
memory_ldst_phys.inc.h
memory_ldst.inc.h
memory-internal.h memory: Clean up how mtree_info() prints 2019-04-18 22:18:59 +02:00
memory.h memory: Introduce memory listener hook log_clear() 2019-07-15 15:39:02 +02:00
poison.h include/exec/poison: Mark TARGET_FMT_lu as poisoned, too 2019-05-09 09:37:09 +02:00
ram_addr.h memory: Introduce memory listener hook log_clear() 2019-07-15 15:39:02 +02:00
ramlist.h
softmmu-semi.h cpu: Replace ENV_GET_CPU with env_cpu 2019-06-10 07:03:34 -07:00
target_page.h
tb-context.h
tb-hash.h
tb-lookup.h accel/tcg: Consider cluster index in tb_lookup__cpu_state() 2019-02-06 03:39:24 +00:00
translator.h Clean up decorations and whitespace around header guards 2019-05-13 08:58:55 +02:00