Commit 4eb6486c authored by Marc Zyngier's avatar Marc Zyngier

KVM: selftests: dirty-log: Upgrade flag accesses to acquire/release semantics

In order to preserve ordering, make sure that the flag accesses
in the dirty log are done using acquire/release accessors.
Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
Reviewed-by: default avatarGavin Shan <gshan@redhat.com>
Reviewed-by: default avatarPeter Xu <peterx@redhat.com>
Link: https://lore.kernel.org/r/20220926145120.27974-6-maz@kernel.org
parent 671c8c7f
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <linux/bitmap.h> #include <linux/bitmap.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/atomic.h> #include <linux/atomic.h>
#include <asm/barrier.h>
#include "kvm_util.h" #include "kvm_util.h"
#include "test_util.h" #include "test_util.h"
...@@ -279,12 +280,12 @@ static void dirty_ring_create_vm_done(struct kvm_vm *vm) ...@@ -279,12 +280,12 @@ static void dirty_ring_create_vm_done(struct kvm_vm *vm)
static inline bool dirty_gfn_is_dirtied(struct kvm_dirty_gfn *gfn) static inline bool dirty_gfn_is_dirtied(struct kvm_dirty_gfn *gfn)
{ {
return gfn->flags == KVM_DIRTY_GFN_F_DIRTY; return smp_load_acquire(&gfn->flags) == KVM_DIRTY_GFN_F_DIRTY;
} }
static inline void dirty_gfn_set_collected(struct kvm_dirty_gfn *gfn) static inline void dirty_gfn_set_collected(struct kvm_dirty_gfn *gfn)
{ {
gfn->flags = KVM_DIRTY_GFN_F_RESET; smp_store_release(&gfn->flags, KVM_DIRTY_GFN_F_RESET);
} }
static uint32_t dirty_ring_collect_one(struct kvm_dirty_gfn *dirty_gfns, static uint32_t dirty_ring_collect_one(struct kvm_dirty_gfn *dirty_gfns,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment