public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/head_64: Use testb instead of testl in secondary_startup_64_no_verify
@ 2023-11-09 20:09 Uros Bizjak
  2023-12-13 13:00 ` [tip: x86/cleanups] x86/head_64: Use TESTB instead of TESTL in secondary_startup_64_no_verify() tip-bot2 for Uros Bizjak
  0 siblings, 1 reply; 2+ messages in thread
From: Uros Bizjak @ 2023-11-09 20:09 UTC (permalink / raw)
  To: x86, linux-kernel
  Cc: Uros Bizjak, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Peter Zijlstra (Intel)

There is no need to use testl when checking LSB with a test instruction.
Use testb, which is three bytes shorter:

   f6 05 00 00 00 00 01    testb  $0x1,0x0(%rip)

vs:

   f7 05 00 00 00 00 01    testl  $0x1,0x0(%rip)
   00 00 00

for the same effect.

No functional changes intended.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org>
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
---
 arch/x86/kernel/head_64.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index 086a2c3aaaa0..1f79d809305d 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -182,7 +182,7 @@ SYM_INNER_LABEL(secondary_startup_64_no_verify, SYM_L_GLOBAL)
 	/* Enable PAE mode, PSE, PGE and LA57 */
 	orl	$(X86_CR4_PAE | X86_CR4_PSE | X86_CR4_PGE), %ecx
 #ifdef CONFIG_X86_5LEVEL
-	testl	$1, __pgtable_l5_enabled(%rip)
+	testb	$1, __pgtable_l5_enabled(%rip)
 	jz	1f
 	orl	$X86_CR4_LA57, %ecx
 1:
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [tip: x86/cleanups] x86/head_64: Use TESTB instead of TESTL in secondary_startup_64_no_verify()
  2023-11-09 20:09 [PATCH] x86/head_64: Use testb instead of testl in secondary_startup_64_no_verify Uros Bizjak
@ 2023-12-13 13:00 ` tip-bot2 for Uros Bizjak
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot2 for Uros Bizjak @ 2023-12-13 13:00 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Uros Bizjak, Borislav Petkov (AMD), x86, linux-kernel

The following commit has been merged into the x86/cleanups branch of tip:

Commit-ID:     7d28365a06af74cee015a448d32ab6e98cd05cfb
Gitweb:        https://git.kernel.org/tip/7d28365a06af74cee015a448d32ab6e98cd05cfb
Author:        Uros Bizjak <ubizjak@gmail.com>
AuthorDate:    Thu, 09 Nov 2023 21:09:56 +01:00
Committer:     Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Wed, 13 Dec 2023 13:35:38 +01:00

x86/head_64: Use TESTB instead of TESTL in secondary_startup_64_no_verify()

There is no need to use TESTL when checking the least-significant bit
with a TEST instruction. Use TESTB, which is three bytes shorter:

   f6 05 00 00 00 00 01    testb  $0x1,0x0(%rip)

vs:

   f7 05 00 00 00 00 01    testl  $0x1,0x0(%rip)
   00 00 00

for the same effect.

No functional changes intended.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20231109201032.4439-1-ubizjak@gmail.com
---
 arch/x86/kernel/head_64.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index 086a2c3..1f79d80 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -182,7 +182,7 @@ SYM_INNER_LABEL(secondary_startup_64_no_verify, SYM_L_GLOBAL)
 	/* Enable PAE mode, PSE, PGE and LA57 */
 	orl	$(X86_CR4_PAE | X86_CR4_PSE | X86_CR4_PGE), %ecx
 #ifdef CONFIG_X86_5LEVEL
-	testl	$1, __pgtable_l5_enabled(%rip)
+	testb	$1, __pgtable_l5_enabled(%rip)
 	jz	1f
 	orl	$X86_CR4_LA57, %ecx
 1:

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-12-13 13:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-09 20:09 [PATCH] x86/head_64: Use testb instead of testl in secondary_startup_64_no_verify Uros Bizjak
2023-12-13 13:00 ` [tip: x86/cleanups] x86/head_64: Use TESTB instead of TESTL in secondary_startup_64_no_verify() tip-bot2 for Uros Bizjak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox