提交 99597ced 编写于 作者: S Sam Bobroff 提交者: Michael Ellerman

selftests/powerpc: Improve tm-resched-dscr

The tm-resched-dscr self test can, in some situations, run for
several minutes before being successfully interrupted by the context
switch it needs in order to perform the test. This often seems to
occur when the test is being run in a virtual machine.

Improve the test by running it under eat_cpu() to guarantee
contention for the CPU and increase the chance of a context switch.

In practice this seems to reduce the test time, in some cases, from
more than two minutes to under a second.

Also remove the "progress dots" so that if the test does run for a
long time, it doesn't produce large amounts of unnecessary output.
Signed-off-by: NSam Bobroff <sam.bobroff@au1.ibm.com>
Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
上级 711bd207
...@@ -15,6 +15,7 @@ $(OUTPUT)/tm-syscall: tm-syscall-asm.S ...@@ -15,6 +15,7 @@ $(OUTPUT)/tm-syscall: tm-syscall-asm.S
$(OUTPUT)/tm-syscall: CFLAGS += -I../../../../../usr/include $(OUTPUT)/tm-syscall: CFLAGS += -I../../../../../usr/include
$(OUTPUT)/tm-tmspr: CFLAGS += -pthread $(OUTPUT)/tm-tmspr: CFLAGS += -pthread
$(OUTPUT)/tm-vmx-unavail: CFLAGS += -pthread -m64 $(OUTPUT)/tm-vmx-unavail: CFLAGS += -pthread -m64
$(OUTPUT)/tm-resched-dscr: ../pmu/lib.o
SIGNAL_CONTEXT_CHK_TESTS := $(patsubst %,$(OUTPUT)/%,$(SIGNAL_CONTEXT_CHK_TESTS)) SIGNAL_CONTEXT_CHK_TESTS := $(patsubst %,$(OUTPUT)/%,$(SIGNAL_CONTEXT_CHK_TESTS))
$(SIGNAL_CONTEXT_CHK_TESTS): tm-signal.S $(SIGNAL_CONTEXT_CHK_TESTS): tm-signal.S
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "utils.h" #include "utils.h"
#include "tm.h" #include "tm.h"
#include "../pmu/lib.h"
#define SPRN_DSCR 0x03 #define SPRN_DSCR 0x03
...@@ -75,8 +76,6 @@ int test_body(void) ...@@ -75,8 +76,6 @@ int test_body(void)
); );
assert(rv); /* make sure the transaction aborted */ assert(rv); /* make sure the transaction aborted */
if ((texasr >> 56) != TM_CAUSE_RESCHED) { if ((texasr >> 56) != TM_CAUSE_RESCHED) {
putchar('.');
fflush(stdout);
continue; continue;
} }
if (dscr2 != dscr1) { if (dscr2 != dscr1) {
...@@ -89,7 +88,12 @@ int test_body(void) ...@@ -89,7 +88,12 @@ int test_body(void)
} }
} }
int main(void) static int tm_resched_dscr(void)
{ {
return test_harness(test_body, "tm_resched_dscr"); return eat_cpu(test_body);
}
int main(int argc, const char *argv[])
{
return test_harness(tm_resched_dscr, "tm_resched_dscr");
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册