On Thu, Jan 24, 2019 at 03:58:59PM -0800, Alexei Starovoitov wrote: > On Thu, Jan 24, 2019 at 07:01:09PM +0100, Peter Zijlstra wrote:
> > And this would again be the moment where I go pester you about the BPF > > memory model :-) > > hehe :) > How do you propose to define it in a way that it applies to all archs > and yet doesn't penalize x86 ? > "Assume minimum execution ordering model" the way kernel does > unfortunately is not usable, since bpf doesn't have a luxury > of using nice #defines that convert into nops on x86. Why not? Surely the JIT can fix it up? That is, suppose you were to have smp_rmb() as a eBPF instruction then the JIT (which knows what architecture it is targeting) can simply avoid emitting instructions for it. Similarly; could something like this not also help with the spinlock thing? Use that generic test-and-set thing for the interpreter, but provide a better implementation in the JIT?