qemu-patch-raspberry4/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 linux-user: Assert on bad type in thunk_type_align() and thunk_type_size() 2018-05-24 20:46:54 +02:00
address-spaces.h Clean up header guards that don't match their file name 2016-07-12 16:19:16 +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
cpu_ldst.h tcg: Introduce set/clear_helper_retaddr 2019-07-14 12:19:00 +02:00
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
cputlb.h cputlb: Count "partial" and "elided" tlb flushes 2018-10-31 12:16:30 +00:00
exec-all.h Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
gdbstub.h gdbstub: Clarify what gdb_handlesig() is doing 2018-05-25 10:10:55 +02:00
gen-icount.h cpu: Move icount_decr to CPUNegativeOffsetState 2019-06-10 07:03:42 -07:00
helper-gen.h tcg: Allow 6 arguments to TCG helpers 2017-12-29 12:43:40 -08:00
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 tcg: Allow 6 arguments to TCG helpers 2017-12-29 12:43:40 -08:00
helper-tcg.h tcg: Add TCG_CALL_NO_RETURN 2018-12-26 06:40:24 +11:00
hwaddr.h hw: Clean up includes 2016-06-07 18:19:23 +03:00
ioport.h hw: clean up hw/hw.h includes 2016-05-19 16:42:30 +02:00
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-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
memory_ldst.inc.h exec: move memory access declarations to a common header, inline *_phys functions 2018-05-09 00:13:38 +02:00
memory_ldst_cached.inc.h exec: reintroduce MemoryRegion caching 2018-05-09 00:13:38 +02:00
memory_ldst_phys.inc.h exec: move memory access declarations to a common header, inline *_phys functions 2018-05-09 00:13:38 +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 migration: Poison ramblock loops in migration 2018-06-15 14:40:56 +01:00
softmmu-semi.h cpu: Replace ENV_GET_CPU with env_cpu 2019-06-10 07:03:34 -07:00
target_page.h migration: Make savevm.c target independent 2017-05-18 19:21:00 +02:00
tb-context.h tcg: remove tb_lock 2018-06-15 08:18:48 -10:00
tb-hash.h include: move exec/tb-hash-xx.h to qemu/xxhash.h 2018-12-17 06:04:44 +03:00
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