[PATCH 1/3] KVM: arm64: Don't walk the whole IPA space when destroying a pKVM stage-2

Marc Zyngier maz at kernel.org
Tue Nov 3 08:26:01 PST 2026


On Tue, 03 Nov 2026 16:15:03 +0000,
Fuad Tabba <fuad.tabba at linux.dev> wrote:
> 
> Hi Vincent,
> 
> On Tue, 03 Nov 2026 14:52:36 +0000, Vincent Donnefort
> <vdonnefort at google.com> wrote:
> [...]
> > > Walk the mapping tree once instead, and reschedule after passing each
> > > mapping to the reclaim or unshare helper. The unshare helper can't
> > > reschedule itself, as the map and unmap paths call it under the
> > > mmu_lock. A failed unshare now leaves only its own mapping behind, not
> > > the rest of its chunk.
> >
> > Not a problem now, but don't we make the device assignment story harder?
> 
> I don't think so. In Android, the host doesn't track the MMIO of a
> device assigned to a protected guest. The hypervisor maps it into the
> guest, and gives it back to the host in __pkvm_start_teardown_vm(),
> before the host reclaims anything. So the walk this patch changes
> shouldn't reach it.
> 
> >
> > >
> > > Fixes: 4ddfab5436b69 ("KVM: arm64: Reschedule as needed when destroying the stage-2 page-tables")
> >
> > Isn't it an optimisation?
> 
> No, it fixes a regression: 4ddfab5436b6 replaced a single walk of the
> mapping tree with the 2^27 lookups, as described in the commit
> message.

But that's a configuration that simply does not exist in HW.

Therefore this isn't a fix, this is an opportunistic optimisation that
may or may not become useful. So not a fix, no backporting.

	M.

-- 
Without deviation from the norm, progress is not possible.



More information about the linux-arm-kernel mailing list