[PATCH v2 09/15] RISC-V: Atomic and Locking Routines

Palmer Dabbelt palmer@dabbelt.com
Sun Dec 24 01:26:00 GMT 2017


On Wed, 20 Dec 2017 09:08:18 PST (-0800), joseph@codesourcery.com wrote:
> On Tue, 19 Dec 2017, Palmer Dabbelt wrote:
>
>> This patch implements various atomic and locking routines on RISC-V,
>> either via the A extension (when present) or via a Linux system call
>> that does a compare-and-exchange.  This contains both the library
>> routines and the syscall wrapper.
>
> You said in the introduction that the 'A' extension would be required for
> Linux.  I think you need to update the patch description - *and* the patch
> itself - to reflect that.
>
>> diff --git a/sysdeps/riscv/rv64/rvd/s_roundeven.c b/sysdeps/riscv/rv64/rvd/s_roundeven.c
>
> Does not belong in this patch.
>
>> diff --git a/sysdeps/riscv/rv64/rvf/s_llrintf.c b/sysdeps/riscv/rv64/rvf/s_llrintf.c
>
> Likewise.
>
>> +#ifdef __riscv_atomic
>> +
>> +#define __HAVE_64B_ATOMICS (__riscv_xlen >= 64)
>> +#define USE_ATOMIC_COMPILER_BUILTINS 1
>> +#define ATOMIC_EXCHANGE_USES_CAS 0
>
> Missing preprocessor indentation.
>
>> +/* Miscellaneous. */
>> +
>> +#define asm_amo(which, ordering, mem, value) ({ 		\
>
> Likewise, in this part of the file.
>
>> +#else /* __riscv_atomic */
>
> And this part of the file should now just have a #error.  (Giving an error
> for non-A at configure time would be a good idea as well, so the bad
> configuration gets detected as early as possible.)

I've already made it #error here, and I added a preconfigure check for the 
atomic extension as well.  I'll fix up the commit for the v3.

Thanks!



More information about the Libc-alpha mailing list