Re: [RFC PATCH v3 54/59] KVM: X86: Introduce initial_tsc_khz in struct kvm_arch

From: Thomas Gleixner
Date: Thu Nov 25 2021 - 18:28:58 EST


Paolo,

On Thu, Nov 25 2021 at 23:13, Paolo Bonzini wrote:
> On 11/25/21 22:05, Thomas Gleixner wrote:
> If there are some patches that are actually independent, go ahead and
> submit them early. But more practically, for the bulk of the changes
> what you need to do is:
>
> 1) incorporate into patch 55 a version of tdx.c that essentially does
> KVM_BUG_ON or WARN_ON for each function. Temporarily keep the same huge
> patch that adds the remaining 2000 lines of tdx.c

There is absolutely no reason to populate anything upfront at all.

Why?

Simply because that whole muck cannot work until all pieces are in place.

That's the classic PoC vs. usable code situation. I.e. you know what
needs to be done from a PoC point of view and you have to get there by
building up the infrastructure piece by piece.

So why would you provide:

handle_A(...) { BUG(); }
..
handle_Z(...) { BUG(); }

with all the invocations in the common emulation dispatcher:

handle_stuff(reason)
{
switch(reason) {
case A: return handle_A();
...
case Z: return handle_Z();
default: BUG();
}
};

in the first place instead of providing:

1)
handle_stuff(reason)
{
switch(reason) {
default: BUG();
};
}

2)
handle_A(...)
{
return do_something_understandable()
}

handle_stuff(reason)
{
switch(reason) {
case A: return handle_A();
default: BUG();
}

$Z)
handle_Z(...)
{
return do_something_understandable()
}

handle_stuff(reason)
{
switch(reason) {
case A: return handle_A();
...
case Z: return handle_Z();
default: BUG();
}

where each of (1..$Z) is a single patch doing exactly _ONE_ thing at a
time and if there is some extra magic required like an additional export
for handle_Y() then this export patch is either part of the patch
dealing with $Y or just before that.

In both scenarious you cannot boot a TDX guest until you reached $Z, but
in the gradual one you and the reviewers have the pleasure of looking at
one thing at a time.

No?

Thanks,

tglx