[PATCH] riscv, bpf: Emit fence.i for BPF_NOSPEC
Bo Gan
ganboing at gmail.com
Mon Jan 12 10:33:00 PST 2026
Hi Lukas,
Please also check out Ved's response from the Speculation Barrier TG:
https://lists.riscv.org/g/tech-speculation-barriers/message/21
I think the best way forward is to wait for the TG to clearly define
speculation barrier instructions, and use them for future cores. For
existing HW, emit a warning and do nothing. I don't want to see bpf
doing fence.i universally for all riscv. Neither do I like it guessing
this and that specific core implementation needing fence.i or not. We
simply don't know how each vendor design their cores. Let the vendor
tell us what's the best instruction to use for our existing HW. E.g.,
for JH7110, it's really U74 from Sifive, so we can ask them to fill-in
If we absolutely want fence.i as a best-effort kind of approach, then
I strongly suggest we make it opt-in. I'd imagine it'd be a very loud
noise if folks found the bpf perf on riscv suddenly regressed.
Bo
More information about the linux-riscv
mailing list