[PATCH v4 12/25] KVM: arm64: Add infrastructure to create and track pKVM instances at EL2
Fuad Tabba
tabba at google.com
Wed Oct 19 05:18:23 PDT 2022
Hi,
On Tue, Oct 18, 2022 at 5:45 PM Quentin Perret <qperret at google.com> wrote:
>
> On Monday 17 Oct 2022 at 12:51:56 (+0100), Will Deacon wrote:
> > +static int find_free_vm_table_entry(struct kvm *host_kvm)
> > +{
> > + int i, ret = -ENOMEM;
> > +
> > + for (i = 0; i < KVM_MAX_PVMS; ++i) {
> > + struct pkvm_hyp_vm *vm = vm_table[i];
> > +
> > + if (!vm) {
> > + if (ret < 0)
> > + ret = i;
> > + continue;
> > + }
> > +
> > + if (unlikely(vm->host_kvm == host_kvm)) {
> > + ret = -EEXIST;
> > + break;
> > + }
>
> That would be funny if the host passed the same struct twice, but do we
> care? If the host wants to shoot itself in the foot, it's not our
> problem I guess :) ? Also, we don't do the same check for vCPUs so ...
You're right, the host can shoot itself in the foot if it wants to.
The reason why we don't have it for vcpus is that that code was
factored out later, and as you said, a similar check isn't necessary.
TLDR: we'll remove it :)
Thanks,
/fuad
More information about the linux-arm-kernel
mailing list