]> Git Repo - linux.git/commitdiff
x86/kvm: Use __xfer_to_guest_mode_work_pending() in kvm_run_vcpu()
authorThomas Gleixner <[email protected]>
Thu, 30 Jul 2020 07:19:01 +0000 (09:19 +0200)
committerThomas Gleixner <[email protected]>
Thu, 30 Jul 2020 10:31:47 +0000 (12:31 +0200)
The comments explicitely explain that the work flags check and handling in
kvm_run_vcpu() is done with preemption and interrupts enabled as KVM
invokes the check again right before entering guest mode with interrupts
disabled which guarantees that the work flags are observed and handled
before VMENTER.

Nevertheless the flag pending check in kvm_run_vcpu() uses the helper
variant which requires interrupts to be disabled triggering an instant
lockdep splat. This was caught in testing before and then not fixed up in
the patch before applying. :(

Use the relaxed and intentionally racy __xfer_to_guest_mode_work_pending()
instead.

Fixes: 72c3c0fe54a3 ("x86/kvm: Use generic xfer to guest work function")
Reported-by: Qian Cai <[email protected]> writes:
Signed-off-by: Thomas Gleixner <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
arch/x86/kvm/x86.c

index 82d4a9e889083c7671c697c4819b72d6ac41a5c9..532597265c50a31150913e7a3167b78b1d6a7bb6 100644 (file)
@@ -8682,7 +8682,7 @@ static int vcpu_run(struct kvm_vcpu *vcpu)
                        break;
                }
 
-               if (xfer_to_guest_mode_work_pending()) {
+               if (__xfer_to_guest_mode_work_pending()) {
                        srcu_read_unlock(&kvm->srcu, vcpu->srcu_idx);
                        r = xfer_to_guest_mode_handle_work(vcpu);
                        if (r)
This page took 0.071016 seconds and 4 git commands to generate.