Re: [PATCH v8 04/30] KVM: selftests: Add vCPU descriptor table initialization utility

From: Sagi Shahar
Date: Fri Aug 15 2025 - 00:29:48 EST


On Mon, Aug 11, 2025 at 1:25 PM Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
>
> On Thu, Aug 07, 2025, Sagi Shahar wrote:
> > From: Ackerley Tng <ackerleytng@xxxxxxxxxx>
> >
> > Turn vCPU descriptor table initialization into a utility for use by tests
> > needing finer control, for example for TDX TD creation.
>
> NAK. "needing finer control" is not a sufficient explanation for why _this_
> patch is necessary. There's also zero argument made throughout any of these
> patches as to why this pattern:
>
> vm = td_create();
> td_initialize(vm, VM_MEM_SRC_ANONYMOUS, 0);
> vcpu = td_vcpu_add(vm, 0, guest_io_writes);
> td_finalize(vm);
>
> is the best approach. IMO it is NOT the best approach. I would much rather we
> structure things so that creating TDs can use APIs like this:
>
> static inline struct kvm_vm *td_create_with_vcpus(uint32_t nr_vcpus,
> void *guest_code,
> struct kvm_vcpu *vcpus[])
> {
> return __vm_create_with_vcpus(VM_SHAPE_TDX, nr_vcpus, 0, guest_code, vcpus);
> }
>
> instead of open coding an entirely different set of APIs for creating TDs, which
> is not maintanable.

Dropping this patch in the next version.