diff options
author | Peter Xu <peterx@redhat.com> | 2021-05-17 04:23:50 -0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2021-05-26 14:49:46 +0200 |
commit | b4420f198dd8eab53cf6062c1871d0e5f5601e86 (patch) | |
tree | ff96a5909b465cc9edec20e9ac27e14d4ab9d3e6 /include | |
parent | a81a592698c5cf3d84486b00c84b7979dfa0a3da (diff) | |
download | qemu-b4420f198dd8eab53cf6062c1871d0e5f5601e86.zip qemu-b4420f198dd8eab53cf6062c1871d0e5f5601e86.tar.gz qemu-b4420f198dd8eab53cf6062c1871d0e5f5601e86.tar.bz2 |
KVM: Dirty ring support
KVM dirty ring is a new interface to pass over dirty bits from kernel to the
userspace. Instead of using a bitmap for each memory region, the dirty ring
contains an array of dirtied GPAs to fetch (in the form of offset in slots).
For each vcpu there will be one dirty ring that binds to it.
kvm_dirty_ring_reap() is the major function to collect dirty rings. It can be
called either by a standalone reaper thread that runs in the background,
collecting dirty pages for the whole VM. It can also be called directly by any
thread that has BQL taken.
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20210506160549.130416-11-peterx@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/hw/core/cpu.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index d45f782..753ca90 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -329,6 +329,10 @@ struct qemu_work_item; * @ignore_memory_transaction_failures: Cached copy of the MachineState * flag of the same name: allows the board to suppress calling of the * CPU do_transaction_failed hook function. + * @kvm_dirty_gfns: Points to the KVM dirty ring for this CPU when KVM dirty + * ring is enabled. + * @kvm_fetch_index: Keeps the index that we last fetched from the per-vCPU + * dirty ring structure. * * State of one CPU core or thread. */ @@ -400,9 +404,12 @@ struct CPUState { */ uintptr_t mem_io_pc; + /* Only used in KVM */ int kvm_fd; struct KVMState *kvm_state; struct kvm_run *kvm_run; + struct kvm_dirty_gfn *kvm_dirty_gfns; + uint32_t kvm_fetch_index; /* Used for events with 'vcpu' and *without* the 'disabled' properties */ DECLARE_BITMAP(trace_dstate_delayed, CPU_TRACE_DSTATE_MAX_EVENTS); |