From: Sean Christopherson <seanjc@google.com>
To: Maxim Levitsky <mlevitsk@redhat.com>
Cc: Oliver Upton <oupton@google.com>,
Paolo Bonzini <pbonzini@redhat.com>,
kvm@vger.kernel.org, Vitaly Kuznetsov <vkuznets@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
David Dunn <daviddunn@google.com>,
Peter Shier <pshier@google.com>
Subject: Re: [PATCH 1/2] KVM: x86: Allow userspace to opt out of hypercall patching
Date: Wed, 24 Aug 2022 18:40:36 +0000 [thread overview]
Message-ID: <YwZwpA2Mg+IOprBp@google.com> (raw)
In-Reply-To: <4c7f4ba7d6f4f796a2e7347113b280373a077d8a.camel@redhat.com>
On Wed, Aug 24, 2022, Maxim Levitsky wrote:
> On Wed, 2022-08-24 at 14:43 +0000, Sean Christopherson wrote:
> > On Wed, Aug 24, 2022, Maxim Levitsky wrote:
> > > I noticed that 'fix_hypercall_test' selftest fails if run in a VM. The reason is
> > > that L0 patches the hypercall before L1 sees it so it can't really do anything
> > > about it.
> > >
> > > Do you think we can always stop patching hypercalls for the nested guest regardless
> > > of the quirk, or that too will be considered breaking backwards compatability?
> >
> > Heh, go run it on Intel, problem solved ;-)
> >
> > As discussed last year[*], it's impossible to get this right in all cases, ignoring
> > the fact that patching in the first place is arguably wrong. E.g. if KVM is running
> > on AMD hardware and L0 exposes an Intel vCPU to L1, then it sadly becomes KVM's
> > responsibility to patch L2 because from L1's perspective, a #UD on Intel's VMCALL
> > in L2 is spurious.
> >
> > Regardless of what path we take, I do think we should align VMX and SVM on exception
> > intercept behavior.
>
> Maybe then we should at least skip the unit test if running nested (should be
> easy to check the hypervisor cpuid)?
My preference is to keep the test as is. It's not completely useless in a VM,
e.g. Intel works (currently), non-KVM VMs may or may not work, and VMMs that disable
the quirk in L0 will also work.
max_guest_memory_test is in a similar boat. Running that in L1 is not recommended
as KVM's shadow paging just can't keep up. But that doesn't mean that the test
should _never_ be run in L1.
If we have the test skip itself, then opting in requires a code change. On the
other hand, skipping the test in whatever script is being used to run selftests
is easy enough, e.g. `grep hypervisor /proc/cpuinfo`. IMO running test via `make`
is a complete mess and should be avoided anyways :-)
next prev parent reply other threads:[~2022-08-24 18:40 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-16 0:55 [PATCH 0/2] KVM: x86: Allow opt out of guest hypercall patching Oliver Upton
2022-03-16 0:55 ` [PATCH 1/2] KVM: x86: Allow userspace to opt out of " Oliver Upton
2022-03-24 17:44 ` Sean Christopherson
2022-03-24 17:57 ` Paolo Bonzini
2022-03-24 19:05 ` Oliver Upton
2022-03-25 23:53 ` Sean Christopherson
2022-03-28 17:28 ` Oliver Upton
2022-03-28 18:28 ` Sean Christopherson
2022-08-24 9:34 ` Maxim Levitsky
2022-08-24 14:43 ` Sean Christopherson
2022-08-24 15:06 ` Maxim Levitsky
2022-08-24 17:15 ` Paolo Bonzini
2022-08-24 18:40 ` Sean Christopherson [this message]
2022-03-16 0:55 ` [PATCH 2/2] selftests: KVM: Test KVM_X86_QUIRK_FIX_HYPERCALL_INSN Oliver Upton
2022-03-24 19:09 ` Oliver Upton
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=YwZwpA2Mg+IOprBp@google.com \
--to=seanjc@google.com \
--cc=daviddunn@google.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=mlevitsk@redhat.com \
--cc=oupton@google.com \
--cc=pbonzini@redhat.com \
--cc=pshier@google.com \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.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