diff mbox series

[kvm-unit-tests] x86: provide enabled and disabled variation of the PCID test

Message ID 1580916580-4098-1-git-send-email-pbonzini@redhat.com (mailing list archive)
State New, archived
Headers show
Series [kvm-unit-tests] x86: provide enabled and disabled variation of the PCID test | expand

Commit Message

Paolo Bonzini Feb. 5, 2020, 3:29 p.m. UTC
The PCID test checks for exceptions when PCID=0 or INVPCID=0 in
CPUID.  Cover that by adding a separate testcase with different
CPUID.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 x86/unittests.cfg | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Sean Christopherson Feb. 5, 2020, 3:49 p.m. UTC | #1
On Wed, Feb 05, 2020 at 04:29:40PM +0100, Paolo Bonzini wrote:
> The PCID test checks for exceptions when PCID=0 or INVPCID=0 in
> CPUID.  Cover that by adding a separate testcase with different
> CPUID.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  x86/unittests.cfg | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/x86/unittests.cfg b/x86/unittests.cfg
> index aae1523..f2401eb 100644
> --- a/x86/unittests.cfg
> +++ b/x86/unittests.cfg
> @@ -228,7 +228,12 @@ extra_params = --append "10000000 `date +%s`"
>  
>  [pcid]
>  file = pcid.flat
> -extra_params = -cpu qemu64,+pcid
> +extra_params = -cpu qemu64,+pcid,+invpcid
> +arch = x86_64
> +
> +[pcid-disabled]
> +file = pcid.flat
> +extra_params = -cpu qemu64,-pcid,-invpcid
>  arch = x86_64

Hrm, but "-cpu qemu64,-pcid,+invpcid" is arguably the more interesting test
from a KVM perspective because of the logic in KVM to hide invpcid if pcid
isn't supported.

And +pcid,-invpcid is also interesting.

Is there an easy-ish change that can be made to allow iterating over
multiple CPU configurations for single test case?
Andrew Jones Feb. 5, 2020, 5:22 p.m. UTC | #2
On Wed, Feb 05, 2020 at 07:49:04AM -0800, Sean Christopherson wrote:
> On Wed, Feb 05, 2020 at 04:29:40PM +0100, Paolo Bonzini wrote:
> > The PCID test checks for exceptions when PCID=0 or INVPCID=0 in
> > CPUID.  Cover that by adding a separate testcase with different
> > CPUID.
> > 
> > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> > ---
> >  x86/unittests.cfg | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> > 
> > diff --git a/x86/unittests.cfg b/x86/unittests.cfg
> > index aae1523..f2401eb 100644
> > --- a/x86/unittests.cfg
> > +++ b/x86/unittests.cfg
> > @@ -228,7 +228,12 @@ extra_params = --append "10000000 `date +%s`"
> >  
> >  [pcid]
> >  file = pcid.flat
> > -extra_params = -cpu qemu64,+pcid
> > +extra_params = -cpu qemu64,+pcid,+invpcid
> > +arch = x86_64
> > +
> > +[pcid-disabled]
> > +file = pcid.flat
> > +extra_params = -cpu qemu64,-pcid,-invpcid
> >  arch = x86_64
> 
> Hrm, but "-cpu qemu64,-pcid,+invpcid" is arguably the more interesting test
> from a KVM perspective because of the logic in KVM to hide invpcid if pcid
> isn't supported.
> 
> And +pcid,-invpcid is also interesting.
> 
> Is there an easy-ish change that can be made to allow iterating over
> multiple CPU configurations for single test case?
>

Just a small change to Paolo's patch

[pcid]
file = pcid.flat
extra_params = -cpu qemu64,+pcid,+invpcid
arch = x86_64
group = pcid

[pcid-disabled]
file = pcid.flat
extra_params = -cpu qemu64,-pcid,-invpcid
arch = x86_64
group = pcid

[pcid-more-interesting]
file = pcid.flat
extra_params = -cpu qemu64,-pcid,+invpcid
arch = x86_64
group = pcid

Then run the group with ./run_tests.sh -g pcid

Thanks,
drew
Sean Christopherson Feb. 5, 2020, 5:41 p.m. UTC | #3
On Wed, Feb 05, 2020 at 06:22:05PM +0100, Andrew Jones wrote:
> On Wed, Feb 05, 2020 at 07:49:04AM -0800, Sean Christopherson wrote:
> > On Wed, Feb 05, 2020 at 04:29:40PM +0100, Paolo Bonzini wrote:
> > > The PCID test checks for exceptions when PCID=0 or INVPCID=0 in
> > > CPUID.  Cover that by adding a separate testcase with different
> > > CPUID.
> > > 
> > > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> > > ---
> > >  x86/unittests.cfg | 7 ++++++-
> > >  1 file changed, 6 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/x86/unittests.cfg b/x86/unittests.cfg
> > > index aae1523..f2401eb 100644
> > > --- a/x86/unittests.cfg
> > > +++ b/x86/unittests.cfg
> > > @@ -228,7 +228,12 @@ extra_params = --append "10000000 `date +%s`"
> > >  
> > >  [pcid]
> > >  file = pcid.flat
> > > -extra_params = -cpu qemu64,+pcid
> > > +extra_params = -cpu qemu64,+pcid,+invpcid
> > > +arch = x86_64
> > > +
> > > +[pcid-disabled]
> > > +file = pcid.flat
> > > +extra_params = -cpu qemu64,-pcid,-invpcid
> > >  arch = x86_64
> > 
> > Hrm, but "-cpu qemu64,-pcid,+invpcid" is arguably the more interesting test
> > from a KVM perspective because of the logic in KVM to hide invpcid if pcid
> > isn't supported.
> > 
> > And +pcid,-invpcid is also interesting.
> > 
> > Is there an easy-ish change that can be made to allow iterating over
> > multiple CPU configurations for single test case?
> >
> 
> Just a small change to Paolo's patch
> 
> [pcid]
> file = pcid.flat
> extra_params = -cpu qemu64,+pcid,+invpcid
> arch = x86_64
> group = pcid
> 
> [pcid-disabled]
> file = pcid.flat
> extra_params = -cpu qemu64,-pcid,-invpcid
> arch = x86_64
> group = pcid
> 
> [pcid-more-interesting]
> file = pcid.flat
> extra_params = -cpu qemu64,-pcid,+invpcid
> arch = x86_64
> group = pcid
> 
> Then run the group with ./run_tests.sh -g pcid

Ya, I was thinking more long term, e.g. syntax like:

  [pcid]
  file = pcid.flat
  permute_features = pcid,invpcid
  arch = x86_64

In general, I would love to have infrastructure to permute over *all* the
interesting bits of KVM, e.g. module params and whatnot.
diff mbox series

Patch

diff --git a/x86/unittests.cfg b/x86/unittests.cfg
index aae1523..f2401eb 100644
--- a/x86/unittests.cfg
+++ b/x86/unittests.cfg
@@ -228,7 +228,12 @@  extra_params = --append "10000000 `date +%s`"
 
 [pcid]
 file = pcid.flat
-extra_params = -cpu qemu64,+pcid
+extra_params = -cpu qemu64,+pcid,+invpcid
+arch = x86_64
+
+[pcid-disabled]
+file = pcid.flat
+extra_params = -cpu qemu64,-pcid,-invpcid
 arch = x86_64
 
 [rdpru]