KVM: dirty ring: Add memory barrier when marking pfn collected
PATCH 1/1 KVM: dirty ring: Add memory barrier when marking pfn collected
Following commit 4802bf910eee9, add the other missing barrier when marking the PFN as collected. This will also be required just like 4802bf910eee9 on weak ordering architectures like aarch64.
Cc Marc Zyngier <[email protected]>
Cc Gavin Shan <[email protected]>
Cc Paolo Bonzini <[email protected]>
Signed-off-by Peter Xu <[email protected]>
--- accel/kvm/kvm-all.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
accel/kvm/kvm-all.c +5 -1
@@ -728,7 +728,11 @@ static bool dirty_gfn_is_dirtied(struct kvm_dirty_gfn *gfn)static void dirty_gfn_set_collected (struct kvm_dirty_gfn *gfn) { - gfn->flags =KVM_DIRTY_GFN_F_RESET ; +/* +* Write the flags after reading the entry. Should pair with another +* smp_load_acquire() in KVM when reset dirty rings. +*/ +qatomic_store_release (&gfn->flags,KVM_DIRTY_GFN_F_RESET ); }/*
Signature · 1 line
2.32.0
Quoted 19 lines · Peter Xu
Following commit
4802bf910eee9, add the other missing barrier when marking the PFN as collected. This will also be required just like4802bf910eee9on weak ordering architectures like aarch64.Cc Marc Zyngier <[email protected]>Cc Gavin Shan <[email protected]>Cc Paolo Bonzini <[email protected]>Signed-off-by Peter Xu <[email protected]>--- accel/kvm/kvm-all.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)accel/kvm/kvm-all.c +0
-0@@ -728,7 +728,11 @@ static bool dirty_gfn_is_dirtied(struct kvm_dirty_gfn *gfn)static void dirty_gfn_set_collected (struct kvm_dirty_gfn *gfn)
accel/kvm/kvm-all.c static bool dirty_gfn_is_dirtied(struct kvm_dirty_gfn *gfn) · line 738
Quoted 10 lines
accel/kvm/kvm-all.c +5
-1{ - gfn->flags =KVM_DIRTY_GFN_F_RESET ; +/* +* Write the flags after reading the entry. Should pair with another +* smp_load_acquire() in KVM when reset dirty rings. +*/ +qatomic_store_release (&gfn->flags,KVM_DIRTY_GFN_F_RESET ); }/*
Reviewed-by Philippe Mathieu-Daudé <[email protected]>
Quoted 4 lines · Peter Xu
Following commit
4802bf910eee9, add the other missing barrier when marking the PFN as collected. This will also be required just like4802bf910eee9on weak ordering architectures like aarch64.
Quoted 8 lines
Cc Marc Zyngier <[email protected]>Cc Gavin Shan <[email protected]>Cc Paolo Bonzini <[email protected]>Signed-off-by Peter Xu <[email protected]>--- accel/kvm/kvm-all.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
Reviewed-by Gavin Shan <[email protected]>
Quoted 18 lines
accel/kvm/kvm-all.c +5
-1@@ -728,7 +728,11 @@ static bool dirty_gfn_is_dirtied(struct kvm_dirty_gfn *gfn)static void dirty_gfn_set_collected (struct kvm_dirty_gfn *gfn) { - gfn->flags =KVM_DIRTY_GFN_F_RESET ; +/* +* Write the flags after reading the entry. Should pair with another +* smp_load_acquire() in KVM when reset dirty rings. +*/ +qatomic_store_release (&gfn->flags,KVM_DIRTY_GFN_F_RESET ); }/*
Ping?