Re: [PATCH v2 4/4] KVM: selftests: Add CPUID tests for Hyper-V features that need in-kernel APIC

From: Vitaly Kuznetsov
Date: Tue Jan 21 2025 - 11:29:42 EST


Sean Christopherson <seanjc@xxxxxxxxxx> writes:

> On Mon, Jan 20, 2025, Vitaly Kuznetsov wrote:
>> > diff --git a/tools/testing/selftests/kvm/x86_64/hyperv_cpuid.c b/tools/testing/selftests/kvm/x86_64/hyperv_cpuid.c
>> > index 3188749ec6e1..8f26130dc30d 100644
>> > --- a/tools/testing/selftests/kvm/x86_64/hyperv_cpuid.c
>> > +++ b/tools/testing/selftests/kvm/x86_64/hyperv_cpuid.c
>> > @@ -43,6 +43,7 @@ static bool smt_possible(void)
>> >
>> > static void test_hv_cpuid(struct kvm_vcpu *vcpu, bool evmcs_expected)
>> > {
>> > + const bool has_irqchip = !vcpu || vcpu->vm->has_irqchip;
>> > const struct kvm_cpuid2 *hv_cpuid_entries;
>> > int i;
>> > int nent_expected = 10;
>> > @@ -85,12 +86,19 @@ static void test_hv_cpuid(struct kvm_vcpu *vcpu, bool evmcs_expected)
>> > entry->eax, evmcs_expected
>> > );
>> > break;
>> > + case 0x40000003:
>> > + TEST_ASSERT(has_irqchip || !(entry->edx & BIT(19)),
>> > + "Synthetic Timers should require in-kernel APIC");
>>
>> Nitpick: BIT(19) of CPUID.0x40000003(EDX) advertises 'direct' mode
>> for Synthetic timers and that's what we have paired with
>> lapic_in_kernel() check. Thus, we may want to be a bit more specific and
>> say
>>
>> "Direct Synthetic timers should require in-kernel APIC"
>> (personally, I'd prefer "Synthetic timers in 'direct' mode" name but
>> that's not how TLFS calls them)
>
> What about adding quotes to try and communicate that it's a property of Syntehtic
> Timers? E.g.
>
> "\"Direct\" Synthetic Timers should require in-kernel APIC");

Sounds good to me)

--
Vitaly