[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 01/31] kvm: support to get/set dirty log initial-all-set capabilit
From: |
Paolo Bonzini |
Subject: |
[PULL 01/31] kvm: support to get/set dirty log initial-all-set capability |
Date: |
Wed, 24 Jun 2020 06:50:18 -0400 |
From: Jay Zhou <jianjay.zhou@huawei.com>
Since the new capability KVM_DIRTY_LOG_INITIALLY_SET of
KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 has been introduced in the
kernel, tweak the userspace side to detect and enable this
capability.
Signed-off-by: Jay Zhou <jianjay.zhou@huawei.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Message-Id: <20200304025554.2159-1-jianjay.zhou@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
accel/kvm/kvm-all.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index f24d7da783..d54a8701d8 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -101,7 +101,7 @@ struct KVMState
bool kernel_irqchip_required;
OnOffAuto kernel_irqchip_split;
bool sync_mmu;
- bool manual_dirty_log_protect;
+ uint64_t manual_dirty_log_protect;
/* The man page (and posix) say ioctl numbers are signed int, but
* they're not. Linux, glibc and *BSD all treat ioctl numbers as
* unsigned, and treating them as signed here can break things */
@@ -1995,6 +1995,7 @@ static int kvm_init(MachineState *ms)
int ret;
int type = 0;
const char *kvm_type;
+ uint64_t dirty_log_manual_caps;
s = KVM_STATE(ms->accelerator);
@@ -2120,14 +2121,20 @@ static int kvm_init(MachineState *ms)
s->coalesced_pio = s->coalesced_mmio &&
kvm_check_extension(s, KVM_CAP_COALESCED_PIO);
- s->manual_dirty_log_protect =
+ dirty_log_manual_caps =
kvm_check_extension(s, KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2);
- if (s->manual_dirty_log_protect) {
- ret = kvm_vm_enable_cap(s, KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2, 0, 1);
+ dirty_log_manual_caps &= (KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE |
+ KVM_DIRTY_LOG_INITIALLY_SET);
+ s->manual_dirty_log_protect = dirty_log_manual_caps;
+ if (dirty_log_manual_caps) {
+ ret = kvm_vm_enable_cap(s, KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2, 0,
+ dirty_log_manual_caps);
if (ret) {
- warn_report("Trying to enable KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 "
- "but failed. Falling back to the legacy mode. ");
- s->manual_dirty_log_protect = false;
+ warn_report("Trying to enable capability %"PRIu64" of "
+ "KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 but failed. "
+ "Falling back to the legacy mode. ",
+ dirty_log_manual_caps);
+ s->manual_dirty_log_protect = 0;
}
}
--
2.26.2
- [PULL 00/31] Misc patches for 2020-06-24, Paolo Bonzini, 2020/06/24
- [PULL 01/31] kvm: support to get/set dirty log initial-all-set capability,
Paolo Bonzini <=
- [PULL 02/31] util/getauxval: Porting to FreeBSD getauxval feature, Paolo Bonzini, 2020/06/24
- [PULL 03/31] libqos: usb-hcd-ehci: use 32-bit write for config register, Paolo Bonzini, 2020/06/24
- [PULL 04/31] libqos: pci-pc: use 32-bit write for EJ register, Paolo Bonzini, 2020/06/24
- [PULL 05/31] memory: Revert "memory: accept mismatching sizes in memory_region_access_valid", Paolo Bonzini, 2020/06/24
- [PULL 06/31] replay: notify the main loop when there are no instructions, Paolo Bonzini, 2020/06/24
- [PULL 09/31] exec: fetch the alignment of Linux devdax pmem character device nodes, Paolo Bonzini, 2020/06/24
- [PULL 13/31] xen: Actually fix build without passthrough, Paolo Bonzini, 2020/06/24
- [PULL 08/31] configure: add libdaxctl support, Paolo Bonzini, 2020/06/24
- [PULL 10/31] docs/nvdimm: add description of alignment requirement of device dax, Paolo Bonzini, 2020/06/24
- [PULL 11/31] hw/scsi/megasas: Fix possible out-of-bounds array access in tracepoints, Paolo Bonzini, 2020/06/24