2025-02-09 19:40:34 +03:00
|
|
|
From 1ef7edb5b2375d4010ed2ad0c7d87fcfa7ab4519 Mon Sep 17 00:00:00 2001
|
2025-01-28 09:25:42 +03:00
|
|
|
From: Rik van Riel <riel@surriel.com>
|
2025-02-09 19:40:34 +03:00
|
|
|
Date: Wed, 5 Feb 2025 23:43:26 -0500
|
2025-01-28 09:25:42 +03:00
|
|
|
Subject: x86/mm: use INVLPGB in flush_tlb_all
|
|
|
|
|
|
|
|
The flush_tlb_all() function is not used a whole lot, but we might
|
|
|
|
as well use broadcast TLB flushing there, too.
|
|
|
|
|
|
|
|
Signed-off-by: Rik van Riel <riel@surriel.com>
|
2025-02-09 19:40:34 +03:00
|
|
|
Tested-by: Manali Shukla <Manali.Shukla@amd.com>
|
2025-01-28 09:25:42 +03:00
|
|
|
---
|
|
|
|
arch/x86/mm/tlb.c | 15 +++++++++++++++
|
|
|
|
1 file changed, 15 insertions(+)
|
|
|
|
|
|
|
|
--- a/arch/x86/mm/tlb.c
|
|
|
|
+++ b/arch/x86/mm/tlb.c
|
2025-02-09 19:40:34 +03:00
|
|
|
@@ -1045,6 +1045,19 @@ void flush_tlb_mm_range(struct mm_struct
|
2025-01-28 09:25:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+static bool broadcast_flush_tlb_all(void)
|
|
|
|
+{
|
|
|
|
+ if (!IS_ENABLED(CONFIG_X86_BROADCAST_TLB_FLUSH))
|
|
|
|
+ return false;
|
|
|
|
+
|
|
|
|
+ if (!cpu_feature_enabled(X86_FEATURE_INVLPGB))
|
|
|
|
+ return false;
|
|
|
|
+
|
|
|
|
+ guard(preempt)();
|
|
|
|
+ invlpgb_flush_all();
|
|
|
|
+ return true;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
static void do_flush_tlb_all(void *info)
|
|
|
|
{
|
|
|
|
count_vm_tlb_event(NR_TLB_REMOTE_FLUSH_RECEIVED);
|
2025-02-09 19:40:34 +03:00
|
|
|
@@ -1053,6 +1066,8 @@ static void do_flush_tlb_all(void *info)
|
2025-01-28 09:25:42 +03:00
|
|
|
|
|
|
|
void flush_tlb_all(void)
|
|
|
|
{
|
|
|
|
+ if (broadcast_flush_tlb_all())
|
|
|
|
+ return;
|
|
|
|
count_vm_tlb_event(NR_TLB_REMOTE_FLUSH);
|
|
|
|
on_each_cpu(do_flush_tlb_all, NULL, 1);
|
|
|
|
}
|