[PATCH v5 10/22] riscv: Fix Race conditions in pthread cancellation [BZ#12683]

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Tue Apr 11 13:49:22 GMT 2023



On 11/04/23 04:01, Xi Ruoyao wrote:
> On Tue, 2023-04-11 at 14:35 +0800, Xi Ruoyao wrote:
>> On Mon, 2023-04-10 at 17:46 -0300, Adhemerval Zanella via Libc-alpha
>> wrote:
>>> +1:
>>> +       addi    sp, sp, -16
>>> +       cfi_def_cfa_offset (16)
>>> +       REG_S   ra, (16-SZREG)(sp)
>>> +       cfi_offset (ra, -SZREG)
>>> +       call    __syscall_do_cancel
>>
>> Similarly to LoongArch, IMO this should simply be
>> "tail __syscall_do_cancel".
>>
>> Apparently _Noreturn is preventing GCC from generating a tail call for
>> RISC-V and LoongArch
> 
> Actually "everywhere" (but why the AArch64 code seems optimized?)

I hand optimized on some architectures, like x86_64 and aarch64.  For most
of the other architectures I just modeled after compiler generated call.

> 
>> so if you modeled the assembly following the GCC
>> output you'll get these sub-optimal things.  It seems a GCC bug to me.
> 
> It's https://gcc.gnu.org/PR10837 and closed as WONTFIX 20 years ago :(.
> And a comment from H.J. complained an impact on Glibc.
> 
> 


More information about the Libc-alpha mailing list