* [PATCH 1/1] selftests/powerpc: Improve tm-resched-dscr
@ 2017-08-17 1:06 Sam Bobroff
2017-08-18 12:51 ` [1/1] " Michael Ellerman
0 siblings, 1 reply; 2+ messages in thread
From: Sam Bobroff @ 2017-08-17 1:06 UTC (permalink / raw)
To: linuxppc-dev
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: Sam Bobroff <sam.bobroff@au1.ibm.com>
---
tools/testing/selftests/powerpc/tm/Makefile | 1 +
tools/testing/selftests/powerpc/tm/tm-resched-dscr.c | 12 ++++++++----
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/powerpc/tm/Makefile b/tools/testing/selftests/powerpc/tm/Makefile
index 958c11c14acd..7bfcd454fb2a 100644
--- a/tools/testing/selftests/powerpc/tm/Makefile
+++ b/tools/testing/selftests/powerpc/tm/Makefile
@@ -15,6 +15,7 @@ $(OUTPUT)/tm-syscall: tm-syscall-asm.S
$(OUTPUT)/tm-syscall: CFLAGS += -I../../../../../usr/include
$(OUTPUT)/tm-tmspr: CFLAGS += -pthread
$(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): tm-signal.S
diff --git a/tools/testing/selftests/powerpc/tm/tm-resched-dscr.c b/tools/testing/selftests/powerpc/tm/tm-resched-dscr.c
index e79ccd6aada1..a7ac2e4c60d9 100644
--- a/tools/testing/selftests/powerpc/tm/tm-resched-dscr.c
+++ b/tools/testing/selftests/powerpc/tm/tm-resched-dscr.c
@@ -30,6 +30,7 @@
#include "utils.h"
#include "tm.h"
+#include "../pmu/lib.h"
#define SPRN_DSCR 0x03
@@ -75,8 +76,6 @@ int test_body(void)
);
assert(rv); /* make sure the transaction aborted */
if ((texasr >> 56) != TM_CAUSE_RESCHED) {
- putchar('.');
- fflush(stdout);
continue;
}
if (dscr2 != dscr1) {
@@ -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");
}
--
2.14.1.2.g4274c698f
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [1/1] selftests/powerpc: Improve tm-resched-dscr
2017-08-17 1:06 [PATCH 1/1] selftests/powerpc: Improve tm-resched-dscr Sam Bobroff
@ 2017-08-18 12:51 ` Michael Ellerman
0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2017-08-18 12:51 UTC (permalink / raw)
To: Sam bobroff, linuxppc-dev
On Thu, 2017-08-17 at 01:06:47 UTC, Sam bobroff wrote:
> 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: Sam Bobroff <sam.bobroff@au1.ibm.com>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/99597ceda00b57396a176e08bd5e5c
cheers
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-08-18 12:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-17 1:06 [PATCH 1/1] selftests/powerpc: Improve tm-resched-dscr Sam Bobroff
2017-08-18 12:51 ` [1/1] " Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).