Re: [PATCH v4 4/6] KVM: selftests: Rename 'msr->availble' to 'msr->fault_exepected' in hyperv_features test

From: Sean Christopherson
Date: Tue Oct 11 2022 - 15:18:44 EST


Nit, s/availble,/available

On Thu, Sep 22, 2022, Vitaly Kuznetsov wrote:
> It may not be clear what 'msr->availble' means. The test actually

Same typo here.

> checks that accessing the particular MSR doesn't cause #GP, rename
> the varialble accordingly.

s/varialble/variable

At least you're consistent :-)

> Signed-off-by: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx>
> ---
> .../selftests/kvm/x86_64/hyperv_features.c | 96 +++++++++----------
> 1 file changed, 48 insertions(+), 48 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..1383b979e90b 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 fault_expected;
> bool write;
> u64 write_val;
> };
> @@ -56,10 +56,10 @@ static void guest_msr(struct msr_data *msr)
> else
> vector = wrmsr_safe(msr->idx, msr->write_val);
>
> - if (msr->available)
> - GUEST_ASSERT_2(!vector, msr->idx, vector);
> - else
> + if (msr->fault_expected)
> GUEST_ASSERT_2(vector == GP_VECTOR, msr->idx, vector);
> + else
> + GUEST_ASSERT_2(!vector, msr->idx, vector);
> GUEST_DONE();
> }
>
> @@ -153,12 +153,12 @@ static void guest_test_msrs_access(void)
> */
> msr->idx = HV_X64_MSR_GUEST_OS_ID;
> msr->write = 0;
> - msr->available = 0;
> + msr->fault_expected = 1;

Since all of these are getting inverted, opportunistically use "true" instead of "1"?