linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Neuling <mikey@neuling.org>
To: Michael Ellerman <mpe@ellerman.id.au>, linuxppc-dev@ozlabs.org
Cc: sam.bobroff@au1.ibm.com
Subject: Re: [PATCH] selftests/powerpc: Fix TM resched DSCR test with some compilers
Date: Fri, 19 May 2017 15:53:06 +1000	[thread overview]
Message-ID: <1495173186.8495.46.camel@neuling.org> (raw)
In-Reply-To: <1495157865-12924-1-git-send-email-mpe@ellerman.id.au>

On Fri, 2017-05-19 at 11:37 +1000, Michael Ellerman wrote:
> The tm-resched-dscr test has started failing sometimes, depending on
> what compiler it's built with, eg:
>=20
> =C2=A0 test: tm_resched_dscr
> =C2=A0 Check DSCR TM context switch: tm-resched-dscr: tm-resched-dscr.c:7=
6:
> test_body: Assertion `rv' failed.
> =C2=A0 !! child died by signal 6
>=20
> 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 "=3Dr"), meaning the original value is irrelevant.
>=20
> 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.
>=20
> Fixes: 96d016108640 ("powerpc: Correct DSCR during TM context switch")
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

Thanks.

Acked-by: Michael Neuling <mikey@neuling.org>

> ---
> =C2=A0tools/testing/selftests/powerpc/tm/tm-resched-dscr.c | 2 +-
> =C2=A01 file changed, 1 insertion(+), 1 deletion(-)
>=20
> diff --git a/tools/testing/selftests/powerpc/tm/tm-resched-dscr.c
> b/tools/testing/selftests/powerpc/tm/tm-resched-dscr.c
> index d9c49f41515e..e79ccd6aada1 100644
> --- a/tools/testing/selftests/powerpc/tm/tm-resched-dscr.c
> +++ b/tools/testing/selftests/powerpc/tm/tm-resched-dscr.c
> @@ -42,12 +42,12 @@ int test_body(void)
> =C2=A0	printf("Check DSCR TM context switch: ");
> =C2=A0	fflush(stdout);
> =C2=A0	for (;;) {
> -		rv =3D 1;
> =C2=A0		asm __volatile__ (
> =C2=A0			/* set a known value into the DSCR */
> =C2=A0			"ld=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A03, %[dscr1];"
> =C2=A0			"mtspr=C2=A0=C2=A0=C2=A0%[sprn_dscr], 3;"
> =C2=A0
> +			"li=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0%[rv], 1;"
> =C2=A0			/* start and suspend a transaction */
> =C2=A0			"tbegin.;"
> =C2=A0			"beq=C2=A0=C2=A0=C2=A0=C2=A0=C2=A01f;"

  reply	other threads:[~2017-05-19  5:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-19  1:37 [PATCH] selftests/powerpc: Fix TM resched DSCR test with some compilers Michael Ellerman
2017-05-19  5:53 ` Michael Neuling [this message]
2017-05-25 13:22 ` Michael Ellerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1495173186.8495.46.camel@neuling.org \
    --to=mikey@neuling.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=sam.bobroff@au1.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).