selftests/powerpc: Fix TM resched DSCR test with some compilers
authorMichael Ellerman <mpe@ellerman.id.au>
Fri, 19 May 2017 01:29:04 +0000 (11:29 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Apr 2018 17:48:02 +0000 (19:48 +0200)
commit35253ff9e9134f4c65718573d274d97941a9ba70
treeb0369a14f708d6dbb8ab0a37b60894a0cce6bf2c
parentacf6bfef15fac288f68e1b9a1e63f8b5fee5771b
selftests/powerpc: Fix TM resched DSCR test with some compilers

[ Upstream commit fe06fe860250a4f01d0eaf70a2563b1997174a74 ]

The tm-resched-dscr test has started failing sometimes, depending on
what compiler it's built with, eg:

  test: tm_resched_dscr
  Check DSCR TM context switch: tm-resched-dscr: tm-resched-dscr.c:76: test_body: Assertion `rv' failed.
  !! child died by signal 6

When it fails we see that the compiler doesn't initialise rv to 1 before
entering the inline asm block. Although that's counter intuitive, it
is allowed because we tell the compiler that the inline asm will write
to rv (using "=r"), meaning the original value is irrelevant.

Marking it as a read/write parameter would presumably work, but it seems
simpler to fix it by setting the initial value of rv in the inline asm.

Fixes: 96d016108640 ("powerpc: Correct DSCR during TM context switch")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Acked-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
tools/testing/selftests/powerpc/tm/tm-resched-dscr.c