[PATCH v3 09/14] x86/svm: Deflake svm_tsc_scale_test

Yosry Ahmed posted 14 patches 2 months, 4 weeks ago
[PATCH v3 09/14] x86/svm: Deflake svm_tsc_scale_test
Posted by Yosry Ahmed 2 months, 4 weeks ago
On an AMT Turin (EPYC Zen 5), svm_tsc_scale_test flakes on the last test
case with 0.0001 TSC scaling ratio, even with the 24-bit shift for
stability. On failure, the actual value is 49 instead of the expected
50.

Use a higher scaling ratio, 0.001, which makes the test pass
consistently.

Signed-off-by: Yosry Ahmed <yosry.ahmed@linux.dev>
---
 x86/svm_tests.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/x86/svm_tests.c b/x86/svm_tests.c
index 61ab63db462dc..1e7556a37adec 100644
--- a/x86/svm_tests.c
+++ b/x86/svm_tests.c
@@ -943,7 +943,7 @@ static void svm_tsc_scale_test(void)
 	}
 
 	svm_tsc_scale_run_testcase(50, 255, rdrand());
-	svm_tsc_scale_run_testcase(50, 0.0001, rdrand());
+	svm_tsc_scale_run_testcase(50, 0.001, rdrand());
 }
 
 static void latency_prepare(struct svm_test *test)
-- 
2.51.2.1041.gc1ab5b90ca-goog
Re: [PATCH v3 09/14] x86/svm: Deflake svm_tsc_scale_test
Posted by Sean Christopherson 2 months, 3 weeks ago
On Mon, Nov 10, 2025, Yosry Ahmed wrote:
> On an AMT Turin (EPYC Zen 5), svm_tsc_scale_test flakes on the last test
> case with 0.0001 TSC scaling ratio, even with the 24-bit shift for
> stability. On failure, the actual value is 49 instead of the expected
> 50.
> 
> Use a higher scaling ratio, 0.001, which makes the test pass
> consistently.

Top-tier analysis right here :-D

I'm going to take Jim's version instead of papering over the bug.

https://lore.kernel.org/all/CALMp9eQep3H-OtqmLe3O2MsOT-Vx4y0-LordKgN+pkp04VLSWw@mail.gmail.com
Re: [PATCH v3 09/14] x86/svm: Deflake svm_tsc_scale_test
Posted by Yosry Ahmed 2 months, 3 weeks ago
On Thu, Nov 13, 2025 at 04:34:35PM -0800, Sean Christopherson wrote:
> On Mon, Nov 10, 2025, Yosry Ahmed wrote:
> > On an AMT Turin (EPYC Zen 5), svm_tsc_scale_test flakes on the last test
> > case with 0.0001 TSC scaling ratio, even with the 24-bit shift for
> > stability. On failure, the actual value is 49 instead of the expected
> > 50.
> > 
> > Use a higher scaling ratio, 0.001, which makes the test pass
> > consistently.
> 
> Top-tier analysis right here :-D

Not my proudest moment :P

I saw the test is already using some arbitrary numbers and I was too
lazy to do what Jim did. I initially had a patch that allows for a
certain % error instead, like the selftest, but I opted for the simple
change :P

In my defense, I did call it not-so-sophisticated in the cover letter!

> 
> I'm going to take Jim's version instead of papering over the bug.
> 
> https://lore.kernel.org/all/CALMp9eQep3H-OtqmLe3O2MsOT-Vx4y0-LordKgN+pkp04VLSWw@mail.gmail.com

I am actually glad there's a better patch than mine :)