Re: [PATCH v2] LoongArch: Fix preemptible warnings in cacheinfo and local TLB flush

From: Tiezhu Yang

Date: Thu Nov 19 2026 - 02:46:50 EST


On 11/19/26 2:09 PM, Tiezhu Yang wrote:
On 11/19/26 2:05 PM, Tiezhu Yang wrote:
When CONFIG_DEBUG_PREEMPT is enabled on a Non-SMP kernel, calls to
smp_processor_id() (including via current_cpu_data) in preemptible
contexts trigger many "BUG: using smp_processor_id() in preemptible"
warnings during cacheinfo setup and local TLB flushes.

...

After switching back to get_cpu() / put_cpu() (as in v1), this ASID
race completely disappears under the exact same test.

So I think we should keep get_cpu() / put_cpu() in
local_flush_tlb_{mm,range,page}() (as in v1) to ensure preemption
safety, especially for UP preemptible kernels.

If you are OK with the above analysis, I will send v3 (same to the
code changes in v1, but need to update the commit message).

Thanks,
Tiezhu