public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sathyanarayanan Kuppuswamy  <sathyanarayanan.kuppuwamy@linux.intel.com>
To: Xiaoyao Li <xiaoyao.li@intel.com>,
	Sean Christopherson <seanjc@google.com>,
	Kuppuswamy Sathyanarayanan 
	<sathyanarayanan.kuppuswamy@linux.intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	x86@kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
	David Hildenbrand <david@redhat.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	"H . Peter Anvin" <hpa@zytor.com>,
	Dave Hansen <dave.hansen@intel.com>,
	Tony Luck <tony.luck@intel.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Andi Kleen <ak@linux.intel.com>,
	Kirill Shutemov <kirill.shutemov@linux.intel.com>,
	Kuppuswamy Sathyanarayanan <knsathya@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7 6/6] x86/split_lock: Fix the split lock #AC handling when running as guest
Date: Wed, 13 Oct 2021 19:21:26 -0700	[thread overview]
Message-ID: <c2f67bab-28a1-1340-3c15-919ec03375db@linux.intel.com> (raw)
In-Reply-To: <71884ac9-6da3-e75d-af1e-f8f24a7562cb@intel.com>


On 10/13/21 6:24 PM, Xiaoyao Li wrote:
> On 10/14/2021 5:32 AM, Sathyanarayanan Kuppuswamy wrote:
>> + Xiaoyao
>>
>> On 10/13/21 1:30 PM, Sean Christopherson wrote:
>>> On Tue, Oct 05, 2021, Kuppuswamy Sathyanarayanan wrote:
>>>> From: Xiaoyao Li <xiaoyao.li@intel.com>
>>>>
>>>> If running as guest and hypervisor enables
>>>> MSR_TEST_CTRL.SPLIT_LOCK_DETECT during its running, it can get split
>>>> lock #AC even though sld_state is sld_off.
>>> That's a hypervisor bug, no?  The hypervisor should never inject a 
>>> fault that
>>> the guest cannot reasonably expect.
>
> What if hypervisor doesn't intercept #AC and host enables 
> SPLIT_LOCK_DETECT during guest running? That's exactly the case TDX is 
> facing.
>
> (BTW, this patch is not complete that no matter what state sld_state 
> is, it should always treat it as fatal even sld_warn because sld_warn 
> doesn't guarantee SPLIT_LOCK_DETECT is available)
>
> Sathya, we need to drop this one. Andi has anther one to disable split 
> lock detection for SPR. That's a better direction.

Ok. I will fix this in next submission.

>
>>>> For kernel mode #AC, it always dies("split lock"), no more action
>>>> needed.
>>>>
>>>> For user mode #AC, it should treat sld_off (default state when feature
>>>> is not available) as fatal as well.
>>>>
>>>> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
>>>> Signed-off-by: Kuppuswamy Sathyanarayanan 
>>>> <sathyanarayanan.kuppuswamy@linux.intel.com>
>>>> ---
>>>>   arch/x86/kernel/cpu/intel.c | 7 ++++++-
>>>>   1 file changed, 6 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
>>>> index 01d7935feaed..47f0bc95ce2a 100644
>>>> --- a/arch/x86/kernel/cpu/intel.c
>>>> +++ b/arch/x86/kernel/cpu/intel.c
>>>> @@ -1190,7 +1190,12 @@ static void bus_lock_init(void)
>>>>   bool handle_user_split_lock(struct pt_regs *regs, long error_code)
>>>>   {
>>>> -    if ((regs->flags & X86_EFLAGS_AC) || sld_state == sld_fatal)
>>>> +    /*
>>>> +     * In virtualization environment, it can get split lock #AC 
>>>> even when
>>>> +     * sld_off but hypervisor enables it.
>>>> +     * Thus only handles when sld_warn explicitly.
>>>> +     */
>>>> +    if ((regs->flags & X86_EFLAGS_AC) || sld_state != sld_warn)
>>>>           return false;
>>>>       split_lock_warn(regs->ip);
>>>>       return true;
>>>> -- 
>>>> 2.25.1
>>>>
>
-- 
Sathyanarayanan Kuppuswamy
Linux Kernel Developer


  reply	other threads:[~2021-10-14  2:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-05 23:05 [PATCH v7 0/6] Add TDX Guest Support (boot support) Kuppuswamy Sathyanarayanan
2021-10-05 23:05 ` [PATCH v7 1/6] x86/boot: Add a trampoline for APs booting in 64-bit mode Kuppuswamy Sathyanarayanan
2021-10-05 23:05 ` [PATCH v7 2/6] x86/boot: Avoid #VE during boot for TDX platforms Kuppuswamy Sathyanarayanan
2021-10-17 19:49   ` Thomas Gleixner
2021-10-05 23:05 ` [PATCH v7 3/6] x86/topology: Disable CPU online/offline control for TDX guest Kuppuswamy Sathyanarayanan
2021-10-17 19:23   ` Thomas Gleixner
2021-10-17 19:28     ` Sathyanarayanan Kuppuswamy
2021-10-05 23:05 ` [PATCH v7 4/6] x86/tdx: Forcefully disable legacy PIC for TDX guests Kuppuswamy Sathyanarayanan
2021-10-05 23:05 ` [PATCH v7 5/6] x86: Skip WBINVD instruction for VM guest Kuppuswamy Sathyanarayanan
2021-10-05 23:05 ` [PATCH v7 6/6] x86/split_lock: Fix the split lock #AC handling when running as guest Kuppuswamy Sathyanarayanan
2021-10-13 20:30   ` Sean Christopherson
2021-10-13 21:32     ` Sathyanarayanan Kuppuswamy
2021-10-14  1:24       ` Xiaoyao Li
2021-10-14  2:21         ` Sathyanarayanan Kuppuswamy [this message]
2021-10-14 15:04         ` Sean Christopherson
2021-10-15  1:30           ` Xiaoyao Li
2021-10-06  8:21 ` [PATCH v7 0/6] Add TDX Guest Support (boot support) David Hildenbrand

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=c2f67bab-28a1-1340-3c15-919ec03375db@linux.intel.com \
    --to=sathyanarayanan.kuppuwamy@linux.intel.com \
    --cc=aarcange@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@intel.com \
    --cc=david@redhat.com \
    --cc=hpa@zytor.com \
    --cc=jpoimboe@redhat.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=knsathya@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    --cc=xiaoyao.li@intel.com \
    /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