diff mbox series

linux: sparc: Fix syscall_cancel for LEON

Message ID 20240902195841.1455273-1-adhemerval.zanella@linaro.org
State Accepted
Commit 49c3682ce18fc283433b759ea606bdc26df6b829
Headers show
Series linux: sparc: Fix syscall_cancel for LEON | expand

Commit Message

Adhemerval Zanella Netto Sept. 2, 2024, 7:58 p.m. UTC
LEON2/LEON3 are both sparcv8, which does not support branch hints
(bne,pn) nor the return instruction.

Checked with a build for sparcv8-linux-gnu targetting leon. I also
check some cancellation tests with qemu-system (targeting LEON3).
---
 sysdeps/unix/sysv/linux/sparc/sparc32/syscall_cancel.S | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

John Paul Adrian Glaubitz Sept. 26, 2024, 6:07 p.m. UTC | #1
On Mon, 2024-09-02 at 16:58 -0300, Adhemerval Zanella wrote:
> LEON2/LEON3 are both sparcv8, which does not support branch hints
> (bne,pn) nor the return instruction.
> 
> Checked with a build for sparcv8-linux-gnu targetting leon. I also
> check some cancellation tests with qemu-system (targeting LEON3).
  ^^^^^
This should be "checked".

> ---
>  sysdeps/unix/sysv/linux/sparc/sparc32/syscall_cancel.S | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/syscall_cancel.S b/sysdeps/unix/sysv/linux/sparc/sparc32/syscall_cancel.S
> index aa5c658ce1..0db93c77bf 100644
> --- a/sysdeps/unix/sysv/linux/sparc/sparc32/syscall_cancel.S
> +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/syscall_cancel.S
> @@ -42,7 +42,11 @@ __syscall_cancel_arch_start:
>  	     __syscall_do_cancel()  */
>  	ld	[%i0], %g2
>  	andcc	%g2, TCB_CANCELED_BITMASK, %g0
> +#ifdef __sparcv9
>  	bne,pn	%icc, 2f
> +#else
> +	bne	2f
> +#endif
>  	/* Issue a 6 argument syscall.  */
>  	 mov	%i1, %g1
>  	mov	%i2, %o0
> @@ -60,8 +64,13 @@ __syscall_cancel_arch_end:
>  	sub	%g0, %o0, %o0
>  1:
>  	mov	%o0, %i0
> +#ifdef __sparcv9
>  	return	%i7+8
>  	 nop
> +#else
> +	jmp	%i7+8
> +	 restore
> +#endif
>  
>  2:
>  	call	__syscall_do_cancel, 0

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

Thanks,
Adrian
Adhemerval Zanella Netto Oct. 1, 2024, 1:36 p.m. UTC | #2
On 26/09/24 15:07, John Paul Adrian Glaubitz wrote:
> On Mon, 2024-09-02 at 16:58 -0300, Adhemerval Zanella wrote:
>> LEON2/LEON3 are both sparcv8, which does not support branch hints
>> (bne,pn) nor the return instruction.
>>
>> Checked with a build for sparcv8-linux-gnu targetting leon. I also
>> check some cancellation tests with qemu-system (targeting LEON3).
>   ^^^^^
> This should be "checked".

Ack.

> 
>> ---
>>  sysdeps/unix/sysv/linux/sparc/sparc32/syscall_cancel.S | 9 +++++++++
>>  1 file changed, 9 insertions(+)
>>
>> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/syscall_cancel.S b/sysdeps/unix/sysv/linux/sparc/sparc32/syscall_cancel.S
>> index aa5c658ce1..0db93c77bf 100644
>> --- a/sysdeps/unix/sysv/linux/sparc/sparc32/syscall_cancel.S
>> +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/syscall_cancel.S
>> @@ -42,7 +42,11 @@ __syscall_cancel_arch_start:
>>  	     __syscall_do_cancel()  */
>>  	ld	[%i0], %g2
>>  	andcc	%g2, TCB_CANCELED_BITMASK, %g0
>> +#ifdef __sparcv9
>>  	bne,pn	%icc, 2f
>> +#else
>> +	bne	2f
>> +#endif
>>  	/* Issue a 6 argument syscall.  */
>>  	 mov	%i1, %g1
>>  	mov	%i2, %o0
>> @@ -60,8 +64,13 @@ __syscall_cancel_arch_end:
>>  	sub	%g0, %o0, %o0
>>  1:
>>  	mov	%o0, %i0
>> +#ifdef __sparcv9
>>  	return	%i7+8
>>  	 nop
>> +#else
>> +	jmp	%i7+8
>> +	 restore
>> +#endif
>>  
>>  2:
>>  	call	__syscall_do_cancel, 0
> 
> Acked-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
> 

Thanks, I will install it.
John Paul Adrian Glaubitz Oct. 1, 2024, 2:07 p.m. UTC | #3
Hi Adhemerval,

On Tue, 2024-10-01 at 10:36 -0300, Adhemerval Zanella Netto wrote:
> > Acked-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
> > 
> 
> Thanks, I will install it.

Thanks a lot for committing both fixes.

Do you also have any news regarding that restartable syscall bug on SPARC
that was reported and where you came up with a patch?

Adrian
Adhemerval Zanella Netto Oct. 1, 2024, 5:29 p.m. UTC | #4
On 01/10/24 11:07, John Paul Adrian Glaubitz wrote:
> Hi Adhemerval,
> 
> On Tue, 2024-10-01 at 10:36 -0300, Adhemerval Zanella Netto wrote:
>>> Acked-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
>>>
>>
>> Thanks, I will install it.
> 
> Thanks a lot for committing both fixes.
> 
> Do you also have any news regarding that restartable syscall bug on SPARC
> that was reported and where you came up with a patch?

Florian has acked the support patch for the testcase, but I did not hear
anything from Rene (which was the one that originally complained about
this issue).  At least I haven't see any regression on glibc testsuite.
Sam James Oct. 1, 2024, 9:16 p.m. UTC | #5
Adhemerval Zanella Netto <adhemerval.zanella@linaro.org> writes:

> On 01/10/24 11:07, John Paul Adrian Glaubitz wrote:
>> Hi Adhemerval,
>> 
>> On Tue, 2024-10-01 at 10:36 -0300, Adhemerval Zanella Netto wrote:
>>>> Acked-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
>>>>
>>>
>>> Thanks, I will install it.
>> 
>> Thanks a lot for committing both fixes.
>> 
>> Do you also have any news regarding that restartable syscall bug on SPARC
>> that was reported and where you came up with a patch?
>
> Florian has acked the support patch for the testcase, but I did not hear
> anything from Rene (which was the one that originally complained about
> this issue).  At least I haven't see any regression on glibc testsuite.

I can test it as I can reproduce the issue easily with job control in
the shell.
diff mbox series

Patch

diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/syscall_cancel.S b/sysdeps/unix/sysv/linux/sparc/sparc32/syscall_cancel.S
index aa5c658ce1..0db93c77bf 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/syscall_cancel.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/syscall_cancel.S
@@ -42,7 +42,11 @@  __syscall_cancel_arch_start:
 	     __syscall_do_cancel()  */
 	ld	[%i0], %g2
 	andcc	%g2, TCB_CANCELED_BITMASK, %g0
+#ifdef __sparcv9
 	bne,pn	%icc, 2f
+#else
+	bne	2f
+#endif
 	/* Issue a 6 argument syscall.  */
 	 mov	%i1, %g1
 	mov	%i2, %o0
@@ -60,8 +64,13 @@  __syscall_cancel_arch_end:
 	sub	%g0, %o0, %o0
 1:
 	mov	%o0, %i0
+#ifdef __sparcv9
 	return	%i7+8
 	 nop
+#else
+	jmp	%i7+8
+	 restore
+#endif
 
 2:
 	call	__syscall_do_cancel, 0