Commit c14a9d0a authored by Benjamin Gray's avatar Benjamin Gray Committed by Michael Ellerman

selftests/powerpc/dscr: Speed up DSCR sysfs tests

This test case is extremely slow, taking around a minute compared to
most of the other DSCR tests taking a second at most. Perf shows most
time is spent by the kernel switching to each CPU it reads in
/sys/devices/system/cpu. This switching is an unavoidable consequnce
of reading all the .../cpuN/dscr values.

Remove the outer iteration loop from this test case, reducing the reads
from 1600 to 16. This still updates the DSCR 16 times and verifies on
every CPU each time, so I do not expect the lower coverage to be
meaningful. The speedup is significant: back down to ~1 second like the
other tests.
Signed-off-by: default avatarBenjamin Gray <bgray@linux.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230406043320.125138-7-bgray@linux.ibm.com
parent 3067b89a
...@@ -67,18 +67,15 @@ static int check_all_cpu_dscr_defaults(unsigned long val) ...@@ -67,18 +67,15 @@ static int check_all_cpu_dscr_defaults(unsigned long val)
int dscr_sysfs(void) int dscr_sysfs(void)
{ {
unsigned long orig_dscr_default; unsigned long orig_dscr_default;
int i, j;
SKIP_IF(!have_hwcap2(PPC_FEATURE2_DSCR)); SKIP_IF(!have_hwcap2(PPC_FEATURE2_DSCR));
orig_dscr_default = get_default_dscr(); orig_dscr_default = get_default_dscr();
for (i = 0; i < COUNT; i++) { for (int i = 0; i < DSCR_MAX; i++) {
for (j = 0; j < DSCR_MAX; j++) { set_default_dscr(i);
set_default_dscr(j); if (check_all_cpu_dscr_defaults(i))
if (check_all_cpu_dscr_defaults(j))
goto fail; goto fail;
} }
}
set_default_dscr(orig_dscr_default); set_default_dscr(orig_dscr_default);
return 0; return 0;
fail: fail:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment