Re: [PATCH v2 2/3] KVM: selftests: Rename 'msr->availble' to 'msr->should_not_gp' in hyperv_features test

From: Vitaly Kuznetsov
Date: Tue Sep 13 2022 - 05:53:12 EST


Sean Christopherson <seanjc@xxxxxxxxxx> writes:

> On Wed, Aug 31, 2022, Vitaly Kuznetsov wrote:
>> It may not be clear what 'msr->availble' means. The test actually
>> checks that accessing the particular MSR doesn't cause #GP, rename
>> the varialble accordingly.
>>
>> Suggested-by: Maxim Levitsky <mlevitsk@xxxxxxxxxx>
>> Signed-off-by: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx>
>> ---
>> .../selftests/kvm/x86_64/hyperv_features.c | 92 +++++++++----------
>> 1 file changed, 46 insertions(+), 46 deletions(-)
>>
>> diff --git a/tools/testing/selftests/kvm/x86_64/hyperv_features.c b/tools/testing/selftests/kvm/x86_64/hyperv_features.c
>> index 79ab0152d281..4ec4776662a4 100644
>> --- a/tools/testing/selftests/kvm/x86_64/hyperv_features.c
>> +++ b/tools/testing/selftests/kvm/x86_64/hyperv_features.c
>> @@ -33,7 +33,7 @@ static inline uint8_t hypercall(u64 control, vm_vaddr_t input_address,
>>
>> struct msr_data {
>> uint32_t idx;
>> - bool available;
>> + bool should_not_gp;
>
> I agree that "available" is a bit inscrutable, but "should_not_gp" is also odd.
>

I think Max suggested it to reduce the code churn and I silently agreed.

> What about inverting it to?
>
> bool gp_expected;
>
> or maybe even just
>
> bool fault_expected;
>
> and letting the assert define which vector is expected.
>

This also works, will change.

--
Vitaly