public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tom Lendacky <thomas.lendacky@amd.com>
To: Andy Lutomirski <luto@kernel.org>
Cc: Sean Christopherson <sean.j.christopherson@intel.com>,
	Joerg Roedel <joro@8bytes.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	X86 ML <x86@kernel.org>,
	"Chang S. Bae" <chang.seok.bae@intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Sasha Levin <sashal@kernel.org>, Borislav Petkov <bp@alien8.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>
Subject: Re: FSGSBASE causing panic on 5.9-rc1
Date: Thu, 20 Aug 2020 11:17:00 -0500	[thread overview]
Message-ID: <45e16c5c-ce99-33da-99c8-ea52ef0945db@amd.com> (raw)
In-Reply-To: <CALCETrW8SWgWxDdMXuMPD-A1avztvNcpwLAKKRQ4ojmcz07B6A@mail.gmail.com>

On 8/20/20 10:55 AM, Andy Lutomirski wrote:
> On Thu, Aug 20, 2020 at 8:21 AM Tom Lendacky <thomas.lendacky@amd.com> wrote:
>>
>> On 8/20/20 10:10 AM, Sean Christopherson wrote:
>>> On Wed, Aug 19, 2020 at 05:21:33PM -0700, Andy Lutomirski wrote:
>>>> On Wed, Aug 19, 2020 at 2:25 PM Andy Lutomirski <luto@kernel.org> wrote:
>>>>>
>>>>> On Wed, Aug 19, 2020 at 11:19 AM Tom Lendacky <thomas.lendacky@amd.com> wrote:
>>>>>>
>>>>>> On 8/19/20 1:07 PM, Tom Lendacky wrote:
>>>>>>> It looks like the FSGSBASE support is crashing my second generation EPYC
>>>>>>> system. I was able to bisect it to:
>>>>>>>
>>>>>>> b745cfba44c1 ("x86/cpu: Enable FSGSBASE on 64bit by default and add a chicken bit")
>>>>>>>
>>>>>>> The panic only happens when using KVM. Doing kernel builds or stress
>>>>>>> on bare-metal appears fine. But if I fire up, in this case, a 64-vCPU
>>>>>>> guest and do a kernel build within the guest, I get the following:
>>>>>>
>>>>>> I should clarify that this panic is on the bare-metal system, not in the
>>>>>> guest. And that specifying nofsgsbase on the bare-metal command line fixes
>>>>>> the issue.
>>>>>
>>>>> I certainly see some oddities:
>>>>>
>>>>> We have this code:
>>>>>
>>>>> static void svm_vcpu_put(struct kvm_vcpu *vcpu)
>>>>> {
>>>>>           struct vcpu_svm *svm = to_svm(vcpu);
>>>>>           int i;
>>>>>
>>>>>           avic_vcpu_put(vcpu);
>>>>>
>>>>>           ++vcpu->stat.host_state_reload;
>>>>>           kvm_load_ldt(svm->host.ldt);
>>>>> #ifdef CONFIG_X86_64
>>>>>           loadsegment(fs, svm->host.fs);
>>>>>           wrmsrl(MSR_KERNEL_GS_BASE, current->thread.gsbase);
>>>
>>> Pretty sure current->thread.gsbase can be stale, i.e. this needs:
>>>
>>>        current_save_fsgs();
>>
>> I did try adding current_save_fsgs() in svm_vcpu_load(), saving the
>> current->thread.gsbase value to a new variable in the svm struct. I then
>> used that variable in the wrmsrl below, but it still crashed.
> 
> Can you try bisecting all the way back to:
> 
> commit dd649bd0b3aa012740059b1ba31ecad28a408f7f
> Author: Andy Lutomirski <luto@kernel.org>
> Date:   Thu May 28 16:13:48 2020 -0400
> 
>      x86/cpu: Add 'unsafe_fsgsbase' to enable CR4.FSGSBASE
> 
> and adding the unsafe_fsgsbase command line option while you bisect.

I'll give that a try.

> 
> Also, you're crashing when you run a guest, right?  Can you try

Right, when the guest is running. The guest boots fine and only when I put 
some stress on it (kernel build) does it cause the issue. It might be 
worth trying to pin all the vCPUs and see if the crash still happens.

> running the x86 sefltests on a bad kernel without running any guests?

I'll give that a try.

Thanks,
Tom

> 
> --Andy
> 

  reply	other threads:[~2020-08-20 16:18 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-19 18:07 FSGSBASE causing panic on 5.9-rc1 Tom Lendacky
2020-08-19 18:19 ` Tom Lendacky
2020-08-19 21:25   ` Andy Lutomirski
2020-08-20  0:21     ` Andy Lutomirski
2020-08-20 15:10       ` Sean Christopherson
2020-08-20 15:21         ` Tom Lendacky
2020-08-20 15:55           ` Andy Lutomirski
2020-08-20 16:17             ` Tom Lendacky [this message]
2020-08-20 16:30               ` Tom Lendacky
2020-08-20 17:41                 ` Paolo Bonzini
2020-08-20 18:34                 ` Tom Lendacky
2020-08-20 18:38                   ` Jim Mattson
2020-08-20 18:39                     ` Jim Mattson
2020-08-20 18:41                       ` Tom Lendacky
2020-08-20 19:04                         ` Tom Lendacky
2020-08-20 19:05                           ` Tom Lendacky
2020-08-20 20:07                             ` Dave Hansen
2020-08-20 20:15                               ` Tom Lendacky
2020-08-20 20:36                                 ` Andy Lutomirski
2020-08-20 22:05                                   ` Sean Christopherson
2020-08-20 22:07                                     ` Andy Lutomirski
2020-08-20 22:34                                       ` Sean Christopherson
2020-08-21  0:00                                         ` Tom Lendacky
2020-08-21  1:56                                           ` Sean Christopherson
2020-08-20 18:43           ` Bae, Chang Seok
2020-08-20 13:43     ` Paolo Bonzini
2020-08-20 17:51       ` Andy Lutomirski

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=45e16c5c-ce99-33da-99c8-ea52ef0945db@amd.com \
    --to=thomas.lendacky@amd.com \
    --cc=bp@alien8.de \
    --cc=chang.seok.bae@intel.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=sashal@kernel.org \
    --cc=sean.j.christopherson@intel.com \
    --cc=tglx@linutronix.de \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    --cc=x86@kernel.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