On Fri, Apr 11, 2025 at 05:12:28PM +1000, Nicholas Piggin wrote: ... > Huh. powerpc actually has some crazy code in __switch_to() that is > supposed to handle preemption while in lazy mmu mode. So we probably > don't even need to disable preemption, just use the raw per-cpu > accessors (or keep disabling preemption and remove the now dead code > from context switch).
Well, I tried to do the latter ;) https://lore.kernel.org/linuxppc-dev/3b4e3e28172f09165b19ee7cac67a860d7cc1c6e.1742915600.git.agord...@linux.ibm.com/ Not sure how it is aligned with the current state (see below). > IIRC all this got built up over a long time with some TLB flush > rules changing at the same time, we could probably stay in lazy mmu > mode for a longer time until it was discovered we really need to > flush before dropping the PTL. > > ppc64 and sparc I think don't even need lazy mmu mode for kasan (TLBs > do not require flushing) and will function just fine if not in lazy > mode (they just flush one TLB at a time), not sure about xen. We could > actually go the other way and require that archs operate properly when > not in lazy mode (at least for kernel page tables) and avoid it for > apply_to_page_range()? Ryan Roberts hopefully brought some order to the topic: https://lore.kernel.org/linux-mm/20250303141542.3371656-1-ryan.robe...@arm.com/ > Thanks, > Nick