Re: [4.18.0 rc8 BUG] possible irq lock inversion dependency detected

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 11 Aug 2018, Thomas Gleixner wrote:

> On Sat, 11 Aug 2018, Matthew Wilcox wrote:
> 
> > On Sat, Aug 11, 2018 at 12:28:24PM +0500, Mikhail Gavrilov wrote:
> > > Hi guys.
> > > I am catched new bug. It occured when I start virtual machine.
> > > Can anyone look?
> > 
> > I'd suggest that st->lock should be taken with irqsave.  Like this;
> > please test.
> 
> That should fix it, but that's suboptimal because that's an extra
> safe/restore in switch_to(). So we better disable interrupts at the other
> call site. Patch below.

Which is wrong as well. The placement of the speculation update call in the
SVM code should be moved, so just SVM is affected by a slightly larger irq
disabled region and no overhead at all for all others. Revised patch below.

Thanks,

	tglx

8<------------------
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index f059a73f0fd0..9c9b976d1afd 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -5580,8 +5580,6 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
 
 	clgi();
 
-	local_irq_enable();
-
 	/*
 	 * If this vCPU has touched SPEC_CTRL, restore the guest's value if
 	 * it's non-zero. Since vmentry is serialising on affected CPUs, there
@@ -5590,6 +5588,8 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
 	 */
 	x86_spec_ctrl_set_guest(svm->spec_ctrl, svm->virt_spec_ctrl);
 
+	local_irq_enable();
+
 	asm volatile (
 		"push %%" _ASM_BP "; \n\t"
 		"mov %c[rbx](%[svm]), %%" _ASM_BX " \n\t"




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux