mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Xin Li <xin@zytor.com>
To: "H. Peter Anvin" <hpa@zytor.com>, Borislav Petkov <bp@kernel.org>,
	Xin Li <xin3.li@intel.com>
Cc: X86 ML <x86@kernel.org>, LKML <linux-kernel@vger.kernel.org>,
	"Borislav Petkov (AMD)" <bp@alien8.de>
Subject: Re: [PATCH] x86/cpufeatures: Correct LKGS feature flag description
Date: Wed, 15 Oct 2025 23:41:03 +0800	[thread overview]
Message-ID: <530c3c1a-5fab-4798-830b-1fe0e8522bc9@zytor.com> (raw)
In-Reply-To: <B72756BE-F15B-46D6-B44E-2FBC79E837C3@zytor.com>

On 10/15/2025 11:36 PM, H. Peter Anvin wrote:
> On October 15, 2025 8:34:00 AM PDT, Xin Li <xin@zytor.com> wrote:
>> On 10/15/2025 11:18 PM, H. Peter Anvin wrote:
>>> On October 15, 2025 8:08:17 AM PDT, Xin Li <xin@zytor.com> wrote:
>>>> On 10/15/2025 6:35 PM, Borislav Petkov wrote:
>>>>> From: "Borislav Petkov (AMD)" <bp@alien8.de>
>>>>>
>>>>> Quotation marks in cpufeatures.h comments are special and when the
>>>>> comment begins with a quoted string, that string lands in /proc/cpuinfo,
>>>>> turning it into a user-visible one.
>>>>>
>>>>> The LKGS comment doesn't begin with a quoted string but just in case
>>>>> drop the quoted "kernel" in there to avoid confusion. And while at it,
>>>>> simply change the description into what the LKGS instruction does for
>>>>> more clarity.
>>>>>
>>>>> No functional changes.
>>>>>
>>>>> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
>>>>> ---
>>>>>     arch/x86/include/asm/cpufeatures.h       | 2 +-
>>>>>     tools/arch/x86/include/asm/cpufeatures.h | 2 +-
>>>>>     2 files changed, 2 insertions(+), 2 deletions(-)
>>>>>
>>>>> diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h
>>>>> index 80b68f4726e7..4fb5e12dbdbf 100644
>>>>> --- a/arch/x86/include/asm/cpufeatures.h
>>>>> +++ b/arch/x86/include/asm/cpufeatures.h
>>>>> @@ -320,7 +320,7 @@
>>>>>     #define X86_FEATURE_FSRS		(12*32+11) /* Fast short REP STOSB */
>>>>>     #define X86_FEATURE_FSRC		(12*32+12) /* Fast short REP {CMPSB,SCASB} */
>>>>>     #define X86_FEATURE_FRED		(12*32+17) /* "fred" Flexible Return and Event Delivery */
>>>>> -#define X86_FEATURE_LKGS		(12*32+18) /* Load "kernel" (userspace) GS */
>>>>> +#define X86_FEATURE_LKGS		(12*32+18) /* MSR_KERNEL_GS_BASE = GS.base */
>>>>
>>>> Yes, the assignment is more clearer to us programmers.
>>>>
>>>> I'm just not sure if "correct" in the shortlog is accurate; it sounds the
>>>> existing one is wrong.  Otherwise,
>>>>
>>>> Reviewed-by: Xin Li (Intel) <xin@zytor.com>
>>>>
>>>
>>> That "assignment" is rather wrong, though; it implies that the two are identical, which they are not; nor does it imply the relationship is fixed (that is provided by FRED, not LKGS). Perhaps just call it "Load user space GS".
>>
>> I see your point, is the following assignment better?
>>
>>     MSR_KERNEL_GS_BASE = gs_sel->base
>>
> 
> Except that that is also wrong, because that's not all of what the instruction does. "Load user space GS" is really what it does, despite the initiate historical naming.
> 

Do you mean the load of GS attributes by LKGS is still missing?

  reply	other threads:[~2025-10-15 15:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-15 10:35 Borislav Petkov
2025-10-15 15:08 ` Xin Li
2025-10-15 15:18   ` H. Peter Anvin
2025-10-15 15:34     ` Xin Li
2025-10-15 15:36       ` H. Peter Anvin
2025-10-15 15:41         ` Xin Li [this message]
2025-10-15 15:44           ` H. Peter Anvin
2025-10-15 15:49             ` Borislav Petkov
2025-10-16  3:12               ` H. Peter Anvin
2025-10-16 12:41                 ` Borislav Petkov

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=530c3c1a-5fab-4798-830b-1fe0e8522bc9@zytor.com \
    --to=xin@zytor.com \
    --cc=bp@alien8.de \
    --cc=bp@kernel.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.org \
    --cc=xin3.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

all inboxes | Powered by JetHome®