From: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
To: tglx@linutronix.de
Cc: willy@infradead.org, kvm@vger.kernel.org, linux-mm@kvack.org,
bp@suse.de, konrad.wilk@oracle.com, thomas.lendacky@amd.com
Subject: Re: [4.18.0 rc8 BUG] possible irq lock inversion dependency detected
Date: Sun, 12 Aug 2018 00:44:23 +0500 [thread overview]
Message-ID: <CABXGCsNdt4=z0b2H0pf5-0HVeiDBcU3Q3c-+WZ-dsExxwih4YA@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.21.1808112015390.1659@nanos.tec.linutronix.de>
On Sat, 11 Aug 2018 at 23:19, Thomas Gleixner <tglx@linutronix.de> wrote:
>
> On Sat, 11 Aug 2018, Mikhail Gavrilov wrote:
> > > /*
> > > * 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"
> > >
> >
> >
> > I am tested this patch, but it not help solve issue.
> > New dmesg output is attached here.
>
> Bah, stupid me. Forgot to fix the other end of that function as
> well. Complete fix below.
>
> Thanks,
>
> tglx
>
> 8<---------------
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> index f059a73f0fd0..9799f86388e7 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"
> @@ -5712,12 +5712,12 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
> if (unlikely(!msr_write_intercepted(vcpu, MSR_IA32_SPEC_CTRL)))
> svm->spec_ctrl = native_read_msr(MSR_IA32_SPEC_CTRL);
>
> - x86_spec_ctrl_restore_host(svm->spec_ctrl, svm->virt_spec_ctrl);
> -
> reload_tss(vcpu);
>
> local_irq_disable();
>
> + x86_spec_ctrl_restore_host(svm->spec_ctrl, svm->virt_spec_ctrl);
> +
> vcpu->arch.cr2 = svm->vmcb->save.cr2;
> vcpu->arch.regs[VCPU_REGS_RAX] = svm->vmcb->save.rax;
> vcpu->arch.regs[VCPU_REGS_RSP] = svm->vmcb->save.rsp;
>
Perfect, the issue was gone!
Can I hope to see this patch in 4.18 kernel or already too late?
next prev parent reply other threads:[~2018-08-11 19:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-11 7:28 Mikhail Gavrilov
2018-08-11 11:30 ` Matthew Wilcox
2018-08-11 13:14 ` Thomas Gleixner
2018-08-11 13:56 ` Thomas Gleixner
2018-08-11 15:44 ` Mikhail Gavrilov
2018-08-11 18:19 ` Thomas Gleixner
2018-08-11 19:44 ` Mikhail Gavrilov [this message]
2018-08-11 20:16 ` Thomas Gleixner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CABXGCsNdt4=z0b2H0pf5-0HVeiDBcU3Q3c-+WZ-dsExxwih4YA@mail.gmail.com' \
--to=mikhail.v.gavrilov@gmail.com \
--cc=bp@suse.de \
--cc=konrad.wilk@oracle.com \
--cc=kvm@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox