[PATCH 2/2] KVM: arm64: Ensure TLBs and I-cache are private to each vCPU in pKVM
Vincent Donnefort
vdonnefort at google.com
Mon Oct 19 05:42:17 PDT 2026
On Mon, Oct 19, 2026 at 01:39:01PM +0100, Vincent Donnefort wrote:
> On Mon, Oct 19, 2026 at 12:43:57PM +0100, Fuad Tabba wrote:
> > Hi Vincent,
> >
> > On Mon, 19 Oct 2026 11:00:15 +0100, Vincent Donnefort <vdonnefort at google.com> wrote:
> > [...]
> > > > diff --git a/arch/arm64/kvm/hyp/include/nvhe/pkvm.h b/arch/arm64/kvm/hyp/include/nvhe/pkvm.h
> > [...]
> > > > @@ -54,6 +54,9 @@ struct pkvm_hyp_vm {
> > > > unsigned short refcount;
> > > > hyp_spinlock_t lock;
> > > >
> > > > + /* Per physical CPU, the vcpu_idx of the last vCPU of this VM loaded there. */
> > > > + int *last_vcpu_ran;
> > >
> > > Unlikely to be a problem in pratice, but vcpu_idx is "unsigned int". I wonder if
> > > this shouldn't be unsigned int here too and initialised to UINT_MAX?
> >
> > I'd copied int and -1 from the host's mmu->last_vcpu_ran, but the
> > vcpu_idx it's comparing against here is unsigned int, so I'll switch to
> > unsigned int and UINT_MAX in v2.
> >
> > Thanks,
> > /fuad
>
> Also,
>
> as it is always allocated when pkvm_hyp_vm is, Would it make sense to add this
> to pkvm_get_hyp_vm_size() instead of allocating separately?
>
> --
> Vincent
Ha, I just saw your answer to Marc and you will switch to a per-cpu approach
anyway it seems?
--
Vincent
More information about the linux-arm-kernel
mailing list