kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Jim Mattson <jmattson@google.com>
Cc: kvm list <kvm@vger.kernel.org>, Oliver Upton <oupton@google.com>,
	Peter Shier <pshier@google.com>
Subject: Re: [PATCH 2/2] kvm: nVMX: Single-step traps trump expired VMX-preemption timer
Date: Mon, 20 Apr 2020 21:41:41 -0700	[thread overview]
Message-ID: <20200421044141.GE11134@linux.intel.com> (raw)
In-Reply-To: <CALMp9eQpwnhD7H3a9wC=TnL3=OKmvHAmVFj=r9OBaWiBEGhR4Q@mail.gmail.com>

On Mon, Apr 20, 2020 at 10:18:42AM -0700, Jim Mattson wrote:
> On Fri, Apr 17, 2020 at 9:21 PM Sean Christopherson
> <sean.j.christopherson@intel.com> wrote:
> >
> > On Wed, Apr 15, 2020 at 04:33:31PM -0700, Jim Mattson wrote:
> > > On Tue, Apr 14, 2020 at 5:12 PM Sean Christopherson
> > > <sean.j.christopherson@intel.com> wrote:
> > > >
> > > > On Tue, Apr 14, 2020 at 09:47:53AM -0700, Jim Mattson wrote:
> > > Yes, it's wrong in the abstract, but with respect to faults and the
> > > VMX-preemption timer expiration, is there any way for either L1 or L2
> > > to *know* that the virtual CPU has done something wrong?
> >
> > I don't think so?  But how is that relevant, i.e. if we can fix KVM instead
> > of fudging the result, why wouldn't we fix KVM?
> 
> I'm not sure that I can fix KVM. The missing #DB traps were relatively
> straightforward, but as for the rest of this mess...
> 
> Since you seem to have a handle on what needs to be done, I will defer to
> you.

I wouldn't go so far as to say I have a handle on it, more like I have an
idea of how to fix one part of the overall problem with a generic "rule"
change that also happens to (hopefully) resolve the #DB+MTF issue.

Anyways, I'll send a patch.  Worst case scenario it fails miserably and we
go with this patch :-)

> > > Isn't it generally true that if you have an exception queued when you
> > > transition from L2 to L1, then you've done something wrong? I wonder
> > > if the call to kvm_clear_exception_queue() in prepare_vmcs12() just
> > > serves to sweep a whole collection of problems under the rug.
> >
> > More than likely, yes.
> >
> > > > In general, interception of an event doesn't change the priority of events,
> > > > e.g. INTR shouldn't get priority over NMI just because if L1 wants to
> > > > intercept INTR but not NMI.
> > >
> > > Yes, but that's a different problem altogether.
> >
> > But isn't the fix the same?  Stop processing events if a higher priority
> > event is pending, regardless of whether the event exits to L1.
> 
> That depends on how you see the scope of the problem. One could argue
> that the fix for everything that is wrong with KVM is actually the
> same: properly emulate the physical CPU.

Heh, there is that.

What I'm arguing is that we shouldn't throw in a workaround knowing that
it's papering over the underlying issue.  Preserving event priority
irrespective of VM-Exit behavior is different, in that while it may not
resolve all issues that are being masked by kvm_clear_exception_queue(),
the change itself is correct when viewed in a vacuum.

  reply	other threads:[~2020-04-21  4:41 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-14  0:09 [PATCH 1/2] kvm: nVMX: Pending debug exceptions trump expired VMX-preemption timer Jim Mattson
2020-04-14  0:09 ` [PATCH 2/2] kvm: nVMX: Single-step traps " Jim Mattson
2020-04-14  3:17   ` Sean Christopherson
2020-04-14 16:47     ` Jim Mattson
2020-04-15  0:12       ` Sean Christopherson
2020-04-15  0:20         ` Sean Christopherson
2020-04-15  0:22           ` Sean Christopherson
2020-04-15 23:33         ` Jim Mattson
2020-04-18  4:21           ` Sean Christopherson
2020-04-20 17:18             ` Jim Mattson
2020-04-21  4:41               ` Sean Christopherson [this message]
2020-04-21 18:28                 ` Jim Mattson
2020-04-22  0:16                   ` Sean Christopherson
2020-04-22  8:30   ` Paolo Bonzini
2020-04-22 15:48     ` Sean Christopherson
2020-04-22 16:28     ` Jim Mattson
2020-04-22 16:42       ` Sean Christopherson
2020-04-22 21:06 ` [PATCH 1/2] kvm: nVMX: Pending debug exceptions " Sean Christopherson
2020-04-22 21:23   ` Sean Christopherson
2020-04-22 21:27   ` Jim Mattson
2020-04-22 22:06     ` 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=20200421044141.GE11134@linux.intel.com \
    --to=sean.j.christopherson@intel.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=oupton@google.com \
    --cc=pshier@google.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;
as well as URLs for NNTP newsgroup(s).