[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2] x86: Use 32-bit counter for TLB clock on debug builds


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>
  • Date: Tue, 13 Jan 2026 13:09:58 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hjNoEE2GthoCnN8zbgJAlOqjqa6jb2XEHOuLDiKN3Jg=; b=d1Op28cd8AmL7ONOMsQUmpxFqPXVIgxmnN+Ev3793EUBg2sT3WHRrsL9SsWClnfpY1ajYb+yIBssuneJyeoTbYXt3+dPmnQTPlE/b0cHWFesjoAP4Esrw1kKsGmhKlB3A05NRKB4WeZtdcpfU0++NQ0/UMmNKMLJMo0TNCzZsGRRdC5zZB8XIZ4SnvvPhQMYcjT/aOVUiXWVdFM0uLT7Mlo+KYAdG5f2FExI3XadQZVnCL5utARFZgEUoXQdb3VY+NxKAki24FUdLLPwojudb2SbuuPuiZ2hWx+tb97j1My8gFD+ntMLjNzjjcVsKlyoIHNKNkRSN3lpVz/xLBAw1Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=c/ChUGSV9ysFJ1ovKnGrhf3STPsmSrsyOZLJYxTPlHkTqDScLszvVtSlSUCa43Q+ByAM43zUZCpRi+r5Z9jCeJYGv3/57D5h2IyIAetHb1Hyd/2GdYr4MfCMK2fVXdXYj9pX0WF9Xyt6pblldgTsdMBNehB6CDf040K2iSu5f65CfDFgBk900CVzjNTsBTnCQdlwsDQ4GSHLUAbFNUiXezXC77yP5XDS70lQHKP+vEG6SGo0nHZ5++xeRjsDombO+PJr9FQsW605WQwpysy5P8hwYriWeX1ww+QAOBBFg5Epeh39xGRov+OiIU8K/f5NU6cSx7qRrp16A9RMn6YYhw==
  • Cc: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Tue, 13 Jan 2026 12:10:46 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Debug builds traditionally ship with a 10-bit counter for the TLB
clock. This forces global TLB shootdowns with high frequency, making
debug builds unsuitable for any form of real time testing.

Remove this quirk, unifying release and debug under a wide counter.

Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>
---
v1: 
https://lore.kernel.org/xen-devel/20260112140851.55590-1-alejandro.garciavallejo@xxxxxxx/
v2:
  * Remove WRAP_MASK instead.
  * Commit message/title rewrites.
---
 xen/arch/x86/flushtlb.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/xen/arch/x86/flushtlb.c b/xen/arch/x86/flushtlb.c
index 09e676c151..23721bb52c 100644
--- a/xen/arch/x86/flushtlb.c
+++ b/xen/arch/x86/flushtlb.c
@@ -19,13 +19,6 @@
 #include <asm/pv/domain.h>
 #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
-
 #ifndef CONFIG_PV
 # undef X86_CR4_PCIDE
 # define X86_CR4_PCIDE 0
@@ -55,7 +48,7 @@ static u32 pre_flush(void)
         /* Clock wrapped: someone else is leading a global TLB shootdown. */
         if ( unlikely(t1 == 0) )
             goto skip_clocktick;
-        t2 = (t + 1) & WRAP_MASK;
+        t2 = t + 1;
     }
     while ( unlikely((t = cmpxchg(&tlbflush_clock, t1, t2)) != t1) );
 

base-commit: a2a34d76643e49ccc949296c9a45888034e50b55
-- 
2.43.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.