Re: [PATCH v1 1/2] LoongArch: BPF: Make arena support depend on SCQ extension
From: Tiezhu Yang
Date: Wed Nov 04 2026 - 23:08:59 EST
On 11/4/26 9:06 PM, Tiezhu Yang wrote:
On 11/4/26 5:54 PM, Huacai Chen wrote:
...
Personally, I feel Approach 1 represents the pure semantic intent
better, whereas Approach 2 looks more aesthetically pleasing.
Which one do you prefer for the v2 patch?
FYI, here is another relevant discussion from the RISC-V ZACAS patch
where the same code aesthetic vs. semantic precision trade-off was
evaluated:
https://lore.kernel.org/bpf/3e7fb313-021a-49d0-9def-fd9f03e3c2bb@xxxxxxxxxx/
> "Originally, I thought
> rv_ext_enabled(ZACAS) && IS_ENABLED(CONFIG_TOOLCHAIN_HAS_ZACAS)
> would make it more explicit, but system_has_cmpxchg128() seems
> to better capture what we were missing."
Using the generic system_has_cmpxchg128() directly mirrors the
precise condition defined in the MM core layer (mm/slab.h). It
prevents the JIT layer from over-relying on arch-specific
Kconfig/hardware knobs to mock generic allocator properties.
Therefore, I think using the generic #ifdef form is more robust
and keeps cross-architecture BPF JIT implementations symmetric.
Thanks,
Tiezhu