From: Mingwei Zhang <mizhang@google.com>
To: Aaron Lewis <aaronlewis@google.com>
Cc: Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>,
kvm@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org, Jim Mattson <jmattson@google.com>,
Venkatesh Srinivas <venkateshs@google.com>,
"Chang S. Bae" <chang.seok.bae@intel.com>
Subject: Re: [PATCH v2 3/7] KVM: selftests: x86: Add check of CR0.TS in the #NM handler in amx_test
Date: Sat, 18 Feb 2023 00:57:37 +0000 [thread overview]
Message-ID: <Y/Aigdf8rV0b9LJQ@google.com> (raw)
In-Reply-To: <CAAAPnDFG+9x5A24cDs8344k9W6zddpJ7cKBFOXmzaLhMhvmR=g@mail.gmail.com>
On Fri, Feb 17, 2023, Aaron Lewis wrote:
> On Tue, Feb 14, 2023 at 6:46 PM Mingwei Zhang <mizhang@google.com> wrote:
> >
> > Add check of CR0.TS[bit 3] before the check of IA32_XFD_ERR in the #NM
> > handler in amx_test. This is because XFD may not be the only reason of
> > the IA32_XFD MSR and the bitmap corresponding to the state components
> > required by the faulting instruction." (Intel SDM vol 1. Section 13.14)
> >
> > Add the missing check of CR0.TS.
> >
> > Signed-off-by: Mingwei Zhang <mizhang@google.com>
> > ---
> > tools/testing/selftests/kvm/x86_64/amx_test.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/tools/testing/selftests/kvm/x86_64/amx_test.c b/tools/testing/selftests/kvm/x86_64/amx_test.c
> > index aac727ff7cf8..847752998660 100644
> > --- a/tools/testing/selftests/kvm/x86_64/amx_test.c
> > +++ b/tools/testing/selftests/kvm/x86_64/amx_test.c
> > @@ -215,6 +215,7 @@ void guest_nm_handler(struct ex_regs *regs)
> > {
> > /* Check if #NM is triggered by XFEATURE_MASK_XTILEDATA */
> > GUEST_SYNC(7);
> > + GUEST_ASSERT((get_cr0() & X86_CR0_TS) == 0);
>
> Can't we infer that the #NM is the result of an XFD error due to the fact
> that IA32_XFD_ERR is set? Is this check needed?
> SDM vol 1, 13.14, EXTENDED FEATURE DISABLE (XFD)
> - Device-not-available exceptions that are not due to XFD - those
> resulting from setting CR0.TS to 1 - do not modify the IA32_XFD_ERR
> MSR.
>
We don't infer from the reasons of #NM and that is the purpose of this
selftest. Yes, this looks a little bit pedantic. But still, it is worth
adding the check since violation of that indicates either 1) the
selftest mistakenly did not clear XFD_ERR prior to #NM or 2) hardware is
broken.
> > GUEST_ASSERT(rdmsr(MSR_IA32_XFD_ERR) == XFEATURE_MASK_XTILEDATA);
> > GUEST_SYNC(8);
> > GUEST_ASSERT(rdmsr(MSR_IA32_XFD_ERR) == XFEATURE_MASK_XTILEDATA);
> > --
> > 2.39.1.581.gbfd45094c4-goog
> >
next prev parent reply other threads:[~2023-02-18 0:57 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-14 18:45 [PATCH v2 0/7] Overhauling amx_test Mingwei Zhang
2023-02-14 18:46 ` [PATCH v2 1/7] KVM: selftests: x86: Add a working xstate data structure Mingwei Zhang
2023-02-19 8:33 ` Chao Gao
2023-02-19 17:56 ` Mingwei Zhang
2023-02-14 18:46 ` [PATCH v2 2/7] KVM: selftests: x86: Fix an error in comment of amx_test Mingwei Zhang
2023-02-19 8:46 ` Chao Gao
2023-02-19 17:58 ` Mingwei Zhang
2023-02-14 18:46 ` [PATCH v2 3/7] KVM: selftests: x86: Add check of CR0.TS in the #NM handler in amx_test Mingwei Zhang
2023-02-17 22:01 ` Aaron Lewis
2023-02-18 0:57 ` Mingwei Zhang [this message]
2023-02-14 18:46 ` [PATCH v2 4/7] KVM: selftests: Add the XFD check to IA32_XFD in #NM handler Mingwei Zhang
2023-02-14 18:46 ` [PATCH v2 5/7] KVM: selftests: Fix the checks to XFD_ERR using and operation Mingwei Zhang
2023-02-14 18:46 ` [PATCH v2 6/7] KVM: selftests: x86: Enable checking on xcomp_bv in amx_test Mingwei Zhang
2023-02-14 18:46 ` [PATCH v2 7/7] KVM: selftests: x86: Repeat the checking of xheader when IA32_XFD[XTILEDATA] is set " Mingwei Zhang
2023-02-17 22:04 ` [PATCH v2 0/7] Overhauling amx_test Aaron Lewis
2023-02-18 0:58 ` Mingwei Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y/Aigdf8rV0b9LJQ@google.com \
--to=mizhang@google.com \
--cc=aaronlewis@google.com \
--cc=chang.seok.bae@intel.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=venkateshs@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).