KVM: add kvm_request_pending
A first step in vcpu->requests encapsulation. Additionally, we now use READ_ONCE() when accessing vcpu->requests, which ensures we always load vcpu->requests when it's accessed. This is important as other threads can change it any time. Also, READ_ONCE() documents that vcpu->requests is used with other threads, likely requiring memory barriers, which it does. Signed-off-by: Radim Krčmář <rkrcmar@redhat.com> [ Documented the new use of READ_ONCE() and converted another check in arch/mips/kvm/vz.c ] Signed-off-by: Andrew Jones <drjones@redhat.com> Acked-by: Christoffer Dall <cdall@linaro.org> Signed-off-by: Christoffer Dall <cdall@linaro.org>
This commit is contained in:

committed by
Christoffer Dall

parent
2387149ead
commit
2fa6e1e12a
@@ -1094,7 +1094,7 @@ static void kvm_trap_emul_check_requests(struct kvm_vcpu *vcpu, int cpu,
|
||||
struct mm_struct *mm;
|
||||
int i;
|
||||
|
||||
if (likely(!vcpu->requests))
|
||||
if (likely(!kvm_request_pending(vcpu)))
|
||||
return;
|
||||
|
||||
if (kvm_check_request(KVM_REQ_TLB_FLUSH, vcpu)) {
|
||||
|
@@ -2337,7 +2337,7 @@ static int kvm_vz_check_requests(struct kvm_vcpu *vcpu, int cpu)
|
||||
int ret = 0;
|
||||
int i;
|
||||
|
||||
if (!vcpu->requests)
|
||||
if (!kvm_request_pending(vcpu))
|
||||
return 0;
|
||||
|
||||
if (kvm_check_request(KVM_REQ_TLB_FLUSH, vcpu)) {
|
||||
|
Reference in New Issue
Block a user