Re: [PATCH v2 1/1] mm: Allow detection of wrong arch_enter_lazy_mmu_mode() context

From: Alexander Gordeev
Date: Thu Apr 10 2025 - 11:25:42 EST


On Tue, Apr 08, 2025 at 06:48:31PM +0200, Alexander Gordeev wrote:
> The lazy MMU batching may be only be entered and left under the
> protection of the page table locks for all page tables which may
> be modified. Yet, there were cases arch_enter_lazy_mmu_mode()
> was called without the locks taken, e.g. commit b9ef323ea168
> ("powerpc/64s: Disable preemption in hash lazy mmu mode").
>
> Make default arch_enter|leave|flush_lazy_mmu_mode() callbacks
> complain at least in case the preemption is enabled to detect
> wrong contexts.
>
> Most platforms do not implement the callbacks, so to aovid a
> performance impact allow the complaint when CONFIG_DEBUG_VM
> option is enabled only.
>
> Signed-off-by: Alexander Gordeev <agordeev@xxxxxxxxxxxxx>
> ---
> include/linux/pgtable.h | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)

Andrew,

Following [1] comment to "[PATCH v2 3/3] mm: Protect kernel pgtables in
apply_to_pte_range()" I think this patch should also be dropped.

1. https://lore.kernel.org/all/Z%2FfauW5hDSt+ciwr@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/

Thanks!