- s390x/sclp: Simplify get_sclp_device() - target/ppc: Remove msr_pr macro - docs/system/target-arm: Re-alphabetize board list - migration: Extend query-migrate to provide dirty page limit info - migration: Implement dirty-limit convergence algo - migration: Put the detection logic before auto-converge checking - migration: Refactor auto-converge capability logic - migration: Introduce dirty-limit capability - qapi/migration: Introduce vcpu-dirty-limit parameters - qapi/migration: Introduce x-vcpu-dirty-limit-period parameter - Change the value of no_ged from true to false - Allow UNIX socket option for VNC websocket - tpm_emulator: Avoid double initialization during - chardev/char-socket: Update AF_UNIX for Windows - KVM: dirty ring: add missing memory barrier - i386: reset KVM nested state upon CPU reset - esp: Handle CMD_BUSRESET by resetting the SCSI bus - dbus-vmstate: Restrict error checks to registered proxies in dbus_get_proxies - vfio/pci: Add Ascend310b scend910b support - target/i386: Export RFDS bit to guests - target/i386: Add new CPU model SierraForest - target/i386: Introduce Icelake-Server-v7 to enable TSX - hw/virtio: handle un-configured shutdown in virtio-pci - target/s390x: display deprecation status in '-cpu help' - target/i386: display deprecation status in '-cpu help' - pc-bios/s390-ccw: Fix booting with logical block size < physical block size Signed-off-by: Jiabo Feng <fengjiabo1@huawei.com>
46 lines
1.5 KiB
Diff
46 lines
1.5 KiB
Diff
From 63d3efed81ddf36acfec73910a84dee426450012 Mon Sep 17 00:00:00 2001
|
|
From: tangbinzy <tangbin_yewu@cmss.chinamobile.com>
|
|
Date: Wed, 15 May 2024 01:03:38 +0000
|
|
Subject: [PATCH] KVM: dirty ring: add missing memory barrier mainline
|
|
inclusion commit 4802bf910eee98312c4a9777ac2567e6a0445c46 category: bugfix
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
---------------------------------------------------------------
|
|
|
|
The KVM_DIRTY_GFN_F_DIRTY flag ensures that the entry is valid. If
|
|
the read of the fields are not ordered after the read of the flag,
|
|
QEMU might see stale values.
|
|
|
|
Cc: Gavin Shan <gshan@redhat.com>
|
|
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
|
|
Reviewed-by: Peter Xu <peterx@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
|
Signed-off-by: tangbinzy <tangbin_yewu@cmss.chinamobile.com>
|
|
---
|
|
accel/kvm/kvm-all.c | 6 +++++-
|
|
1 file changed, 5 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
|
|
index c477f7a635..e55b2b6a16 100644
|
|
--- a/accel/kvm/kvm-all.c
|
|
+++ b/accel/kvm/kvm-all.c
|
|
@@ -661,7 +661,11 @@ static void kvm_dirty_ring_mark_page(KVMState *s, uint32_t as_id,
|
|
|
|
static bool dirty_gfn_is_dirtied(struct kvm_dirty_gfn *gfn)
|
|
{
|
|
- return gfn->flags == KVM_DIRTY_GFN_F_DIRTY;
|
|
+ /*
|
|
+ * Read the flags before the value. Pairs with barrier in
|
|
+ * KVM's kvm_dirty_ring_push() function.
|
|
+ */
|
|
+ return qatomic_load_acquire(&gfn->flags) == KVM_DIRTY_GFN_F_DIRTY;
|
|
}
|
|
|
|
static void dirty_gfn_set_collected(struct kvm_dirty_gfn *gfn)
|
|
--
|
|
2.27.0
|
|
|