Re: [PATCH v4 6/6] KVM: selftests: Test Hyper-V invariant TSC control

From: Vitaly Kuznetsov
Date: Thu Oct 13 2022 - 05:16:38 EST


Sean Christopherson <seanjc@xxxxxxxxxx> writes:

> On Wed, Oct 12, 2022, Vitaly Kuznetsov wrote:
>> Sean Christopherson <seanjc@xxxxxxxxxx> writes:
>>

...

>> > Aha! Idea. Assuming none of the MSRs are write-only, what about adding a prep
>> > patch to rework this code so that it verifies RDMSR returns what was written when
>> > a fault didn't occur.
>> >
>>
>> There is at least one read-only MSR which comes to mind:
>> HV_X64_MSR_EOI.
>
> I assume s/read-only/write-only since it's EOI?
>

Yes, of course)

>> Also, some of the MSRs don't preserve the written value,
>> e.g. HV_X64_MSR_RESET which always reads as '0'.
>
> Hrm, that's annoying.

'Slightly annoying'. In fact, the test never writes anything besides '0'
to the MSR as the code is not ready to handle real vCPU reset. I'll
leave a TODO note about that.

...

> static bool is_write_only_msr(uint32_t msr)
> {
> return msr == HV_X64_MSR_EOI;
> }

This is all we need, basically. I'll go with that.

--
Vitaly