sparclinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* sparc: Another fix for accurate exception reporting in copy_{from,to}_user
@ 2025-08-28 12:18 Michael Karcher
  2025-08-28 12:18 ` [PATCH 1/1] sparc: fix accurate exception reporting in copy_{from_to}_user for M7 Michael Karcher
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Karcher @ 2025-08-28 12:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: sparclinux, Michael Karcher, Andreas Larsson,
	John Paul Adrian Glaubitz, Anthony Yznaga

As a follow-up to the series sent earlier to fix accurate exception reporting on UltraSPARC,
UltraSPARC III, Niagara and Niagara 4, here is another patch to fix accurate exception
reporting on M7.


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

* [PATCH 1/1] sparc: fix accurate exception reporting in copy_{from_to}_user for M7
  2025-08-28 12:18 sparc: Another fix for accurate exception reporting in copy_{from,to}_user Michael Karcher
@ 2025-08-28 12:18 ` Michael Karcher
  2025-08-28 12:36   ` John Paul Adrian Glaubitz
  2025-09-04 14:19   ` [PATCH 1/1] sparc: fix accurate exception reporting in copy_{from_to}_user " Andreas Larsson
  0 siblings, 2 replies; 10+ messages in thread
From: Michael Karcher @ 2025-08-28 12:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: sparclinux, Michael Karcher, Andreas Larsson,
	John Paul Adrian Glaubitz, Anthony Yznaga

---
 arch/sparc/lib/M7memcpy.S     | 20 ++++++++++----------
 arch/sparc/lib/Memcpy_utils.S |  9 +++++++++
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/arch/sparc/lib/M7memcpy.S b/arch/sparc/lib/M7memcpy.S
index cbd42ea7c3f7..99357bfa8e82 100644
--- a/arch/sparc/lib/M7memcpy.S
+++ b/arch/sparc/lib/M7memcpy.S
@@ -696,16 +696,16 @@ FUNC_NAME:
 	EX_LD_FP(LOAD(ldd, %o4+40, %f26), memcpy_retl_o2_plus_o5_plus_40)
 	faligndata %f24, %f26, %f10
 	EX_ST_FP(STORE(std, %f6, %o0+24), memcpy_retl_o2_plus_o5_plus_40)
-	EX_LD_FP(LOAD(ldd, %o4+48, %f28), memcpy_retl_o2_plus_o5_plus_40)
+	EX_LD_FP(LOAD(ldd, %o4+48, %f28), memcpy_retl_o2_plus_o5_plus_32)
 	faligndata %f26, %f28, %f12
-	EX_ST_FP(STORE(std, %f8, %o0+32), memcpy_retl_o2_plus_o5_plus_40)
+	EX_ST_FP(STORE(std, %f8, %o0+32), memcpy_retl_o2_plus_o5_plus_32)
 	add	%o4, 64, %o4
-	EX_LD_FP(LOAD(ldd, %o4-8, %f30), memcpy_retl_o2_plus_o5_plus_40)
+	EX_LD_FP(LOAD(ldd, %o4-8, %f30), memcpy_retl_o2_plus_o5_plus_24)
 	faligndata %f28, %f30, %f14
-	EX_ST_FP(STORE(std, %f10, %o0+40), memcpy_retl_o2_plus_o5_plus_40)
-	EX_ST_FP(STORE(std, %f12, %o0+48), memcpy_retl_o2_plus_o5_plus_40)
+	EX_ST_FP(STORE(std, %f10, %o0+40), memcpy_retl_o2_plus_o5_plus_24)
+	EX_ST_FP(STORE(std, %f12, %o0+48), memcpy_retl_o2_plus_o5_plus_16)
 	add	%o0, 64, %o0
-	EX_ST_FP(STORE(std, %f14, %o0-8), memcpy_retl_o2_plus_o5_plus_40)
+	EX_ST_FP(STORE(std, %f14, %o0-8), memcpy_retl_o2_plus_o5_plus_8)
 	fsrc2	%f30, %f14
 	bgu,pt	%xcc, .Lunalign_sloop
 	 prefetch [%o4 + (8 * BLOCK_SIZE)], 20
@@ -728,7 +728,7 @@ FUNC_NAME:
 	add	%o4, 8, %o4
 	faligndata %f0, %f2, %f16
 	subcc	%o5, 8, %o5
-	EX_ST_FP(STORE(std, %f16, %o0), memcpy_retl_o2_plus_o5)
+	EX_ST_FP(STORE(std, %f16, %o0), memcpy_retl_o2_plus_o5_plus_8)
 	fsrc2	%f2, %f0
 	bgu,pt	%xcc, .Lunalign_by8
 	 add	%o0, 8, %o0
@@ -772,7 +772,7 @@ FUNC_NAME:
 	subcc	%o5, 0x20, %o5
 	EX_ST(STORE(stx, %o3, %o0 + 0x00), memcpy_retl_o2_plus_o5_plus_32)
 	EX_ST(STORE(stx, %g2, %o0 + 0x08), memcpy_retl_o2_plus_o5_plus_24)
-	EX_ST(STORE(stx, %g7, %o0 + 0x10), memcpy_retl_o2_plus_o5_plus_24)
+	EX_ST(STORE(stx, %g7, %o0 + 0x10), memcpy_retl_o2_plus_o5_plus_16)
 	EX_ST(STORE(stx, %o4, %o0 + 0x18), memcpy_retl_o2_plus_o5_plus_8)
 	bne,pt	%xcc, 1b
 	 add	%o0, 0x20, %o0
@@ -804,12 +804,12 @@ FUNC_NAME:
 	brz,pt	%o3, 2f
 	 sub	%o2, %o3, %o2
 
-1:	EX_LD(LOAD(ldub, %o1 + 0x00, %g2), memcpy_retl_o2_plus_g1)
+1:	EX_LD(LOAD(ldub, %o1 + 0x00, %g2), memcpy_retl_o2_plus_o3)
 	add	%o1, 1, %o1
 	subcc	%o3, 1, %o3
 	add	%o0, 1, %o0
 	bne,pt	%xcc, 1b
-	 EX_ST(STORE(stb, %g2, %o0 - 0x01), memcpy_retl_o2_plus_g1_plus_1)
+	 EX_ST(STORE(stb, %g2, %o0 - 0x01), memcpy_retl_o2_plus_o3_plus_1)
 2:
 	and	%o1, 0x7, %o3
 	brz,pn	%o3, .Lmedium_noprefetch_cp
diff --git a/arch/sparc/lib/Memcpy_utils.S b/arch/sparc/lib/Memcpy_utils.S
index 64fbac28b3db..207343367bb2 100644
--- a/arch/sparc/lib/Memcpy_utils.S
+++ b/arch/sparc/lib/Memcpy_utils.S
@@ -137,6 +137,15 @@ ENTRY(memcpy_retl_o2_plus_63_8)
 	ba,pt	%xcc, __restore_asi
 	 add	%o2, 8, %o0
 ENDPROC(memcpy_retl_o2_plus_63_8)
+ENTRY(memcpy_retl_o2_plus_o3)
+	ba,pt	%xcc, __restore_asi
+	 add	%o2, %o3, %o0
+ENDPROC(memcpy_retl_o2_plus_o3)
+ENTRY(memcpy_retl_o2_plus_o3_plus_1)
+	add	%o3, 1, %o3
+	ba,pt	%xcc, __restore_asi
+	 add	%o2, %o3, %o0
+ENDPROC(memcpy_retl_o2_plus_o3_plus_1)
 ENTRY(memcpy_retl_o2_plus_o5)
 	ba,pt	%xcc, __restore_asi
 	 add	%o2, %o5, %o0
-- 
2.50.1


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

* Re: [PATCH 1/1] sparc: fix accurate exception reporting in copy_{from_to}_user for M7
  2025-08-28 12:18 ` [PATCH 1/1] sparc: fix accurate exception reporting in copy_{from_to}_user for M7 Michael Karcher
@ 2025-08-28 12:36   ` John Paul Adrian Glaubitz
  2025-08-28 13:04     ` [PATCH v2 1/1] sparc: fix accurate exception reporting in copy_{from,to}_user " Michael Karcher
  2025-09-04 14:19   ` [PATCH 1/1] sparc: fix accurate exception reporting in copy_{from_to}_user " Andreas Larsson
  1 sibling, 1 reply; 10+ messages in thread
From: John Paul Adrian Glaubitz @ 2025-08-28 12:36 UTC (permalink / raw)
  To: Michael Karcher, linux-kernel; +Cc: sparclinux, Andreas Larsson, Anthony Yznaga

Hi Michael,

On Thu, 2025-08-28 at 14:18 +0200, Michael Karcher wrote:
> ---
>  arch/sparc/lib/M7memcpy.S     | 20 ++++++++++----------
>  arch/sparc/lib/Memcpy_utils.S |  9 +++++++++
>  2 files changed, 19 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/sparc/lib/M7memcpy.S b/arch/sparc/lib/M7memcpy.S
> index cbd42ea7c3f7..99357bfa8e82 100644
> --- a/arch/sparc/lib/M7memcpy.S
> +++ b/arch/sparc/lib/M7memcpy.S
> @@ -696,16 +696,16 @@ FUNC_NAME:
>  	EX_LD_FP(LOAD(ldd, %o4+40, %f26), memcpy_retl_o2_plus_o5_plus_40)
>  	faligndata %f24, %f26, %f10
>  	EX_ST_FP(STORE(std, %f6, %o0+24), memcpy_retl_o2_plus_o5_plus_40)
> -	EX_LD_FP(LOAD(ldd, %o4+48, %f28), memcpy_retl_o2_plus_o5_plus_40)
> +	EX_LD_FP(LOAD(ldd, %o4+48, %f28), memcpy_retl_o2_plus_o5_plus_32)
>  	faligndata %f26, %f28, %f12
> -	EX_ST_FP(STORE(std, %f8, %o0+32), memcpy_retl_o2_plus_o5_plus_40)
> +	EX_ST_FP(STORE(std, %f8, %o0+32), memcpy_retl_o2_plus_o5_plus_32)
>  	add	%o4, 64, %o4
> -	EX_LD_FP(LOAD(ldd, %o4-8, %f30), memcpy_retl_o2_plus_o5_plus_40)
> +	EX_LD_FP(LOAD(ldd, %o4-8, %f30), memcpy_retl_o2_plus_o5_plus_24)
>  	faligndata %f28, %f30, %f14
> -	EX_ST_FP(STORE(std, %f10, %o0+40), memcpy_retl_o2_plus_o5_plus_40)
> -	EX_ST_FP(STORE(std, %f12, %o0+48), memcpy_retl_o2_plus_o5_plus_40)
> +	EX_ST_FP(STORE(std, %f10, %o0+40), memcpy_retl_o2_plus_o5_plus_24)
> +	EX_ST_FP(STORE(std, %f12, %o0+48), memcpy_retl_o2_plus_o5_plus_16)
>  	add	%o0, 64, %o0
> -	EX_ST_FP(STORE(std, %f14, %o0-8), memcpy_retl_o2_plus_o5_plus_40)
> +	EX_ST_FP(STORE(std, %f14, %o0-8), memcpy_retl_o2_plus_o5_plus_8)
>  	fsrc2	%f30, %f14
>  	bgu,pt	%xcc, .Lunalign_sloop
>  	 prefetch [%o4 + (8 * BLOCK_SIZE)], 20
> @@ -728,7 +728,7 @@ FUNC_NAME:
>  	add	%o4, 8, %o4
>  	faligndata %f0, %f2, %f16
>  	subcc	%o5, 8, %o5
> -	EX_ST_FP(STORE(std, %f16, %o0), memcpy_retl_o2_plus_o5)
> +	EX_ST_FP(STORE(std, %f16, %o0), memcpy_retl_o2_plus_o5_plus_8)
>  	fsrc2	%f2, %f0
>  	bgu,pt	%xcc, .Lunalign_by8
>  	 add	%o0, 8, %o0
> @@ -772,7 +772,7 @@ FUNC_NAME:
>  	subcc	%o5, 0x20, %o5
>  	EX_ST(STORE(stx, %o3, %o0 + 0x00), memcpy_retl_o2_plus_o5_plus_32)
>  	EX_ST(STORE(stx, %g2, %o0 + 0x08), memcpy_retl_o2_plus_o5_plus_24)
> -	EX_ST(STORE(stx, %g7, %o0 + 0x10), memcpy_retl_o2_plus_o5_plus_24)
> +	EX_ST(STORE(stx, %g7, %o0 + 0x10), memcpy_retl_o2_plus_o5_plus_16)
>  	EX_ST(STORE(stx, %o4, %o0 + 0x18), memcpy_retl_o2_plus_o5_plus_8)
>  	bne,pt	%xcc, 1b
>  	 add	%o0, 0x20, %o0
> @@ -804,12 +804,12 @@ FUNC_NAME:
>  	brz,pt	%o3, 2f
>  	 sub	%o2, %o3, %o2
>  
> -1:	EX_LD(LOAD(ldub, %o1 + 0x00, %g2), memcpy_retl_o2_plus_g1)
> +1:	EX_LD(LOAD(ldub, %o1 + 0x00, %g2), memcpy_retl_o2_plus_o3)
>  	add	%o1, 1, %o1
>  	subcc	%o3, 1, %o3
>  	add	%o0, 1, %o0
>  	bne,pt	%xcc, 1b
> -	 EX_ST(STORE(stb, %g2, %o0 - 0x01), memcpy_retl_o2_plus_g1_plus_1)
> +	 EX_ST(STORE(stb, %g2, %o0 - 0x01), memcpy_retl_o2_plus_o3_plus_1)
>  2:
>  	and	%o1, 0x7, %o3
>  	brz,pn	%o3, .Lmedium_noprefetch_cp
> diff --git a/arch/sparc/lib/Memcpy_utils.S b/arch/sparc/lib/Memcpy_utils.S
> index 64fbac28b3db..207343367bb2 100644
> --- a/arch/sparc/lib/Memcpy_utils.S
> +++ b/arch/sparc/lib/Memcpy_utils.S
> @@ -137,6 +137,15 @@ ENTRY(memcpy_retl_o2_plus_63_8)
>  	ba,pt	%xcc, __restore_asi
>  	 add	%o2, 8, %o0
>  ENDPROC(memcpy_retl_o2_plus_63_8)
> +ENTRY(memcpy_retl_o2_plus_o3)
> +	ba,pt	%xcc, __restore_asi
> +	 add	%o2, %o3, %o0
> +ENDPROC(memcpy_retl_o2_plus_o3)
> +ENTRY(memcpy_retl_o2_plus_o3_plus_1)
> +	add	%o3, 1, %o3
> +	ba,pt	%xcc, __restore_asi
> +	 add	%o2, %o3, %o0
> +ENDPROC(memcpy_retl_o2_plus_o3_plus_1)
>  ENTRY(memcpy_retl_o2_plus_o5)
>  	ba,pt	%xcc, __restore_asi
>  	 add	%o2, %o5, %o0

Shouldn't this have:

Fixes 34060b8fffa7 ("arch/sparc: Add accurate exception reporting in M7memcpy")

?

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

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

* [PATCH v2 1/1] sparc: fix accurate exception reporting in copy_{from,to}_user for M7
  2025-08-28 12:36   ` John Paul Adrian Glaubitz
@ 2025-08-28 13:04     ` Michael Karcher
  2025-08-31 23:43       ` John Paul Adrian Glaubitz
  2025-09-01 19:15       ` John Paul Adrian Glaubitz
  0 siblings, 2 replies; 10+ messages in thread
From: Michael Karcher @ 2025-08-28 13:04 UTC (permalink / raw)
  To: linux-kernel
  Cc: sparclinux, Michael Karcher, Andreas Larsson,
	John Paul Adrian Glaubitz, Anthony Yznaga

Fixes 34060b8fffa7 ("arch/sparc: Add accurate exception reporting in M7memcpy")
Signed-off-by: Michael Karcher <kernel@mkarcher.dialup.fu-berlin.de>
---
 arch/sparc/lib/M7memcpy.S     | 20 ++++++++++----------
 arch/sparc/lib/Memcpy_utils.S |  9 +++++++++
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/arch/sparc/lib/M7memcpy.S b/arch/sparc/lib/M7memcpy.S
index cbd42ea7c3f7..99357bfa8e82 100644
--- a/arch/sparc/lib/M7memcpy.S
+++ b/arch/sparc/lib/M7memcpy.S
@@ -696,16 +696,16 @@ FUNC_NAME:
 	EX_LD_FP(LOAD(ldd, %o4+40, %f26), memcpy_retl_o2_plus_o5_plus_40)
 	faligndata %f24, %f26, %f10
 	EX_ST_FP(STORE(std, %f6, %o0+24), memcpy_retl_o2_plus_o5_plus_40)
-	EX_LD_FP(LOAD(ldd, %o4+48, %f28), memcpy_retl_o2_plus_o5_plus_40)
+	EX_LD_FP(LOAD(ldd, %o4+48, %f28), memcpy_retl_o2_plus_o5_plus_32)
 	faligndata %f26, %f28, %f12
-	EX_ST_FP(STORE(std, %f8, %o0+32), memcpy_retl_o2_plus_o5_plus_40)
+	EX_ST_FP(STORE(std, %f8, %o0+32), memcpy_retl_o2_plus_o5_plus_32)
 	add	%o4, 64, %o4
-	EX_LD_FP(LOAD(ldd, %o4-8, %f30), memcpy_retl_o2_plus_o5_plus_40)
+	EX_LD_FP(LOAD(ldd, %o4-8, %f30), memcpy_retl_o2_plus_o5_plus_24)
 	faligndata %f28, %f30, %f14
-	EX_ST_FP(STORE(std, %f10, %o0+40), memcpy_retl_o2_plus_o5_plus_40)
-	EX_ST_FP(STORE(std, %f12, %o0+48), memcpy_retl_o2_plus_o5_plus_40)
+	EX_ST_FP(STORE(std, %f10, %o0+40), memcpy_retl_o2_plus_o5_plus_24)
+	EX_ST_FP(STORE(std, %f12, %o0+48), memcpy_retl_o2_plus_o5_plus_16)
 	add	%o0, 64, %o0
-	EX_ST_FP(STORE(std, %f14, %o0-8), memcpy_retl_o2_plus_o5_plus_40)
+	EX_ST_FP(STORE(std, %f14, %o0-8), memcpy_retl_o2_plus_o5_plus_8)
 	fsrc2	%f30, %f14
 	bgu,pt	%xcc, .Lunalign_sloop
 	 prefetch [%o4 + (8 * BLOCK_SIZE)], 20
@@ -728,7 +728,7 @@ FUNC_NAME:
 	add	%o4, 8, %o4
 	faligndata %f0, %f2, %f16
 	subcc	%o5, 8, %o5
-	EX_ST_FP(STORE(std, %f16, %o0), memcpy_retl_o2_plus_o5)
+	EX_ST_FP(STORE(std, %f16, %o0), memcpy_retl_o2_plus_o5_plus_8)
 	fsrc2	%f2, %f0
 	bgu,pt	%xcc, .Lunalign_by8
 	 add	%o0, 8, %o0
@@ -772,7 +772,7 @@ FUNC_NAME:
 	subcc	%o5, 0x20, %o5
 	EX_ST(STORE(stx, %o3, %o0 + 0x00), memcpy_retl_o2_plus_o5_plus_32)
 	EX_ST(STORE(stx, %g2, %o0 + 0x08), memcpy_retl_o2_plus_o5_plus_24)
-	EX_ST(STORE(stx, %g7, %o0 + 0x10), memcpy_retl_o2_plus_o5_plus_24)
+	EX_ST(STORE(stx, %g7, %o0 + 0x10), memcpy_retl_o2_plus_o5_plus_16)
 	EX_ST(STORE(stx, %o4, %o0 + 0x18), memcpy_retl_o2_plus_o5_plus_8)
 	bne,pt	%xcc, 1b
 	 add	%o0, 0x20, %o0
@@ -804,12 +804,12 @@ FUNC_NAME:
 	brz,pt	%o3, 2f
 	 sub	%o2, %o3, %o2
 
-1:	EX_LD(LOAD(ldub, %o1 + 0x00, %g2), memcpy_retl_o2_plus_g1)
+1:	EX_LD(LOAD(ldub, %o1 + 0x00, %g2), memcpy_retl_o2_plus_o3)
 	add	%o1, 1, %o1
 	subcc	%o3, 1, %o3
 	add	%o0, 1, %o0
 	bne,pt	%xcc, 1b
-	 EX_ST(STORE(stb, %g2, %o0 - 0x01), memcpy_retl_o2_plus_g1_plus_1)
+	 EX_ST(STORE(stb, %g2, %o0 - 0x01), memcpy_retl_o2_plus_o3_plus_1)
 2:
 	and	%o1, 0x7, %o3
 	brz,pn	%o3, .Lmedium_noprefetch_cp
diff --git a/arch/sparc/lib/Memcpy_utils.S b/arch/sparc/lib/Memcpy_utils.S
index 64fbac28b3db..207343367bb2 100644
--- a/arch/sparc/lib/Memcpy_utils.S
+++ b/arch/sparc/lib/Memcpy_utils.S
@@ -137,6 +137,15 @@ ENTRY(memcpy_retl_o2_plus_63_8)
 	ba,pt	%xcc, __restore_asi
 	 add	%o2, 8, %o0
 ENDPROC(memcpy_retl_o2_plus_63_8)
+ENTRY(memcpy_retl_o2_plus_o3)
+	ba,pt	%xcc, __restore_asi
+	 add	%o2, %o3, %o0
+ENDPROC(memcpy_retl_o2_plus_o3)
+ENTRY(memcpy_retl_o2_plus_o3_plus_1)
+	add	%o3, 1, %o3
+	ba,pt	%xcc, __restore_asi
+	 add	%o2, %o3, %o0
+ENDPROC(memcpy_retl_o2_plus_o3_plus_1)
 ENTRY(memcpy_retl_o2_plus_o5)
 	ba,pt	%xcc, __restore_asi
 	 add	%o2, %o5, %o0
-- 
2.50.1


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

* Re: [PATCH v2 1/1] sparc: fix accurate exception reporting in copy_{from,to}_user for M7
  2025-08-28 13:04     ` [PATCH v2 1/1] sparc: fix accurate exception reporting in copy_{from,to}_user " Michael Karcher
@ 2025-08-31 23:43       ` John Paul Adrian Glaubitz
  2025-09-01  7:00         ` Rainer Orth
  2025-09-01 19:15       ` John Paul Adrian Glaubitz
  1 sibling, 1 reply; 10+ messages in thread
From: John Paul Adrian Glaubitz @ 2025-08-31 23:43 UTC (permalink / raw)
  To: Michael Karcher, linux-kernel
  Cc: sparclinux, Andreas Larsson, Anthony Yznaga, Rainer Orth

Hi Rainer,

On Thu, 2025-08-28 at 15:04 +0200, Michael Karcher wrote:
> Fixes 34060b8fffa7 ("arch/sparc: Add accurate exception reporting in M7memcpy")
> Signed-off-by: Michael Karcher <kernel@mkarcher.dialup.fu-berlin.de>
> ---
>  arch/sparc/lib/M7memcpy.S     | 20 ++++++++++----------
>  arch/sparc/lib/Memcpy_utils.S |  9 +++++++++
>  2 files changed, 19 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/sparc/lib/M7memcpy.S b/arch/sparc/lib/M7memcpy.S
> index cbd42ea7c3f7..99357bfa8e82 100644
> --- a/arch/sparc/lib/M7memcpy.S
> +++ b/arch/sparc/lib/M7memcpy.S
> @@ -696,16 +696,16 @@ FUNC_NAME:
>  	EX_LD_FP(LOAD(ldd, %o4+40, %f26), memcpy_retl_o2_plus_o5_plus_40)
>  	faligndata %f24, %f26, %f10
>  	EX_ST_FP(STORE(std, %f6, %o0+24), memcpy_retl_o2_plus_o5_plus_40)
> -	EX_LD_FP(LOAD(ldd, %o4+48, %f28), memcpy_retl_o2_plus_o5_plus_40)
> +	EX_LD_FP(LOAD(ldd, %o4+48, %f28), memcpy_retl_o2_plus_o5_plus_32)
>  	faligndata %f26, %f28, %f12
> -	EX_ST_FP(STORE(std, %f8, %o0+32), memcpy_retl_o2_plus_o5_plus_40)
> +	EX_ST_FP(STORE(std, %f8, %o0+32), memcpy_retl_o2_plus_o5_plus_32)
>  	add	%o4, 64, %o4
> -	EX_LD_FP(LOAD(ldd, %o4-8, %f30), memcpy_retl_o2_plus_o5_plus_40)
> +	EX_LD_FP(LOAD(ldd, %o4-8, %f30), memcpy_retl_o2_plus_o5_plus_24)
>  	faligndata %f28, %f30, %f14
> -	EX_ST_FP(STORE(std, %f10, %o0+40), memcpy_retl_o2_plus_o5_plus_40)
> -	EX_ST_FP(STORE(std, %f12, %o0+48), memcpy_retl_o2_plus_o5_plus_40)
> +	EX_ST_FP(STORE(std, %f10, %o0+40), memcpy_retl_o2_plus_o5_plus_24)
> +	EX_ST_FP(STORE(std, %f12, %o0+48), memcpy_retl_o2_plus_o5_plus_16)
>  	add	%o0, 64, %o0
> -	EX_ST_FP(STORE(std, %f14, %o0-8), memcpy_retl_o2_plus_o5_plus_40)
> +	EX_ST_FP(STORE(std, %f14, %o0-8), memcpy_retl_o2_plus_o5_plus_8)
>  	fsrc2	%f30, %f14
>  	bgu,pt	%xcc, .Lunalign_sloop
>  	 prefetch [%o4 + (8 * BLOCK_SIZE)], 20
> @@ -728,7 +728,7 @@ FUNC_NAME:
>  	add	%o4, 8, %o4
>  	faligndata %f0, %f2, %f16
>  	subcc	%o5, 8, %o5
> -	EX_ST_FP(STORE(std, %f16, %o0), memcpy_retl_o2_plus_o5)
> +	EX_ST_FP(STORE(std, %f16, %o0), memcpy_retl_o2_plus_o5_plus_8)
>  	fsrc2	%f2, %f0
>  	bgu,pt	%xcc, .Lunalign_by8
>  	 add	%o0, 8, %o0
> @@ -772,7 +772,7 @@ FUNC_NAME:
>  	subcc	%o5, 0x20, %o5
>  	EX_ST(STORE(stx, %o3, %o0 + 0x00), memcpy_retl_o2_plus_o5_plus_32)
>  	EX_ST(STORE(stx, %g2, %o0 + 0x08), memcpy_retl_o2_plus_o5_plus_24)
> -	EX_ST(STORE(stx, %g7, %o0 + 0x10), memcpy_retl_o2_plus_o5_plus_24)
> +	EX_ST(STORE(stx, %g7, %o0 + 0x10), memcpy_retl_o2_plus_o5_plus_16)
>  	EX_ST(STORE(stx, %o4, %o0 + 0x18), memcpy_retl_o2_plus_o5_plus_8)
>  	bne,pt	%xcc, 1b
>  	 add	%o0, 0x20, %o0
> @@ -804,12 +804,12 @@ FUNC_NAME:
>  	brz,pt	%o3, 2f
>  	 sub	%o2, %o3, %o2
>  
> -1:	EX_LD(LOAD(ldub, %o1 + 0x00, %g2), memcpy_retl_o2_plus_g1)
> +1:	EX_LD(LOAD(ldub, %o1 + 0x00, %g2), memcpy_retl_o2_plus_o3)
>  	add	%o1, 1, %o1
>  	subcc	%o3, 1, %o3
>  	add	%o0, 1, %o0
>  	bne,pt	%xcc, 1b
> -	 EX_ST(STORE(stb, %g2, %o0 - 0x01), memcpy_retl_o2_plus_g1_plus_1)
> +	 EX_ST(STORE(stb, %g2, %o0 - 0x01), memcpy_retl_o2_plus_o3_plus_1)
>  2:
>  	and	%o1, 0x7, %o3
>  	brz,pn	%o3, .Lmedium_noprefetch_cp
> diff --git a/arch/sparc/lib/Memcpy_utils.S b/arch/sparc/lib/Memcpy_utils.S
> index 64fbac28b3db..207343367bb2 100644
> --- a/arch/sparc/lib/Memcpy_utils.S
> +++ b/arch/sparc/lib/Memcpy_utils.S
> @@ -137,6 +137,15 @@ ENTRY(memcpy_retl_o2_plus_63_8)
>  	ba,pt	%xcc, __restore_asi
>  	 add	%o2, 8, %o0
>  ENDPROC(memcpy_retl_o2_plus_63_8)
> +ENTRY(memcpy_retl_o2_plus_o3)
> +	ba,pt	%xcc, __restore_asi
> +	 add	%o2, %o3, %o0
> +ENDPROC(memcpy_retl_o2_plus_o3)
> +ENTRY(memcpy_retl_o2_plus_o3_plus_1)
> +	add	%o3, 1, %o3
> +	ba,pt	%xcc, __restore_asi
> +	 add	%o2, %o3, %o0
> +ENDPROC(memcpy_retl_o2_plus_o3_plus_1)
>  ENTRY(memcpy_retl_o2_plus_o5)
>  	ba,pt	%xcc, __restore_asi
>  	 add	%o2, %o5, %o0

in the past, you reported stability issues with the Linux kernel when running
inside an LDOM on SPARC M7/M8. Could you verify whether the patch above fixes
these problems or whether at least they don't introduce regressions?

Thanks,
Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

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

* Re: [PATCH v2 1/1] sparc: fix accurate exception reporting in copy_{from,to}_user for M7
  2025-08-31 23:43       ` John Paul Adrian Glaubitz
@ 2025-09-01  7:00         ` Rainer Orth
  2025-09-01  7:05           ` John Paul Adrian Glaubitz
  0 siblings, 1 reply; 10+ messages in thread
From: Rainer Orth @ 2025-09-01  7:00 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz
  Cc: Michael Karcher, linux-kernel, sparclinux, Andreas Larsson,
	Anthony Yznaga

Hi Adrian,

> in the past, you reported stability issues with the Linux kernel when running
> inside an LDOM on SPARC M7/M8. Could you verify whether the patch above fixes
> these problems or whether at least they don't introduce regressions?

thanks for the heads-up.  Indeed the hangs persist even when the system
is idle.  However, I've never built a Linux kernel before and have way
too much on the plate to try now.  Besides, I don't have a reproducer
for the issue, so even with a patch I'd have to wait for an extended
period of time to see if the issue is gone, so I'll just wait until the
patch lands in the Debian/sparc64 repo and see if it helps.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

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

* Re: [PATCH v2 1/1] sparc: fix accurate exception reporting in copy_{from,to}_user for M7
  2025-09-01  7:00         ` Rainer Orth
@ 2025-09-01  7:05           ` John Paul Adrian Glaubitz
  2025-09-01 14:18             ` Rainer Orth
  0 siblings, 1 reply; 10+ messages in thread
From: John Paul Adrian Glaubitz @ 2025-09-01  7:05 UTC (permalink / raw)
  To: Rainer Orth
  Cc: Michael Karcher, linux-kernel, sparclinux, Andreas Larsson,
	Anthony Yznaga

Hi Rainer,

On Mon, 2025-09-01 at 09:00 +0200, Rainer Orth wrote:
> > in the past, you reported stability issues with the Linux kernel when running
> > inside an LDOM on SPARC M7/M8. Could you verify whether the patch above fixes
> > these problems or whether at least they don't introduce regressions?
> 
> thanks for the heads-up.  Indeed the hangs persist even when the system
> is idle.  However, I've never built a Linux kernel before and have way
> too much on the plate to try now.  Besides, I don't have a reproducer
> for the issue, so even with a patch I'd have to wait for an extended
> period of time to see if the issue is gone, so I'll just wait until the
> patch lands in the Debian/sparc64 repo and see if it helps.

Would it work if I built a kernel for you plus installation instructions
and a quick explanation how to test it?

FWIW, we consider the patch already acceptable when it doesn't introduce
any regressions.

I did some testing on a SPARC S7 yesterday, but the problem is that the
support for SPARC S7 in the Linux kernel is incomplete at the moment and
I had to add it quickly myself which did actually work but I really would
like to verify it on M7 or M8 again to at least not cause regressions.

Thanks,
Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

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

* Re: [PATCH v2 1/1] sparc: fix accurate exception reporting in copy_{from,to}_user for M7
  2025-09-01  7:05           ` John Paul Adrian Glaubitz
@ 2025-09-01 14:18             ` Rainer Orth
  0 siblings, 0 replies; 10+ messages in thread
From: Rainer Orth @ 2025-09-01 14:18 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz
  Cc: Michael Karcher, linux-kernel, sparclinux, Andreas Larsson,
	Anthony Yznaga

Hi Adrian,

> On Mon, 2025-09-01 at 09:00 +0200, Rainer Orth wrote:
>> > in the past, you reported stability issues with the Linux kernel when running
>> > inside an LDOM on SPARC M7/M8. Could you verify whether the patch above fixes
>> > these problems or whether at least they don't introduce regressions?
>> 
>> thanks for the heads-up.  Indeed the hangs persist even when the system
>> is idle.  However, I've never built a Linux kernel before and have way
>> too much on the plate to try now.  Besides, I don't have a reproducer
>> for the issue, so even with a patch I'd have to wait for an extended
>> period of time to see if the issue is gone, so I'll just wait until the
>> patch lands in the Debian/sparc64 repo and see if it helps.
>
> Would it work if I built a kernel for you plus installation instructions
> and a quick explanation how to test it?

I wouldn't mind trying, but as I said it's difficult to say when I can
claim success given the lack of a reproducer.  All I can report reliably
is failure ;-)

> FWIW, we consider the patch already acceptable when it doesn't introduce
> any regressions.
>
> I did some testing on a SPARC S7 yesterday, but the problem is that the
> support for SPARC S7 in the Linux kernel is incomplete at the moment and
> I had to add it quickly myself which did actually work but I really would
> like to verify it on M7 or M8 again to at least not cause regressions.

The only system that I can test on is S7 (a Netra S7-2 actually).  While
I also have a T8-1, that's reserved for cfarm work.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

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

* Re: [PATCH v2 1/1] sparc: fix accurate exception reporting in copy_{from,to}_user for M7
  2025-08-28 13:04     ` [PATCH v2 1/1] sparc: fix accurate exception reporting in copy_{from,to}_user " Michael Karcher
  2025-08-31 23:43       ` John Paul Adrian Glaubitz
@ 2025-09-01 19:15       ` John Paul Adrian Glaubitz
  1 sibling, 0 replies; 10+ messages in thread
From: John Paul Adrian Glaubitz @ 2025-09-01 19:15 UTC (permalink / raw)
  To: Michael Karcher, linux-kernel
  Cc: sparclinux, Andreas Larsson, Anthony Yznaga, Tony Rodriguez

Hello,

On Thu, 2025-08-28 at 15:04 +0200, Michael Karcher wrote:
> Fixes 34060b8fffa7 ("arch/sparc: Add accurate exception reporting in M7memcpy")
> Signed-off-by: Michael Karcher <kernel@mkarcher.dialup.fu-berlin.de>
> ---
>  arch/sparc/lib/M7memcpy.S     | 20 ++++++++++----------
>  arch/sparc/lib/Memcpy_utils.S |  9 +++++++++
>  2 files changed, 19 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/sparc/lib/M7memcpy.S b/arch/sparc/lib/M7memcpy.S
> index cbd42ea7c3f7..99357bfa8e82 100644
> --- a/arch/sparc/lib/M7memcpy.S
> +++ b/arch/sparc/lib/M7memcpy.S
> @@ -696,16 +696,16 @@ FUNC_NAME:
>  	EX_LD_FP(LOAD(ldd, %o4+40, %f26), memcpy_retl_o2_plus_o5_plus_40)
>  	faligndata %f24, %f26, %f10
>  	EX_ST_FP(STORE(std, %f6, %o0+24), memcpy_retl_o2_plus_o5_plus_40)
> -	EX_LD_FP(LOAD(ldd, %o4+48, %f28), memcpy_retl_o2_plus_o5_plus_40)
> +	EX_LD_FP(LOAD(ldd, %o4+48, %f28), memcpy_retl_o2_plus_o5_plus_32)
>  	faligndata %f26, %f28, %f12
> -	EX_ST_FP(STORE(std, %f8, %o0+32), memcpy_retl_o2_plus_o5_plus_40)
> +	EX_ST_FP(STORE(std, %f8, %o0+32), memcpy_retl_o2_plus_o5_plus_32)
>  	add	%o4, 64, %o4
> -	EX_LD_FP(LOAD(ldd, %o4-8, %f30), memcpy_retl_o2_plus_o5_plus_40)
> +	EX_LD_FP(LOAD(ldd, %o4-8, %f30), memcpy_retl_o2_plus_o5_plus_24)
>  	faligndata %f28, %f30, %f14
> -	EX_ST_FP(STORE(std, %f10, %o0+40), memcpy_retl_o2_plus_o5_plus_40)
> -	EX_ST_FP(STORE(std, %f12, %o0+48), memcpy_retl_o2_plus_o5_plus_40)
> +	EX_ST_FP(STORE(std, %f10, %o0+40), memcpy_retl_o2_plus_o5_plus_24)
> +	EX_ST_FP(STORE(std, %f12, %o0+48), memcpy_retl_o2_plus_o5_plus_16)
>  	add	%o0, 64, %o0
> -	EX_ST_FP(STORE(std, %f14, %o0-8), memcpy_retl_o2_plus_o5_plus_40)
> +	EX_ST_FP(STORE(std, %f14, %o0-8), memcpy_retl_o2_plus_o5_plus_8)
>  	fsrc2	%f30, %f14
>  	bgu,pt	%xcc, .Lunalign_sloop
>  	 prefetch [%o4 + (8 * BLOCK_SIZE)], 20
> @@ -728,7 +728,7 @@ FUNC_NAME:
>  	add	%o4, 8, %o4
>  	faligndata %f0, %f2, %f16
>  	subcc	%o5, 8, %o5
> -	EX_ST_FP(STORE(std, %f16, %o0), memcpy_retl_o2_plus_o5)
> +	EX_ST_FP(STORE(std, %f16, %o0), memcpy_retl_o2_plus_o5_plus_8)
>  	fsrc2	%f2, %f0
>  	bgu,pt	%xcc, .Lunalign_by8
>  	 add	%o0, 8, %o0
> @@ -772,7 +772,7 @@ FUNC_NAME:
>  	subcc	%o5, 0x20, %o5
>  	EX_ST(STORE(stx, %o3, %o0 + 0x00), memcpy_retl_o2_plus_o5_plus_32)
>  	EX_ST(STORE(stx, %g2, %o0 + 0x08), memcpy_retl_o2_plus_o5_plus_24)
> -	EX_ST(STORE(stx, %g7, %o0 + 0x10), memcpy_retl_o2_plus_o5_plus_24)
> +	EX_ST(STORE(stx, %g7, %o0 + 0x10), memcpy_retl_o2_plus_o5_plus_16)
>  	EX_ST(STORE(stx, %o4, %o0 + 0x18), memcpy_retl_o2_plus_o5_plus_8)
>  	bne,pt	%xcc, 1b
>  	 add	%o0, 0x20, %o0
> @@ -804,12 +804,12 @@ FUNC_NAME:
>  	brz,pt	%o3, 2f
>  	 sub	%o2, %o3, %o2
>  
> -1:	EX_LD(LOAD(ldub, %o1 + 0x00, %g2), memcpy_retl_o2_plus_g1)
> +1:	EX_LD(LOAD(ldub, %o1 + 0x00, %g2), memcpy_retl_o2_plus_o3)
>  	add	%o1, 1, %o1
>  	subcc	%o3, 1, %o3
>  	add	%o0, 1, %o0
>  	bne,pt	%xcc, 1b
> -	 EX_ST(STORE(stb, %g2, %o0 - 0x01), memcpy_retl_o2_plus_g1_plus_1)
> +	 EX_ST(STORE(stb, %g2, %o0 - 0x01), memcpy_retl_o2_plus_o3_plus_1)
>  2:
>  	and	%o1, 0x7, %o3
>  	brz,pn	%o3, .Lmedium_noprefetch_cp
> diff --git a/arch/sparc/lib/Memcpy_utils.S b/arch/sparc/lib/Memcpy_utils.S
> index 64fbac28b3db..207343367bb2 100644
> --- a/arch/sparc/lib/Memcpy_utils.S
> +++ b/arch/sparc/lib/Memcpy_utils.S
> @@ -137,6 +137,15 @@ ENTRY(memcpy_retl_o2_plus_63_8)
>  	ba,pt	%xcc, __restore_asi
>  	 add	%o2, 8, %o0
>  ENDPROC(memcpy_retl_o2_plus_63_8)
> +ENTRY(memcpy_retl_o2_plus_o3)
> +	ba,pt	%xcc, __restore_asi
> +	 add	%o2, %o3, %o0
> +ENDPROC(memcpy_retl_o2_plus_o3)
> +ENTRY(memcpy_retl_o2_plus_o3_plus_1)
> +	add	%o3, 1, %o3
> +	ba,pt	%xcc, __restore_asi
> +	 add	%o2, %o3, %o0
> +ENDPROC(memcpy_retl_o2_plus_o3_plus_1)
>  ENTRY(memcpy_retl_o2_plus_o5)
>  	ba,pt	%xcc, __restore_asi
>  	 add	%o2, %o5, %o0

I have had the chance to test this patch on a SPARC S7 machine. After adding the
CPU detection fixes from Oracle's UEK kernel [1][2][3] and making sure that
sparc_m7_patch was invoked for SPARC S7 to enable the M7-specific copy_{from,to}_user
code, I can confirm that the machine runs stable with the patch above.

I even verified that the CPU detection works properly and calls sparc_m7_patch by
using the following hack which made the SPARC S7 indeed hang at boot:

diff --git a/arch/sparc/kernel/head_64.S b/arch/sparc/kernel/head_64.S
index c305486501dc..2de3d5139e1f 100644
--- a/arch/sparc/kernel/head_64.S
+++ b/arch/sparc/kernel/head_64.S
@@ -613,8 +613,9 @@ niagara_tlb_fixup:
        cmp     %g1, SUN4V_CHIP_SPARC_M8
        be,pt   %xcc, sparc_m7_patch
         nop
+sparc_s7_loop:
        cmp     %g1, SUN4V_CHIP_SPARC_S7
-       be,pt   %xcc, sparc_m7_patch
+       be,pt   %xcc, sparc_s7_loop
         nop
 
        call    generic_patch_copyops


Additionally, the owner of this machine, Tony Rodriguez stress-ng and hardinfo2
tests without any problems. Both passed.

Tested-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>

Adrian

> [1] https://github.com/oracle/linux-uek/commit/71051596a59897d6fe577d92184081fbccada7af
> [2] https://github.com/oracle/linux-uek/commit/01bd59051e17dc04785211350a05fd337460b86b
> [3] https://github.com/oracle/linux-uek/commit/e3125b871798dcd831daaf70bb05ff3f005277fb

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

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

* Re: [PATCH 1/1] sparc: fix accurate exception reporting in copy_{from_to}_user for M7
  2025-08-28 12:18 ` [PATCH 1/1] sparc: fix accurate exception reporting in copy_{from_to}_user for M7 Michael Karcher
  2025-08-28 12:36   ` John Paul Adrian Glaubitz
@ 2025-09-04 14:19   ` Andreas Larsson
  1 sibling, 0 replies; 10+ messages in thread
From: Andreas Larsson @ 2025-09-04 14:19 UTC (permalink / raw)
  To: Michael Karcher, linux-kernel
  Cc: sparclinux, John Paul Adrian Glaubitz, Anthony Yznaga

On 2025-08-28 14:18, Michael Karcher wrote:
> ---
>  arch/sparc/lib/M7memcpy.S     | 20 ++++++++++----------
>  arch/sparc/lib/Memcpy_utils.S |  9 +++++++++
>  2 files changed, 19 insertions(+), 10 deletions(-)

I think putting this patch together with the first four in the v2 of the
"Fix accurate exception reporting in SPARC assembly" series would be
good so that they all are under the same cover letter that has the
larger context. A lore link in the v2 letter to both these v1 threads
would allow tracking back the discussion history for both threads.

Cheers,
Andreas


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

end of thread, other threads:[~2025-09-04 14:19 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-28 12:18 sparc: Another fix for accurate exception reporting in copy_{from,to}_user Michael Karcher
2025-08-28 12:18 ` [PATCH 1/1] sparc: fix accurate exception reporting in copy_{from_to}_user for M7 Michael Karcher
2025-08-28 12:36   ` John Paul Adrian Glaubitz
2025-08-28 13:04     ` [PATCH v2 1/1] sparc: fix accurate exception reporting in copy_{from,to}_user " Michael Karcher
2025-08-31 23:43       ` John Paul Adrian Glaubitz
2025-09-01  7:00         ` Rainer Orth
2025-09-01  7:05           ` John Paul Adrian Glaubitz
2025-09-01 14:18             ` Rainer Orth
2025-09-01 19:15       ` John Paul Adrian Glaubitz
2025-09-04 14:19   ` [PATCH 1/1] sparc: fix accurate exception reporting in copy_{from_to}_user " Andreas Larsson

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).