diff mbox series

[kvm-unit-tests,3/3] x86: Increase per-CPU stack/data area to 12KiB

Message ID 20250215012032.1206409-4-seanjc@google.com (mailing list archive)
State New
Headers show
Series x86: Bump per-CPU stack/data to 12KiB | expand

Commit Message

Sean Christopherson Feb. 15, 2025, 1:20 a.m. UTC
Increase the size of the per-CPU stack/data area from one page to three,
i.e. from 4KiB to 12KiB.  KVM-Unit-Tests currently places the per-CPU data
at the bottom of the stack page, i.e. the stack "page" is actually a page
minus the size of the per-CPU area.  And of course there's no guard page
or buffer in between the two, and so overflowing the stack clobbers per-CPU
data and sends tests into the weeds in weird ways.

Punt on less awful infrastructure, and settle for fixing the most egregious
problem of tests having less than 4KiB of stack to work with.

Signed-off-by: Sean Christopherson <seanjc@google.com>
---
 lib/x86/apic-defs.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/lib/x86/apic-defs.h b/lib/x86/apic-defs.h
index fde1db38..5a1dff3a 100644
--- a/lib/x86/apic-defs.h
+++ b/lib/x86/apic-defs.h
@@ -3,10 +3,11 @@ 
 
 /*
  * Abuse this header file to hold the number of max-cpus and the size of the
- * per-CPU stack/data area, making them available both in C and ASM.
+ * per-CPU stack/data area, making them available both in C and ASM.  One page
+ * for per-CPU, and two pages for the stack (plus some buffer in-between).
  */
 #define MAX_TEST_CPUS (255)
-#define PER_CPU_SIZE  (4096)
+#define PER_CPU_SIZE  (3 * 4096)
 
 /*
  * Constants for various Intel APICs. (local APIC, IOAPIC, etc.)