From 4623de159ae40e466ea842d2634f5f24c6119ebf Mon Sep 17 00:00:00 2001 From: Andrew Yang Date: Mon, 19 Jun 2023 13:54:51 +0800 Subject: Add buffer for RT throttling default config perf_event_open02 will run testing about 4s as RT thread then get HW instruction and SW task clock event counter to compare. Under kernel RT throttling default config (sched_rt_period_us=1000000, sched_rt_runtime_us=950000), the RT testing thread will sleep around 50ms for 4 times because of RT throttling. The sleeping will lead device enter idle then exit idle for 4 times. This behavior leads overhead and affect perf event counter. After update RT throttling config (sched_rt_period_us=3000000, sched_rt_runtime_us=2850000), the test case could pass because of less idle times. With more low power features are introduced to new platforms, we need to add more buffer to cover the impact of RT throttling. Bug: 285838050 Test: run vts -m vts_ltp_test_arm_64 Signed-off-by: Andrew Yang (cherry picked from https://android-review.googlesource.com/q/commit:df0335180e6d97dd5c0f1c27e659bea0cdde38d9) Merged-In: I526a8339fdbf9bfb671e826f8129d30a22f9eccc Change-Id: I526a8339fdbf9bfb671e826f8129d30a22f9eccc (cherry picked from commit 69c8971d4fd021f71f50db8ea8b9bec480df924f) --- testcases/kernel/syscalls/perf_event_open/perf_event_open02.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c b/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c index 20dbb6133..0b84fb31c 100644 --- a/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c +++ b/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c @@ -23,7 +23,7 @@ * that can count instructions. If the task clock counters in the groups * don't stop when their group gets taken off the PMU, the ratio will * instead be close to N+4. The program will declare that the test fails - * if the ratio is greater than N (actually, N + 0.0005 to allow for FP + * if the ratio is greater than N (actually, N + 0.005 to allow for FP * rounding errors and RT throttling overhead). */ @@ -318,7 +318,7 @@ static void verify(void) ratio = (double)vtsum / vt0; tst_res(TINFO, "ratio: %lf", ratio); - if (ratio > nhw + 0.0005) { + if (ratio > nhw + 0.005) { tst_res(TFAIL, "test failed (ratio was greater than %d)", nhw); } else { tst_res(TPASS, "test passed"); -- cgit v1.2.3