Re: [RFC PATCH v2 5/5] KVM: Unmap pages only when it's indeed protected for NUMA migration

From: Jason Gunthorpe
Date: Fri Aug 11 2023 - 13:18:53 EST


> However, *if* it's ok to invoke MMU notifiers while holding PMD/PTE locks, then
> I think we can achieve what you want without losing batching, and without changing
> secondary MMUs.

No, this is not legal.

> +void change_pmd_range_notify_secondary_mmus(unsigned long addr,
> + struct mmu_notifier_range *range)
> +{
> + if (range->start)
> + return;
> +
> + VM_WARN_ON(addr >= range->end);
> + range->start = addr;
> + mmu_notifier_invalidate_range_start_nonblock(range);
> +}

The 'nonblock' entry point is advisory, if it fails the caller must
not change the mm.

Jason