* [PATCH] x86/cpu: Use cpu_feature_enabled() when checking global pages support
@ 2023-01-25 7:50 Borislav Petkov
2023-01-25 9:43 ` [tip: x86/mm] " tip-bot2 for Borislav Petkov (AMD)
0 siblings, 1 reply; 2+ messages in thread
From: Borislav Petkov @ 2023-01-25 7:50 UTC (permalink / raw)
To: X86 ML; +Cc: LKML
From: "Borislav Petkov (AMD)" <bp@alien8.de>
X86_FEATURE_PGE determines whether the CPU has enabled global page
translations support. Use the faster cpu_feature_enabled() check to
shave off some more cycles when flushing all TLB entries, including the
global ones.
What this practically saves is:
mov 0x82eb308(%rip),%rax # 0xffffffff8935bec8 <boot_cpu_data+40>
test $0x20,%ah
which test the bit. Not a lot but TLB flushing is a timing-sensitive
path so anything to make it even faster.
No functional changes.
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
---
arch/x86/mm/tlb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index c1e31e9a85d7..92d73ccede70 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -1205,7 +1205,7 @@ void __flush_tlb_all(void)
*/
VM_WARN_ON_ONCE(preemptible());
- if (boot_cpu_has(X86_FEATURE_PGE)) {
+ if (cpu_feature_enabled(X86_FEATURE_PGE)) {
__flush_tlb_global();
} else {
/*
--
2.35.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [tip: x86/mm] x86/cpu: Use cpu_feature_enabled() when checking global pages support
2023-01-25 7:50 [PATCH] x86/cpu: Use cpu_feature_enabled() when checking global pages support Borislav Petkov
@ 2023-01-25 9:43 ` tip-bot2 for Borislav Petkov (AMD)
0 siblings, 0 replies; 2+ messages in thread
From: tip-bot2 for Borislav Petkov (AMD) @ 2023-01-25 9:43 UTC (permalink / raw)
To: linux-tip-commits; +Cc: Borislav Petkov (AMD), Ingo Molnar, x86, linux-kernel
The following commit has been merged into the x86/mm branch of tip:
Commit-ID: ebd3ad60a688131de7df1dd05fd2d7c57f542268
Gitweb: https://git.kernel.org/tip/ebd3ad60a688131de7df1dd05fd2d7c57f542268
Author: Borislav Petkov (AMD) <bp@alien8.de>
AuthorDate: Wed, 25 Jan 2023 08:50:13 +01:00
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Wed, 25 Jan 2023 10:32:06 +01:00
x86/cpu: Use cpu_feature_enabled() when checking global pages support
X86_FEATURE_PGE determines whether the CPU has enabled global page
translations support. Use the faster cpu_feature_enabled() check to
shave off some more cycles when flushing all TLB entries, including the
global ones.
What this practically saves is:
mov 0x82eb308(%rip),%rax # 0xffffffff8935bec8 <boot_cpu_data+40>
test $0x20,%ah
... which test the bit. Not a lot, but TLB flushing is a timing-sensitive
path, so anything to make it even faster.
No functional changes.
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20230125075013.9292-1-bp@alien8.de
---
arch/x86/mm/tlb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index c1e31e9..92d73cc 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -1205,7 +1205,7 @@ void __flush_tlb_all(void)
*/
VM_WARN_ON_ONCE(preemptible());
- if (boot_cpu_has(X86_FEATURE_PGE)) {
+ if (cpu_feature_enabled(X86_FEATURE_PGE)) {
__flush_tlb_global();
} else {
/*
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-01-25 9:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-25 7:50 [PATCH] x86/cpu: Use cpu_feature_enabled() when checking global pages support Borislav Petkov
2023-01-25 9:43 ` [tip: x86/mm] " tip-bot2 for Borislav Petkov (AMD)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox