[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2 2/7] mm: introduce local state for lazy_mmu sections
On 09/09/2025 16:38, Alexander Gordeev wrote: >>>>> Would that integrate well with LAZY_MMU_DEFAULT etc? >>>> Hmm... I though the idea is to use LAZY_MMU_* by architectures that >>>> want to use it - at least that is how I read the description above. >>>> >>>> It is only kasan_populate|depopulate_vmalloc_pte() in generic code >>>> that do not follow this pattern, and it looks as a problem to me. >> This discussion also made me realise that this is problematic, as the >> LAZY_MMU_{DEFAULT,NESTED} macros were meant only for architectures' >> convenience, not for generic code (where lazy_mmu_state_t should ideally >> be an opaque type as mentioned above). It almost feels like the kasan >> case deserves a different API, because this is not how enter() and >> leave() are meant to be used. This would mean quite a bit of churn >> though, so maybe just introduce another arch-defined value to pass to >> leave() for such a situation - for instance, >> arch_leave_lazy_mmu_mode(LAZY_MMU_FLUSH)? > What about to adjust the semantics of apply_to_page_range() instead? > > It currently assumes any caller is fine with apply_to_pte_range() to > enter the lazy mode. By contrast, kasan_(de)populate_vmalloc_pte() are > not fine at all and must leave the lazy mode. That literally suggests > the original assumption is incorrect. > > We could change int apply_to_pte_range(..., bool create, ...) to e.g. > apply_to_pte_range(..., unsigned int flags, ...) and introduce a flag > that simply skips entering the lazy mmu mode. This is pretty much what Ryan proposed [1r] some time ago, although for a different purpose (avoiding nesting). There wasn't much appetite for it then, but I agree that this would be a more logical way to go about it. - Kevin [1r] https://lore.kernel.org/all/20250530140446.2387131-4-ryan.roberts@xxxxxxx/
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |