LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] selftests/powerpc: Only test lwm/stmw on big endian
@ 2021-01-19  4:18 Michael Ellerman
  2021-01-19 20:01 ` Libor Pechacek
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Michael Ellerman @ 2021-01-19  4:18 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: msuchanek, lpechacek

Newer binutils (>= 2.36) refuse to assemble lmw/stmw when building in
little endian mode. That breaks compilation of our alignment handler
test:

  /tmp/cco4l14N.s: Assembler messages:
  /tmp/cco4l14N.s:1440: Error: `lmw' invalid when little-endian
  /tmp/cco4l14N.s:1814: Error: `stmw' invalid when little-endian
  make[2]: *** [../../lib.mk:139: /output/kselftest/powerpc/alignment/alignment_handler] Error 1

These tests do pass on little endian machines, as the kernel will
still emulate those instructions even when running little
endian (which is arguably a kernel bug).

But we don't really need to test that case, so ifdef those
instructions out to get the alignment test building again.

Reported-by: Libor Pechacek <lpechacek@suse.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 .../testing/selftests/powerpc/alignment/alignment_handler.c  | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/powerpc/alignment/alignment_handler.c b/tools/testing/selftests/powerpc/alignment/alignment_handler.c
index cb53a8b777e6..c25cf7cd45e9 100644
--- a/tools/testing/selftests/powerpc/alignment/alignment_handler.c
+++ b/tools/testing/selftests/powerpc/alignment/alignment_handler.c
@@ -443,7 +443,6 @@ int test_alignment_handler_integer(void)
 	LOAD_DFORM_TEST(ldu);
 	LOAD_XFORM_TEST(ldx);
 	LOAD_XFORM_TEST(ldux);
-	LOAD_DFORM_TEST(lmw);
 	STORE_DFORM_TEST(stb);
 	STORE_XFORM_TEST(stbx);
 	STORE_DFORM_TEST(stbu);
@@ -462,7 +461,11 @@ int test_alignment_handler_integer(void)
 	STORE_XFORM_TEST(stdx);
 	STORE_DFORM_TEST(stdu);
 	STORE_XFORM_TEST(stdux);
+
+#ifdef __BIG_ENDIAN__
+	LOAD_DFORM_TEST(lmw);
 	STORE_DFORM_TEST(stmw);
+#endif
 
 	return rc;
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] selftests/powerpc: Only test lwm/stmw on big endian
  2021-01-19  4:18 [PATCH] selftests/powerpc: Only test lwm/stmw on big endian Michael Ellerman
@ 2021-01-19 20:01 ` Libor Pechacek
  2021-01-20  1:12 ` Segher Boessenkool
  2021-01-20  4:44 ` Michael Ellerman
  2 siblings, 0 replies; 4+ messages in thread
From: Libor Pechacek @ 2021-01-19 20:01 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, msuchanek

On Út 19-01-21 15:18:00, Michael Ellerman wrote:
> Newer binutils (>= 2.36) refuse to assemble lmw/stmw when building in
> little endian mode. That breaks compilation of our alignment handler
> test:
> 
>   /tmp/cco4l14N.s: Assembler messages:
>   /tmp/cco4l14N.s:1440: Error: `lmw' invalid when little-endian
>   /tmp/cco4l14N.s:1814: Error: `stmw' invalid when little-endian
>   make[2]: *** [../../lib.mk:139: /output/kselftest/powerpc/alignment/alignment_handler] Error 1
> 
> These tests do pass on little endian machines, as the kernel will
> still emulate those instructions even when running little
> endian (which is arguably a kernel bug).
> 
> But we don't really need to test that case, so ifdef those
> instructions out to get the alignment test building again.
> 
> Reported-by: Libor Pechacek <lpechacek@suse.com>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

Tested-by: Libor Pechacek <lpechacek@suse.com>

Thanks, Michael, for the fix!

Libor

> ---
>  .../testing/selftests/powerpc/alignment/alignment_handler.c  | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/powerpc/alignment/alignment_handler.c b/tools/testing/selftests/powerpc/alignment/alignment_handler.c
> index cb53a8b777e6..c25cf7cd45e9 100644
> --- a/tools/testing/selftests/powerpc/alignment/alignment_handler.c
> +++ b/tools/testing/selftests/powerpc/alignment/alignment_handler.c
> @@ -443,7 +443,6 @@ int test_alignment_handler_integer(void)
>  	LOAD_DFORM_TEST(ldu);
>  	LOAD_XFORM_TEST(ldx);
>  	LOAD_XFORM_TEST(ldux);
> -	LOAD_DFORM_TEST(lmw);
>  	STORE_DFORM_TEST(stb);
>  	STORE_XFORM_TEST(stbx);
>  	STORE_DFORM_TEST(stbu);
> @@ -462,7 +461,11 @@ int test_alignment_handler_integer(void)
>  	STORE_XFORM_TEST(stdx);
>  	STORE_DFORM_TEST(stdu);
>  	STORE_XFORM_TEST(stdux);
> +
> +#ifdef __BIG_ENDIAN__
> +	LOAD_DFORM_TEST(lmw);
>  	STORE_DFORM_TEST(stmw);
> +#endif
>  
>  	return rc;
>  }
> -- 
> 2.25.1
> 

-- 
Libor Pechacek
SUSE Labs                                Remember to have fun...

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] selftests/powerpc: Only test lwm/stmw on big endian
  2021-01-19  4:18 [PATCH] selftests/powerpc: Only test lwm/stmw on big endian Michael Ellerman
  2021-01-19 20:01 ` Libor Pechacek
@ 2021-01-20  1:12 ` Segher Boessenkool
  2021-01-20  4:44 ` Michael Ellerman
  2 siblings, 0 replies; 4+ messages in thread
From: Segher Boessenkool @ 2021-01-20  1:12 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, msuchanek, lpechacek

Hi!

On Tue, Jan 19, 2021 at 03:18:00PM +1100, Michael Ellerman wrote:
> Newer binutils (>= 2.36) refuse to assemble lmw/stmw when building in
> little endian mode. That breaks compilation of our alignment handler
> test:
> 
>   /tmp/cco4l14N.s: Assembler messages:
>   /tmp/cco4l14N.s:1440: Error: `lmw' invalid when little-endian
>   /tmp/cco4l14N.s:1814: Error: `stmw' invalid when little-endian
>   make[2]: *** [../../lib.mk:139: /output/kselftest/powerpc/alignment/alignment_handler] Error 1
> 
> These tests do pass on little endian machines, as the kernel will
> still emulate those instructions even when running little
> endian (which is arguably a kernel bug).

The opposite: in older ISAs it is *required* to.  On all very old ISA
versions, and when not on the Server Environment on everything before
ISA 2.07.

Many older implementations did an alignment interrupt, but that was an
implementation detail (they could still be compliant with proper system
software support, e.g. kernel emulation handlers).  Nowadays that
interrupt is required, so you can still support it like that.

(The patch is fine of course.)


Segher

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] selftests/powerpc: Only test lwm/stmw on big endian
  2021-01-19  4:18 [PATCH] selftests/powerpc: Only test lwm/stmw on big endian Michael Ellerman
  2021-01-19 20:01 ` Libor Pechacek
  2021-01-20  1:12 ` Segher Boessenkool
@ 2021-01-20  4:44 ` Michael Ellerman
  2 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2021-01-20  4:44 UTC (permalink / raw)
  To: linuxppc-dev, Michael Ellerman; +Cc: msuchanek, lpechacek

On Tue, 19 Jan 2021 15:18:00 +1100, Michael Ellerman wrote:
> Newer binutils (>= 2.36) refuse to assemble lmw/stmw when building in
> little endian mode. That breaks compilation of our alignment handler
> test:
> 
>   /tmp/cco4l14N.s: Assembler messages:
>   /tmp/cco4l14N.s:1440: Error: `lmw' invalid when little-endian
>   /tmp/cco4l14N.s:1814: Error: `stmw' invalid when little-endian
>   make[2]: *** [../../lib.mk:139: /output/kselftest/powerpc/alignment/alignment_handler] Error 1
> 
> [...]

Applied to powerpc/fixes.

[1/1] selftests/powerpc: Only test lwm/stmw on big endian
      https://git.kernel.org/powerpc/c/dd3a44c06f7b4f14e90065bf05d62c255b20005f

cheers

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-01-20  4:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-19  4:18 [PATCH] selftests/powerpc: Only test lwm/stmw on big endian Michael Ellerman
2021-01-19 20:01 ` Libor Pechacek
2021-01-20  1:12 ` Segher Boessenkool
2021-01-20  4:44 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox