[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y+L/deE3+Uywm4kE@google.com>
Date: Wed, 8 Feb 2023 01:48:37 +0000
From: Sean Christopherson <seanjc@...gle.com>
To: Mingwei Zhang <mizhang@...gle.com>
Cc: kvm@...r.kernel.org, linux-kselftest@...r.kernel.org,
linux-kernel@...r.kernel.org, Jim Mattson <jmattson@...gle.com>,
Venkatesh Srinivas <venkateshs@...gle.com>,
Aaron Lewis <aaronlewis@...gle.com>
Subject: Re: [PATCH 4/4] KVM: selftests: x86: Repeat the checking of xheader
when IA32_XFD[18] is set in amx_test
On Tue, Jan 10, 2023, Mingwei Zhang wrote:
> Repeat the checking of AMX component in xheader after xsavec when
s/xsavec/XSAVEC. Not sure about xheader, though it seems like that should be
capitalized too.
> IA32_XFD[18] is set. This check calibrates the functionality scope of
s/18/XTILEDATA
> IA32_XFD: it does not intercept the XSAVE state management.
I didn't follow this. Is this basically saying "Verify XTILEDATA is saved by
XSAVEC even when disabled via IA32_XFD"?
> Regardless of the values in IA32_XFD, AMX component state will still be
> managed by XSAVE* and XRSTOR* as long as XCR[18:17] are set.
>
> Signed-off-by: Mingwei Zhang <mizhang@...gle.com>
> ---
> tools/testing/selftests/kvm/x86_64/amx_test.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/tools/testing/selftests/kvm/x86_64/amx_test.c b/tools/testing/selftests/kvm/x86_64/amx_test.c
> index 18203e399e9d..9a80a59b64e6 100644
> --- a/tools/testing/selftests/kvm/x86_64/amx_test.c
> +++ b/tools/testing/selftests/kvm/x86_64/amx_test.c
> @@ -235,6 +235,16 @@ static void __attribute__((__flatten__)) guest_code(struct tile_config *amx_cfg,
>
> /* xfd=0x40000, disable amx tiledata */
> wrmsr(MSR_IA32_XFD, XFEATURE_MASK_XTILEDATA);
> +
> + /*
> + * Bit 18 is cleared in XSTATE_BV but set in XCOMP_BV, this property
s/Bit 18/XTILEDATA
> + * remains the same even when IA32_XFD disables amx tiledata.
I would phrase this as "even when AMX tile data is disabled via IA32_XFD".
Software disables AMX, IA32_XFD is the mechanic by which that is done.
> + */
> + set_xstatebv(xsave_data, XFEATURE_MASK_XTILEDATA);
> + __xsavec(xsave_data, XFEATURE_MASK_XTILEDATA);
> + GUEST_ASSERT((get_xstatebv(xsave_data) & XFEATURE_MASK_XTILEDATA) == 0);
> + GUEST_ASSERT((get_xcompbv(xsave_data) & XFEATURE_MASK_XTILEDATA) == XFEATURE_MASK_XTILEDATA);
Same feedback about using !(...) and unnecessary "== x".
> +
> GUEST_SYNC(6);
> GUEST_ASSERT(rdmsr(MSR_IA32_XFD) == XFEATURE_MASK_XTILEDATA);
> set_tilecfg(amx_cfg);
> --
> 2.39.0.314.g84b9a713c41-goog
>
Powered by blists - more mailing lists