Re: futex atomic vs ordering constraints

From: Will Deacon
Date: Tue Sep 01 2015 - 12:32:08 EST


Hi Peter,

On Wed, Aug 26, 2015 at 07:16:59PM +0100, Peter Zijlstra wrote:
> I tried to keep this email short, but failed miserably at this. For
> the TL;DR skip to the tail.

[...]

> There are a few options:
>
> 1) punt, mandate they're both fully ordered and stop thinking about it
>
> 2) make them both fully relaxed, rely on implied barriers and employ
> smp_mb__{before,after}_atomic in key places
>
> Given the current state of things and that I don't really think there is
> a compelling performance argument to be made for 2, I would suggest we
> go with 1.

I'd also go for (1). Since there is a userspace side to this, I'd *really*
like to avoid a potential situation on arm64 where the kernel builds its
side of the futex using barrier instructions (e.g. treat LDR + smp_mb()
as acquire) and userspace builds its side out of native acquire/release
instructions and the two end up interacting badly (for example, loss of
SC).

Will
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/