From: Eduardo Habkost <ehabkost@redhat.com>
To: kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [kvm-unit-tests PATCH] x86/memory: pass host clwb and clflushopt support information
Date: Wed, 20 Dec 2017 19:26:08 -0200 [thread overview]
Message-ID: <20171220212608.GE24025@localhost.localdomain> (raw)
In-Reply-To: <20171219025416.lyu2on4gcv2rokzn@hz-desktop>
On Tue, Dec 19, 2017 at 10:54:16AM +0800, Haozhong Zhang wrote:
> On 12/18/17 16:36 -0200, Eduardo Habkost wrote:
> > On Tue, Dec 12, 2017 at 04:35:24PM +0800, Haozhong Zhang wrote:
> > > Intel VMX cannot intercept guest clwb and clflushopt. When clwb and
> > > clflushopt are not exposed in guest cpuid, clwb and clflushopt
> > > instructions in this test case can still succeed without #UD on the
> > > host CPU which has clwb and clflushopt support, though failures with
> > > UD are expected.
> > >
> > > In order to avoid false alarms in such cases, introduce the following
> > > two arguments "has_clwb" and "has_clflushopt" to allow users to
> > > specify whether clwb and clflushopt are supported on the host CPU.
> > >
> > > Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
> > > ---
> > > x86/memory.c | 29 +++++++++++++++++++++++++++--
> > > 1 file changed, 27 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/x86/memory.c b/x86/memory.c
> > > index cd1eb46..03ff7d3 100644
> > > --- a/x86/memory.c
> > > +++ b/x86/memory.c
> > > @@ -23,10 +23,29 @@ static void handle_ud(struct ex_regs *regs)
> > > regs->rip += isize;
> > > }
> > >
> > > +/*
> > > + * Intel VMX cannot intercept guest clwb and clflushopt. When clwb and
> > > + * clflushopt are not exposed in guest cpuid, clwb and clflushopt
> > > + * instructions in this test case can still succeed without #UD on
> > > + * the host CPU which has clwb and clflushopt support. In order to avoid
> > > + * false alarms in such cases, introduce the following two arguments
> > > + * to allow users to specify whether clwb and clflushopt are supported on
> > > + * the host CPU:
> > > + * - has_clwb: indicates clwb is supported on the host CPU
> > > + * - has_clflushopt: indicates clflushopt is supported on the host CPU
> > > + */
> >
> > Why not simply use "-cpu host" to make sure the guest CPUID flags
> > match host CPUID?
> >
>
> Can I understand that testing these two cases with host/guest CPUID
> mismatch (specially clwb and clflushopt flags) is invalid? If yes,
> please ignore this patch.
I wouldn't say it's invalid to test what happens when the host
and guest CPUID don't match. The question is: is it useful to do
so? Are we testing different code paths when we do that?
The inability to trigger #UD if the host CPUID includes the flag
sounds like a bug/limitation we would like to get rid of as soon
as hardware allow us to, and not a feature we need to test for.
What's the right way to ensure memory.flat is always tested using
"-cpu host"?
--
Eduardo
next prev parent reply other threads:[~2017-12-20 21:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-12 8:35 [kvm-unit-tests PATCH] x86/memory: pass host clwb and clflushopt support information Haozhong Zhang
2017-12-18 18:36 ` Eduardo Habkost
2017-12-19 2:54 ` Haozhong Zhang
2017-12-20 21:26 ` Eduardo Habkost [this message]
2017-12-21 1:08 ` Haozhong Zhang
2017-12-21 1:32 ` Jim Mattson
2018-02-14 12:04 ` Paolo Bonzini
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=20171220212608.GE24025@localhost.localdomain \
--to=ehabkost@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.