2016-03-10 22:12:41

by Dave Hansen

[permalink] [raw]
Subject: [PATCH] x86, pkeys: fix mismerge of protection keys CPUID bits


From: Dave Hansen <[email protected]>

Kirill Shutemov pointed this out to me.

The tip tree currently has commit:

dfb4a70f2 [x86/cpufeature, x86/mm/pkeys: Add protection keys related CPUID definitions]

whioch added support for two new CPUID bits: X86_FEATURE_PKU and
X86_FEATURE_OSPKE. But, those bits were mis-merged and put in
cpufeature.h instead of cpufeatures.h.

This didn't cause any breakage *except* it keeps the "ospke" and
"pku" bits from showing up in cpuinfo.

Now cpuinfo has the two new flags:

flags : ... pku ospke

BTW, is it really wise to have cpufeature.h and cpufeatures.h?
It seems like they can only cause confusion and mahem with tab
completion.

Signed-off-by: Dave Hansen <[email protected]>
Cc: [email protected]
Cc: Borislav Petkov <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: [email protected]
---

b/arch/x86/include/asm/cpufeature.h | 4 ----
b/arch/x86/include/asm/cpufeatures.h | 4 ++++
2 files changed, 4 insertions(+), 4 deletions(-)

diff -puN arch/x86/include/asm/cpufeature.h~fix-next-mismerge arch/x86/include/asm/cpufeature.h
--- a/arch/x86/include/asm/cpufeature.h~fix-next-mismerge 2016-03-10 13:54:07.697446555 -0800
+++ b/arch/x86/include/asm/cpufeature.h 2016-03-10 13:54:15.944822125 -0800
@@ -94,10 +94,6 @@ extern const char * const x86_bug_flags[
(__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
x86_this_cpu_test_bit(bit, (unsigned long *)&cpu_info.x86_capability))

-/* Intel-defined CPU features, CPUID level 0x00000007:0 (ecx), word 16 */
-#define X86_FEATURE_PKU (16*32+ 3) /* Protection Keys for Userspace */
-#define X86_FEATURE_OSPKE (16*32+ 4) /* OS Protection Keys Enable */
-
/*
* This macro is for detection of features which need kernel
* infrastructure to be used. It may *not* directly test the CPU
diff -puN arch/x86/include/asm/cpufeatures.h~fix-next-mismerge arch/x86/include/asm/cpufeatures.h
--- a/arch/x86/include/asm/cpufeatures.h~fix-next-mismerge 2016-03-10 13:54:07.698446601 -0800
+++ b/arch/x86/include/asm/cpufeatures.h 2016-03-10 13:54:23.506166451 -0800
@@ -271,6 +271,10 @@
#define X86_FEATURE_PFTHRESHOLD (15*32+12) /* pause filter threshold */
#define X86_FEATURE_AVIC (15*32+13) /* Virtual Interrupt Controller */

+/* Intel-defined CPU features, CPUID level 0x00000007:0 (ecx), word 16 */
+#define X86_FEATURE_PKU (16*32+ 3) /* Protection Keys for Userspace */
+#define X86_FEATURE_OSPKE (16*32+ 4) /* OS Protection Keys Enable */
+
/*
* BUG word(s)
*/
_


Subject: [tip:mm/pkeys] x86/mm/pkeys: Fix mismerge of protection keys CPUID bits

Commit-ID: 0d47638f80a02b15869f1fe1fc09e5bf996750fd
Gitweb: http://git.kernel.org/tip/0d47638f80a02b15869f1fe1fc09e5bf996750fd
Author: Dave Hansen <[email protected]>
AuthorDate: Thu, 10 Mar 2016 14:12:13 -0800
Committer: Ingo Molnar <[email protected]>
CommitDate: Fri, 11 Mar 2016 09:55:57 +0100

x86/mm/pkeys: Fix mismerge of protection keys CPUID bits

Kirill Shutemov pointed this out to me.

The tip tree currently has commit:

dfb4a70f2 [x86/cpufeature, x86/mm/pkeys: Add protection keys related CPUID definitions]

whioch added support for two new CPUID bits: X86_FEATURE_PKU and
X86_FEATURE_OSPKE. But, those bits were mis-merged and put in
cpufeature.h instead of cpufeatures.h.

This didn't cause any breakage *except* it keeps the "ospke" and
"pku" bits from showing up in cpuinfo.

Now cpuinfo has the two new flags:

flags : ... pku ospke

BTW, is it really wise to have cpufeature.h and cpufeatures.h?
It seems like they can only cause confusion and mahem with tab
completion.

Reported-by: Kirill A. Shutemov <[email protected]>
Signed-off-by: Dave Hansen <[email protected]>
Acked-by: Borislav Petkov <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
---
arch/x86/include/asm/cpufeature.h | 4 ----
arch/x86/include/asm/cpufeatures.h | 4 ++++
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index 50e292a..3636ec0 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -94,10 +94,6 @@ extern const char * const x86_bug_flags[NBUGINTS*32];
(__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
x86_this_cpu_test_bit(bit, (unsigned long *)&cpu_info.x86_capability))

-/* Intel-defined CPU features, CPUID level 0x00000007:0 (ecx), word 16 */
-#define X86_FEATURE_PKU (16*32+ 3) /* Protection Keys for Userspace */
-#define X86_FEATURE_OSPKE (16*32+ 4) /* OS Protection Keys Enable */
-
/*
* This macro is for detection of features which need kernel
* infrastructure to be used. It may *not* directly test the CPU
diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h
index cbb2c56..89949a2 100644
--- a/arch/x86/include/asm/cpufeatures.h
+++ b/arch/x86/include/asm/cpufeatures.h
@@ -270,6 +270,10 @@
#define X86_FEATURE_PFTHRESHOLD (15*32+12) /* pause filter threshold */
#define X86_FEATURE_AVIC (15*32+13) /* Virtual Interrupt Controller */

+/* Intel-defined CPU features, CPUID level 0x00000007:0 (ecx), word 16 */
+#define X86_FEATURE_PKU (16*32+ 3) /* Protection Keys for Userspace */
+#define X86_FEATURE_OSPKE (16*32+ 4) /* OS Protection Keys Enable */
+
/*
* BUG word(s)
*/