All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: Add Kconfig option to use a 32bit TLB clock on debug
@ 2026-01-12 14:08 Alejandro Vallejo
  2026-01-12 14:43 ` Jan Beulich
  0 siblings, 1 reply; 5+ messages in thread
From: Alejandro Vallejo @ 2026-01-12 14:08 UTC (permalink / raw)
  To: xen-devel
  Cc: Alejandro Vallejo, Jan Beulich, Andrew Cooper,
	Roger Pau Monné, Stefano Stabellini

Debug builds stress the wrapping logic of the TLB clock by narrowing it
down to 10 bits. This is inconvenient to test real time workloads on
such builds.

Add Kconfig option to be able to selectively use the non-stressed
behaviour on debug.

Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
---
 xen/arch/x86/Kconfig.debug | 8 ++++++++
 xen/arch/x86/flushtlb.c    | 6 +-----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/Kconfig.debug b/xen/arch/x86/Kconfig.debug
index e69de29bb2..ecf5aa4336 100644
--- a/xen/arch/x86/Kconfig.debug
+++ b/xen/arch/x86/Kconfig.debug
@@ -0,0 +1,8 @@
+config DEBUG_TLB_CLK
+	bool "TLB clock stressing"
+	default DEBUG
+	help
+	  Stress the TLB clock wrapping logic by narrowing down the counter to
+	  just a few bits. On wrap-around a global TLB shootdown takes place.
+
+	  Disable to run real-time workloads more reliably on debug builds.
diff --git a/xen/arch/x86/flushtlb.c b/xen/arch/x86/flushtlb.c
index 09e676c151..0d788047c5 100644
--- a/xen/arch/x86/flushtlb.c
+++ b/xen/arch/x86/flushtlb.c
@@ -20,11 +20,7 @@
 #include <asm/spec_ctrl.h>
 
 /* Debug builds: Wrap frequently to stress-test the wrap logic. */
-#ifdef NDEBUG
-#define WRAP_MASK (0xFFFFFFFFU)
-#else
-#define WRAP_MASK (0x000003FFU)
-#endif
+#define WRAP_MASK (IS_ENABLED(CONFIG_DEBUG_TLB_CLK) ? 0x3FFU : UINT32_MAX)
 
 #ifndef CONFIG_PV
 # undef X86_CR4_PCIDE

base-commit: 6238c97ea430706cb4a959b1474ad40a57ed1033
-- 
2.43.0



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

end of thread, other threads:[~2026-01-12 15:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-12 14:08 [PATCH] x86: Add Kconfig option to use a 32bit TLB clock on debug Alejandro Vallejo
2026-01-12 14:43 ` Jan Beulich
2026-01-12 14:47   ` Andrew Cooper
2026-01-12 15:28     ` Alejandro Vallejo
2026-01-12 15:41       ` Jan Beulich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.