From: Sean Christopherson <seanjc@google.com>
To: Ivan Orlov <ivan.orlov0322@gmail.com>
Cc: Ivan Orlov <iorlov@amazon.com>,
bp@alien8.de, dave.hansen@linux.intel.com, mingo@redhat.com,
pbonzini@redhat.com, shuah@kernel.org, tglx@linutronix.de,
hpa@zytor.com, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
x86@kernel.org, jalliste@amazon.com, nh-open-source@amazon.com,
pdurrant@amazon.co.uk
Subject: Re: [PATCH 1/3] KVM: x86, vmx: Add function for event delivery error generation
Date: Wed, 16 Oct 2024 16:12:04 -0700 [thread overview]
Message-ID: <ZxBIRBB0Ibx9J5TN@google.com> (raw)
In-Reply-To: <cea2040f-7214-41cb-9e9c-98895bf5a1ec@gmail.com>
On Wed, Oct 16, 2024, Ivan Orlov wrote:
> On 10/16/24 22:05, Sean Christopherson wrote:
> > On Tue, Oct 15, 2024, Ivan Orlov wrote:
> > > > > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> > > > > index c67e448c6ebd..afd785e7f3a3 100644
> > > > > --- a/arch/x86/kvm/vmx/vmx.c
> > > > > +++ b/arch/x86/kvm/vmx/vmx.c
> > > > > @@ -6550,19 +6550,10 @@ static int __vmx_handle_exit(struct kvm_vcpu *vcpu, fastpath_t exit_fastpath)
> > > > > exit_reason.basic != EXIT_REASON_APIC_ACCESS &&
> > > > > exit_reason.basic != EXIT_REASON_TASK_SWITCH &&
> > > > > exit_reason.basic != EXIT_REASON_NOTIFY)) {
> > > > > - int ndata = 3;
> > > > > + gpa_t gpa = vmcs_read64(GUEST_PHYSICAL_ADDRESS);
> > > > > + bool is_mmio = exit_reason.basic == EXIT_REASON_EPT_MISCONFIG;
> > > >
> > > > There's no need for is_mmio, just pass INVALID_GPA when the GPA isn't known.
> > >
> > > Ah alright, then we definitely don't need an is_mmio field. I assume we
> > > can't do MMIO at GPA=0, right?
> >
> > Wrong :-)
> >
>
> Then getting rid of `is_mmio` will make distinguishing between vectoring
> error due to MMIO with GPA=0 and non-mmio vectoring error quite hard for the
> error reporti
>
> Passing INVALID_GPA into the userspace due to non-mmio vectoring error will
> change the existing internal.data order, but I can do it if it's fine. Sorry
> for nitpicking :)
KVM's existing ABI is rather awful, though arguably the intent was that there is
no ABI, i.e. that KVM is dumping info to try to be helpful. E.g. the existing
behavior is that data[3] contains a GPA only for EPT_MISCONFIG, but for everything
else, data[3] contains last_vmentry_cpu.
And because it's so awful, I doubt any userspace actually has code that acts on
the layout of data[]. So, I suspect we can do the simple and sane thing, and
fill data[3] with -1ull if the GPA is invalid, and then document that that's the
behavior (if we're feeling generous).
next prev parent reply other threads:[~2024-10-16 23:12 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-27 16:16 [PATCH 0/3] Handle MMIO during event delivery error on SVM Ivan Orlov
2024-09-27 16:16 ` [PATCH 1/3] KVM: x86, vmx: Add function for event delivery error generation Ivan Orlov
2024-10-11 23:20 ` Sean Christopherson
2024-10-12 0:06 ` Sean Christopherson
2024-10-15 19:52 ` Ivan Orlov
2024-10-16 21:05 ` Sean Christopherson
2024-10-16 22:05 ` Ivan Orlov
2024-10-16 23:12 ` Sean Christopherson [this message]
2024-09-27 16:16 ` [PATCH 2/3] KVM: vmx, svm, mmu: Process MMIO during event delivery Ivan Orlov
2024-10-12 0:05 ` Sean Christopherson
2024-10-16 22:53 ` Ivan Orlov
2024-10-17 16:20 ` Sean Christopherson
2024-09-27 16:16 ` [PATCH 3/3] selftests: KVM: Add test case for " Ivan Orlov
2024-10-12 0:21 ` Sean Christopherson
2024-10-17 16:27 ` David Woodhouse
2024-10-17 16:58 ` 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=ZxBIRBB0Ibx9J5TN@google.com \
--to=seanjc@google.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=iorlov@amazon.com \
--cc=ivan.orlov0322@gmail.com \
--cc=jalliste@amazon.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=nh-open-source@amazon.com \
--cc=pbonzini@redhat.com \
--cc=pdurrant@amazon.co.uk \
--cc=shuah@kernel.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).