[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v1 6/6] kvm: Enable dirty ring for arm64
From: |
Gavin Shan |
Subject: |
[PATCH v1 6/6] kvm: Enable dirty ring for arm64 |
Date: |
Mon, 13 Feb 2023 08:39:25 +0800 |
arm64 has different capability from x86 to enable the dirty ring, which
is KVM_CAP_DIRTY_LOG_RING_ACQ_REL. To enable it in kvm_dirty_ring_init()
when KVM_CAP_DIRTY_LOG_RING isn't supported.
Signed-off-by: Gavin Shan <gshan@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
---
accel/kvm/kvm-all.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index e5035026c9..f6fbeae644 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -1457,6 +1457,7 @@ static int kvm_dirty_ring_init(KVMState *s)
{
uint32_t ring_size = s->kvm_dirty_ring_size;
uint64_t ring_bytes = ring_size * sizeof(struct kvm_dirty_gfn);
+ unsigned int capability = KVM_CAP_DIRTY_LOG_RING;
int ret;
s->kvm_dirty_ring_size = 0;
@@ -1471,7 +1472,12 @@ static int kvm_dirty_ring_init(KVMState *s)
* Read the max supported pages. Fall back to dirty logging mode
* if the dirty ring isn't supported.
*/
- ret = kvm_vm_check_extension(s, KVM_CAP_DIRTY_LOG_RING);
+ ret = kvm_vm_check_extension(s, capability);
+ if (ret <= 0) {
+ capability = KVM_CAP_DIRTY_LOG_RING_ACQ_REL;
+ ret = kvm_vm_check_extension(s, capability);
+ }
+
if (ret <= 0) {
warn_report("KVM dirty ring not available, using bitmap method");
return 0;
@@ -1484,7 +1490,7 @@ static int kvm_dirty_ring_init(KVMState *s)
return -EINVAL;
}
- ret = kvm_vm_enable_cap(s, KVM_CAP_DIRTY_LOG_RING, 0, ring_bytes);
+ ret = kvm_vm_enable_cap(s, capability, 0, ring_bytes);
if (ret) {
error_report("Enabling of KVM dirty ring failed: %s. "
"Suggested minimum value is 1024.", strerror(-ret));
--
2.23.0
- Re: [PATCH v1 3/6] kvm: Synchronize the backup bitmap in the last stage, (continued)
[PATCH v1 5/6] hw/arm/virt: Enable backup bitmap for dirty ring, Gavin Shan, 2023/02/12
- Re: [PATCH v1 5/6] hw/arm/virt: Enable backup bitmap for dirty ring, Peter Maydell, 2023/02/21
- Re: [PATCH v1 5/6] hw/arm/virt: Enable backup bitmap for dirty ring, Gavin Shan, 2023/02/21
- Re: [PATCH v1 5/6] hw/arm/virt: Enable backup bitmap for dirty ring, Peter Maydell, 2023/02/22
- Re: [PATCH v1 5/6] hw/arm/virt: Enable backup bitmap for dirty ring, Gavin Shan, 2023/02/22
- Re: [PATCH v1 5/6] hw/arm/virt: Enable backup bitmap for dirty ring, Peter Maydell, 2023/02/23
- Re: [PATCH v1 5/6] hw/arm/virt: Enable backup bitmap for dirty ring, Gavin Shan, 2023/02/24
[PATCH v1 6/6] kvm: Enable dirty ring for arm64,
Gavin Shan <=
Re: [PATCH v1 0/6] hw/arm/virt: Support dirty ring, Zhenyu Zhang, 2023/02/16