mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Sean Christopherson <seanjc@google.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Vitaly Kuznetsov <vkuznets@redhat.com>
Subject: Re: [PATCH 00/11] KVM: selftests: AVX support + fixes
Date: Sun, 20 Oct 2024 13:28:58 +0200	[thread overview]
Message-ID: <206dbca3-1dbd-478c-9c3a-85d25f4f4ed6@redhat.com> (raw)
In-Reply-To: <20241003234337.273364-1-seanjc@google.com>

On 10/4/24 01:43, Sean Christopherson wrote:
> Enable CR4.OSXSAVE and XCR0.AVX by default when creating selftests vCPUs
> in order to play nice with compilers that have been configured to enable
> -march=x86-64-v3 by default.
> 
> While it would be easier to force v2 (or earlier), there are enough tests
> that want XCR0 configured that it will (hopefully) be a net postive to
> enable all XCR0 features by default.
> 
> The only real hiccup is the CR4/CPUID sync test, which disables CR4.OSXSAVE
> to verify KVM toggles the associated CPUID bit.  And if it calls memset()
> while OSXAVE is disabled, kablooie.  Fixing that requires a bit of assembly,
> but overall I think it's worth carrying a few lines of assembly in order to
> gain test coverage for running AVX instructions in guests, and boy are
> compilers good at abusing AVX :-)
> 
> Fix a few bugs/warts found along the way.  Notably, the CPUID test has an
> array out-of-bounds bug that can result in false passes (I only noticed
> because it was getting a false pass on gcc).

I think this is not -rc/stable material, so for now I'm applying 
Vitaly's patch, plus patch 1 from this series.

Paolo

> Sean Christopherson (11):
>    KVM: selftests: Fix out-of-bounds reads in CPUID test's array lookups
>    KVM: selftests: Precisely mask off dynamic fields in CPUID test
>    KVM: selftests: Mask off OSPKE and OSXSAVE when comparing CPUID
>      entries
>    KVM: selftests: Rework OSXSAVE CR4=>CPUID test to play nice with AVX
>      insns
>    KVM: selftests: Configure XCR0 to max supported value by default
>    KVM: selftests: Verify XCR0 can be "downgraded" and "upgraded"
>    KVM: selftests: Drop manual CR4.OSXSAVE enabling from CR4/CPUID sync
>      test
>    KVM: selftests: Drop manual XCR0 configuration from AMX test
>    KVM: selftests: Drop manual XCR0 configuration from state test
>    KVM: selftests: Drop manual XCR0 configuration from SEV smoke test
>    KVM: selftests: Ensure KVM supports AVX for SEV-ES VMSA FPU test
> 
>   .../selftests/kvm/include/x86_64/processor.h  |  5 ++
>   .../selftests/kvm/lib/x86_64/processor.c      | 24 +++++++
>   tools/testing/selftests/kvm/x86_64/amx_test.c | 23 ++-----
>   .../testing/selftests/kvm/x86_64/cpuid_test.c | 67 ++++++++++++-------
>   .../kvm/x86_64/cr4_cpuid_sync_test.c          | 53 +++++++++------
>   .../selftests/kvm/x86_64/sev_smoke_test.c     | 19 ++----
>   .../testing/selftests/kvm/x86_64/state_test.c |  5 --
>   .../selftests/kvm/x86_64/xcr0_cpuid_test.c    | 11 ++-
>   8 files changed, 122 insertions(+), 85 deletions(-)
> 
> 
> base-commit: efbc6bd090f48ccf64f7a8dd5daea775821d57ec


  parent reply	other threads:[~2024-10-20 11:29 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-03 23:43 Sean Christopherson
2024-10-03 23:43 ` [PATCH 01/11] KVM: selftests: Fix out-of-bounds reads in CPUID test's array lookups Sean Christopherson
2024-10-04  8:22   ` Vitaly Kuznetsov
2024-10-03 23:43 ` [PATCH 02/11] KVM: selftests: Precisely mask off dynamic fields in CPUID test Sean Christopherson
2024-10-04  9:02   ` Vitaly Kuznetsov
2024-10-03 23:43 ` [PATCH 03/11] KVM: selftests: Mask off OSPKE and OSXSAVE when comparing CPUID entries Sean Christopherson
2024-10-04  9:02   ` Vitaly Kuznetsov
2024-10-03 23:43 ` [PATCH 04/11] KVM: selftests: Rework OSXSAVE CR4=>CPUID test to play nice with AVX insns Sean Christopherson
2024-10-04  9:02   ` Vitaly Kuznetsov
2024-10-03 23:43 ` [PATCH 05/11] KVM: selftests: Configure XCR0 to max supported value by default Sean Christopherson
2024-10-04  9:01   ` Vitaly Kuznetsov
2024-10-04 13:35     ` Sean Christopherson
2024-10-03 23:43 ` [PATCH 06/11] KVM: selftests: Verify XCR0 can be "downgraded" and "upgraded" Sean Christopherson
2024-10-04  9:04   ` Vitaly Kuznetsov
2024-10-03 23:43 ` [PATCH 07/11] KVM: selftests: Drop manual CR4.OSXSAVE enabling from CR4/CPUID sync test Sean Christopherson
2024-10-04  9:05   ` Vitaly Kuznetsov
2024-10-03 23:43 ` [PATCH 08/11] KVM: selftests: Drop manual XCR0 configuration from AMX test Sean Christopherson
2024-10-04  9:09   ` Vitaly Kuznetsov
2024-10-03 23:43 ` [PATCH 09/11] KVM: selftests: Drop manual XCR0 configuration from state test Sean Christopherson
2024-10-04  9:10   ` Vitaly Kuznetsov
2024-10-03 23:43 ` [PATCH 10/11] KVM: selftests: Drop manual XCR0 configuration from SEV smoke test Sean Christopherson
2024-10-03 23:43 ` [PATCH 11/11] KVM: selftests: Ensure KVM supports AVX for SEV-ES VMSA FPU test Sean Christopherson
2024-10-04  9:14   ` Vitaly Kuznetsov
2024-10-20 11:28 ` Paolo Bonzini [this message]
2024-10-31 19:51 ` [PATCH 00/11] KVM: selftests: AVX support + fixes Sean Christopherson
2024-11-01 19:31   ` Sean Christopherson

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=206dbca3-1dbd-478c-9c3a-85d25f4f4ed6@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=seanjc@google.com \
    --cc=vkuznets@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®