[PATCH] RISC-V: Add futex support.

Jim Wilson jimw at sifive.com
Mon Oct 15 08:57:24 PDT 2018

On Mon, Oct 15, 2018 at 1:34 AM Christoph Hellwig <hch at infradead.org> wrote:
> > +#include <asm/asm.h>
> > +
> > +#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg)           \
> > +{                                                                    \
> > +     uintptr_t __tmp;                                                \
> > +     if (__riscv_atomic) {                                           \
> __riscv_atomic doesn't exist anywhere in the kernel tree.

__riscv_atomic is a predefined macro from the compiler.  It is defined
when the target has atomic instructions, e.g. -march=rv64ia.  It is
not defined when the target has no atomic instructions, e.g.
-march=rv64i.  The idea here was that we only used atomic instructions
if the target has them.  I didn't think to check for a more proper
kernel solution.  I see that there is a CONFIG_RISCV_ISA_A so it looks
like I should be testing that instead.

I will work on a revised patch as per your suggestions.


More information about the linux-riscv mailing list