All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Orr <marcorr@google.com>
To: Zixuan Wang <zxwang42@gmail.com>
Cc: Varad Gautam <varad.gautam@suse.com>,
	kvm list <kvm@vger.kernel.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Andrew Jones <drjones@redhat.com>,
	"Hyunwook (Wooky) Baek" <baekhw@google.com>,
	Tom Roeder <tmroeder@google.com>,
	Erdem Aktas <erdemaktas@google.com>,
	David Rientjes <rientjes@google.com>,
	Sean Christopherson <seanjc@google.com>,
	"Singh, Brijesh" <brijesh.singh@amd.com>,
	"Lendacky, Thomas" <Thomas.Lendacky@amd.com>,
	Joerg Roedel <jroedel@suse.de>,
	bp@suse.de
Subject: Re: [kvm-unit-tests PATCH v3 17/17] x86 AMD SEV-ES: Add test cases
Date: Tue, 19 Oct 2021 07:14:47 -0700	[thread overview]
Message-ID: <CAA03e5HL0aiByPGiO5mescTHNM=DT69Kx=ep=cS-De8u+tvaMA@mail.gmail.com> (raw)
In-Reply-To: <CAEDJ5ZQbXK=Gtf_QH2PMNEOBo++7vsa84zZ3G8rzM=TH+JUrQQ@mail.gmail.com>

On Mon, Oct 18, 2021 at 9:38 PM Zixuan Wang <zxwang42@gmail.com> wrote:
>
> On Mon, Oct 18, 2021 at 4:47 AM Varad Gautam <varad.gautam@suse.com> wrote:
> >
> > Hi Zixuan,
> >
> > On 10/4/21 10:49 PM, Zixuan Wang wrote:
> > > From: Zixuan Wang <zixuanwang@google.com>
> > > +static int test_sev_es_msr(void)
> > > +{
> > > +     /*
> > > +      * With SEV-ES, rdmsr/wrmsr trigger #VC exception. If #VC is handled
> > > +      * correctly, rdmsr/wrmsr should work like without SEV-ES and not crash
> > > +      * the guest VM.
> > > +      */
> > > +     u64 val = 0x1234;
> > > +     wrmsr(MSR_TSC_AUX, val);
> > > +     if(val != rdmsr(MSR_TSC_AUX)) {
> > > +             return EXIT_FAILURE;
> >
> > See note below.
> >
> > > +     }
> > > +
> > > +     return EXIT_SUCCESS;
> > > +}
> > > +
> > >  int main(void)
> > >  {
> > >       int rtn;
> > >       rtn = test_sev_activation();
> > >       report(rtn == EXIT_SUCCESS, "SEV activation test.");
> > > +     rtn = test_sev_es_activation();
> > > +     report(rtn == EXIT_SUCCESS, "SEV-ES activation test.");
> > > +     rtn = test_sev_es_msr();
> >
> > There is nothing SEV-ES specific about this function, it only wraps
> > rdmsr/wrmsr, which are supposed to generate #VC exceptions on SEV-ES.
> > Since the same scenario can be covered by running the msr testcase
> > as a SEV-ES guest and observing if it crashes, does testing
> > rdmsr/wrmsr one more time here gain us any new information?
> >
> > Also, the function gets called from main() even if
> > test_sev_es_activation() failed or SEV-ES was inactive.
> >
> > Note: More broadly, what are you looking to test for here?
> > 1. wrmsr/rdmsr correctness (rdmsr reads what wrmsr wrote)? or,
> > 2. A #VC exception not causing a guest crash on SEV-ES?
> >
> > If you are looking to test 1., I suggest letting it be covered by
> > the generic testcases for msr.
> >
> > If you are looking to test 2., perhaps a better test is to trigger
> > all scenarios that would cause a #VC exception (eg. test_sev_es_vc_exit)
> > and check that a SEV-ES guest survives.
> >
> > Regards,
> > Varad
> >
>
> Hi Varad,
>
> This test case does not bring any SEV-related functionality testing.
> Instead, it is provided for development, i.e., one can check if SEV is
> properly set up by monitoring if this test case runs fine without
> crashes.
>
> Since this test case is causing some confusion and does not bring any
> functionality testing, I can remove it from the next version. We can
> still verify the SEV setup process by checking if an existing test
> case (e.g., x86/msr.c) runs without crashes in a SEV guest.
>
> It's hard for me to develop a meaningful SEV test case, because I just
> finished my Google internship and thus lost access to SEV-enabled
> machines.

Removing this test case is fine. Though, it is convenient. But I
agree, it's redundant. Maybe we can tag any tests that are good to run
under SEV and/or SEV-ES via the `groups` field in the
x86/unittests.cfg file. The name `groups` is plural. So I assume that
a test can be a member of multiple groups. But I see no examples.

  reply	other threads:[~2021-10-19 14:15 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-04 20:49 [kvm-unit-tests PATCH v3 00/17] x86_64 UEFI and AMD SEV/SEV-ES support Zixuan Wang
2021-10-04 20:49 ` [kvm-unit-tests PATCH v3 01/17] x86: Move IDT, GDT and TSS to desc.c Zixuan Wang
2021-10-20 15:26   ` Paolo Bonzini
2021-10-20 17:56     ` Zixuan Wang
2021-10-21 11:50       ` Paolo Bonzini
2021-10-04 20:49 ` [kvm-unit-tests PATCH v3 02/17] x86 UEFI: Copy code from Linux Zixuan Wang
2021-10-04 20:49 ` [kvm-unit-tests PATCH v3 03/17] x86 UEFI: Implement UEFI function calls Zixuan Wang
2021-10-04 20:49 ` [kvm-unit-tests PATCH v3 04/17] x86 UEFI: Copy code from GNU-EFI Zixuan Wang
2021-10-04 20:49 ` [kvm-unit-tests PATCH v3 05/17] x86 UEFI: Boot from UEFI Zixuan Wang
2021-10-21 12:18   ` Paolo Bonzini
2021-10-21 14:11   ` Paolo Bonzini
2021-10-04 20:49 ` [kvm-unit-tests PATCH v3 06/17] x86 UEFI: Load IDT after UEFI boot up Zixuan Wang
2021-10-04 20:49 ` [kvm-unit-tests PATCH v3 07/17] x86 UEFI: Load GDT and TSS " Zixuan Wang
2021-10-04 20:49 ` [kvm-unit-tests PATCH v3 08/17] x86 UEFI: Set up memory allocator Zixuan Wang
2021-10-04 20:49 ` [kvm-unit-tests PATCH v3 09/17] x86 UEFI: Set up RSDP after UEFI boot up Zixuan Wang
2021-10-04 20:49 ` [kvm-unit-tests PATCH v3 10/17] x86 UEFI: Set up page tables Zixuan Wang
2021-10-04 20:49 ` [kvm-unit-tests PATCH v3 11/17] x86 UEFI: Convert x86 test cases to PIC Zixuan Wang
2021-10-21 14:12   ` Paolo Bonzini
2021-10-26  6:26     ` Zixuan Wang
2021-10-04 20:49 ` [kvm-unit-tests PATCH v3 12/17] x86 AMD SEV: Initial support Zixuan Wang
2021-10-21 13:31   ` Paolo Bonzini
2021-10-04 20:49 ` [kvm-unit-tests PATCH v3 13/17] x86 AMD SEV: Page table with c-bit Zixuan Wang
2021-10-04 20:49 ` [kvm-unit-tests PATCH v3 14/17] x86 AMD SEV-ES: Check SEV-ES status Zixuan Wang
2021-10-04 20:49 ` [kvm-unit-tests PATCH v3 15/17] x86 AMD SEV-ES: Copy UEFI #VC IDT entry Zixuan Wang
2021-10-04 20:49 ` [kvm-unit-tests PATCH v3 16/17] x86 AMD SEV-ES: Set up GHCB page Zixuan Wang
2021-10-04 20:49 ` [kvm-unit-tests PATCH v3 17/17] x86 AMD SEV-ES: Add test cases Zixuan Wang
2021-10-18 11:47   ` Varad Gautam
2021-10-19  4:38     ` Zixuan Wang
2021-10-19 14:14       ` Marc Orr [this message]
2021-10-19 15:31         ` Andrew Jones
2021-10-20 17:59           ` Zixuan Wang
2021-10-19 16:44         ` Varad Gautam
2021-10-20 17:59           ` Zixuan Wang
2021-10-21 14:04     ` Paolo Bonzini
2021-10-21 14:10 ` [kvm-unit-tests PATCH v3 00/17] x86_64 UEFI and AMD SEV/SEV-ES support Paolo Bonzini
2021-10-21 14:22   ` Marc Orr
2021-10-21 14:27     ` Paolo Bonzini
2021-11-25 15:21   ` Varad Gautam
2021-11-29 14:44     ` Marc Orr
2021-11-29 15:24       ` Tom Lendacky

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='CAA03e5HL0aiByPGiO5mescTHNM=DT69Kx=ep=cS-De8u+tvaMA@mail.gmail.com' \
    --to=marcorr@google.com \
    --cc=Thomas.Lendacky@amd.com \
    --cc=baekhw@google.com \
    --cc=bp@suse.de \
    --cc=brijesh.singh@amd.com \
    --cc=drjones@redhat.com \
    --cc=erdemaktas@google.com \
    --cc=jroedel@suse.de \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rientjes@google.com \
    --cc=seanjc@google.com \
    --cc=tmroeder@google.com \
    --cc=varad.gautam@suse.com \
    --cc=zxwang42@gmail.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.