Re: [PATCH v3 07/11] KVM: Allow architectures to reject memslot changes before invalidation

From: Steven Price

Date: Wed Nov 18 2026 - 11:44:28 EST


On 17/11/2026 14:31, Fuad Tabba wrote:
> Hi Suzuki,
>
> On Mon, 16 Nov 2026 16:43:53 +0000, Steven Price <steven.price@xxxxxxx> wrote:
> [...]
>> Architectures may need to reject deletion of a memory slot without
>> changing the guest's memory mappings. Currently, KVM invalidates the slot
>> and calls kvm_arch_flush_shadow_memslot() before
>> kvm_arch_prepare_memory_region() can reject the request. On arm64, this
>> unmaps the slot from stage-2. Restoring the old memslot on failure does not
>> restore those mappings, so even a rejected deletion has side effects.
> [...]
>> Move arm64's protected VM checks into the new hook so that unsupported
>> deletions and moves are rejected before stage-2 unmapping. Keep resource
>> preparation after invalidation, since invalidation drops slots_arch_lock
>> and allows concurrent updates to architecture-specific memslot metadata.
>
> For pVMs the invalidation doesn't touch stage-2
> (protected_pkvm_vm_s2_ops uses no_stage2_unmap_range()), so the reason
> for the hook is the Realm case in the next patch. Can you change the
> message to say that?

Yes I'll clarify that.

Thanks,
Steve