Re: [PATCH v4 12/25] KVM: arm64: Add infrastructure to create and track pKVM instances at EL2

Will Deacon
2022-10-19T12:47:02Z

On Tue, Oct 18, 2022 at 04:21:11PM +0000, Quentin Perret wrote:
> On Monday 17 Oct 2022 at 12:51:56 (+0100), Will Deacon wrote:
> > +struct pkvm_hyp_vm {
> > + struct kvm kvm;
> > +
> > + /* Backpointer to the host's (untrusted) KVM instance. */
> > + struct kvm *host_kvm;
> > +
> > + /*
> > + * Total amount of memory donated by the host for maintaining
> > + * this 'struct pkvm_hyp_vm' in the hypervisor.
> > + */
> > + size_t donated_memory_size;
>
> I think you could get rid of that member. IIUC, all you need to
> re-compute it in the teardown path is the number of created vCPUs on
> the host, which we should have safely stored in
> pkvm_hyp_vm::kvm::created_vcpus.

Oh, well spotted! I've dropped this as you have suggested.

Will