x86/cpufeatures: Correct LKGS feature flag description
PATCH 1/1 x86/cpufeatures: Correct LKGS feature flag description
From: "Borislav Petkov (AMD)" <[email protected]>
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.
--- arch/x86/include/asm/cpufeatures.h | 2 +- tools/arch/x86/include/asm/cpufeatures.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/include/asm/cpufeatures.h +1 -1
@@ -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 */ #define X86_FEATURE_WRMSRNS (12*32+19)/* Non-serializing WRMSR */ #define X86_FEATURE_AMX_FP16 (12*32+21)/* AMX fp16 Support */ #define X86_FEATURE_AVX_IFMA (12*32+23)/* Support for VPMADD52[H,L]UQ */
tools/arch/x86/include/asm/cpufeatures.h +1 -1
@@ -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 */ #define X86_FEATURE_WRMSRNS (12*32+19)/* Non-serializing WRMSR */ #define X86_FEATURE_AMX_FP16 (12*32+21)/* AMX fp16 Support */ #define X86_FEATURE_AVX_IFMA (12*32+23)/* Support for VPMADD52[H,L]UQ */
Signature · 1 line
2.51.0
Quoted 24 lines · Borislav Petkov
From: "Borislav Petkov (AMD)" <[email protected]>
Quotation marks in
cpufeatures.hcomments 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) <[email protected]>--- arch/x86/include/asm/cpufeatures.h | 2 +- tools/arch/x86/include/asm/cpufeatures.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)arch/x86/include/asm/cpufeatures.h +0
-0
arch/x86/include/asm/cpufeatures.h line 323
Quoted 5 lines
arch/x86/include/asm/cpufeatures.h +1
-1@@ -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,
Quoted 16 lines
arch/x86/include/asm/cpufeatures.h +0
-0#define X86_FEATURE_WRMSRNS (12*32+19)/* Non-serializing WRMSR */ #define X86_FEATURE_AMX_FP16 (12*32+21)/* AMX fp16 Support */ #define X86_FEATURE_AVX_IFMA (12*32+23)/* Support for VPMADD52[H,L]UQ */ tools/arch/x86/include/asm/cpufeatures.h +1
-1@@ -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 */ #define X86_FEATURE_WRMSRNS (12*32+19)/* Non-serializing WRMSR */ #define X86_FEATURE_AMX_FP16 (12*32+21)/* AMX fp16 Support */ #define X86_FEATURE_AVX_IFMA (12*32+23)/* Support for VPMADD52[H,L]UQ */
H. Peter Anvin
reviewerQuoted 43 lines · Xin Li
Quoted 24 lines · Borislav Petkov
From: "Borislav Petkov (AMD)" <[email protected]>
Quotation marks in
cpufeatures.hcomments 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) <[email protected]>--- arch/x86/include/asm/cpufeatures.h | 2 +- tools/arch/x86/include/asm/cpufeatures.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)arch/x86/include/asm/cpufeatures.h +0
-0arch/x86/include/asm/cpufeatures.h line 323
Quoted 5 lines
arch/x86/include/asm/cpufeatures.h +1
-1@@ -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) <[email protected]>
Quoted 17 lines
Quoted 8 lines
arch/x86/include/asm/cpufeatures.h +0
-0#define X86_FEATURE_WRMSRNS (12*32+19)/* Non-serializing WRMSR */ #define X86_FEATURE_AMX_FP16 (12*32+21)/* AMX fp16 Support */ #define X86_FEATURE_AVX_IFMA (12*32+23)/* Support for VPMADD52[H,L]UQ */ tools/arch/x86/include/asm/cpufeatures.h +0
-0tools/arch/x86/include/asm/cpufeatures.h line 326
Quoted 8 lines
tools/arch/x86/include/asm/cpufeatures.h +1
-1@@ -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 */ #define X86_FEATURE_WRMSRNS (12*32+19)/* Non-serializing WRMSR */ #define X86_FEATURE_AMX_FP16 (12*32+21)/* AMX fp16 Support */ #define X86_FEATURE_AVX_IFMA (12*32+23)/* Support for VPMADD52[H,L]UQ */
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".
Quoted 34 lines · H. Peter Anvin
Quoted 33 lines · Xin Li
Quoted 24 lines · Borislav Petkov
From: "Borislav Petkov (AMD)" <[email protected]>
Quotation marks in
cpufeatures.hcomments 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) <[email protected]>--- arch/x86/include/asm/cpufeatures.h | 2 +- tools/arch/x86/include/asm/cpufeatures.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)arch/x86/include/asm/cpufeatures.h +0
-0arch/x86/include/asm/cpufeatures.h line 323
Quoted 5 lines
arch/x86/include/asm/cpufeatures.h +1
-1@@ -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.
Quoted 7 lines
Quoted 5 lines
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) <[email protected]>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
H. Peter Anvin
reviewerQuoted 38 lines · Xin Li
Quoted 37 lines · H. Peter Anvin
Quoted 36 lines · Xin Li
Quoted 24 lines · Borislav Petkov
From: "Borislav Petkov (AMD)" <[email protected]>
Quotation marks in
cpufeatures.hcomments 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) <[email protected]>--- arch/x86/include/asm/cpufeatures.h | 2 +- tools/arch/x86/include/asm/cpufeatures.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)arch/x86/include/asm/cpufeatures.h +0
-0arch/x86/include/asm/cpufeatures.h line 323
Quoted 5 lines
arch/x86/include/asm/cpufeatures.h +1
-1@@ -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,
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines
Reviewed-by Xin Li (Intel) <[email protected]>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.
Quoted 42 lines · H. Peter Anvin
Quoted 41 lines · Xin Li
Quoted 40 lines · H. Peter Anvin
Quoted 38 lines · Xin Li
Quoted 24 lines · Borislav Petkov
From: "Borislav Petkov (AMD)" <[email protected]>
Quotation marks in
cpufeatures.hcomments 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) <[email protected]>--- arch/x86/include/asm/cpufeatures.h | 2 +- tools/arch/x86/include/asm/cpufeatures.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)arch/x86/include/asm/cpufeatures.h +0
-0arch/x86/include/asm/cpufeatures.h line 323
Quoted 5 lines
arch/x86/include/asm/cpufeatures.h +1
-1@@ -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) <[email protected]>
Quoted 9 lines
Quoted 6 lines
Quoted 1 line
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->baseExcept 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?
H. Peter Anvin
reviewerQuoted 47 lines · Xin Li
Quoted 46 lines · H. Peter Anvin
Quoted 45 lines · Xin Li
Quoted 34 lines · H. Peter Anvin
Quoted 33 lines · Xin Li
Quoted 24 lines · Borislav Petkov
From: "Borislav Petkov (AMD)" <[email protected]>
Quotation marks in
cpufeatures.hcomments 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) <[email protected]>--- arch/x86/include/asm/cpufeatures.h | 2 +- tools/arch/x86/include/asm/cpufeatures.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)arch/x86/include/asm/cpufeatures.h +0
-0arch/x86/include/asm/cpufeatures.h line 323
Quoted 5 lines
arch/x86/include/asm/cpufeatures.h +1
-1@@ -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.
Quoted 7 lines
Quoted 5 lines
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) <[email protected]>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?
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
MSR_KERNEL_GS_BASE = gs_sel->baseExcept 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?
Yes. It's really a modified MOV GS,... instruction that loads the base, limit, selector, and attributes; it just loads the base into a different place.
Borislav Petkov
maintainerQuoted 6 lines · H. Peter Anvin
Quoted 4 lines
Quoted 2 lines
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?
Yes. It's really a modified MOV GS,... instruction that loads the base, limit, selector, and attributes; it just loads the base into a different place.
Ok, "Load user space GS base" it is. Considering how you can't load any other GS.base due to it GPing for CPL > 0.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteH. Peter Anvin
reviewerQuoted 11 lines · Borislav Petkov
Quoted 6 lines · H. Peter Anvin
Quoted 4 lines
Quoted 2 lines
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?
Yes. It's really a modified MOV GS,... instruction that loads the base, limit, selector, and attributes; it just loads the base into a different place.
Ok, "Load user space GS base" it is. Considering how you can't load any other GS.base due to it GPing for CPL > 0.
No, "load user space GS." It loads everything, not just the base.
Borislav Petkov
maintainerQuoted 1 line · H. Peter Anvin
No, "load user space GS." It loads everything, not just the base.
My aim is to have the comment be maximally helpful:
#define X86_FEATURE_LKGS (12*32+18) /* Like MOV_GS except MSR_KERNEL_GS_BASE = GS.base */
This is the gist of what's in the FRED spec.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette