public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <sean.j.christopherson@intel.com>
To: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: VMX: Handle single-step #DB for EMULTYPE_SKIP on EPT misconfig
Date: Tue, 27 Aug 2019 13:43:47 -0700	[thread overview]
Message-ID: <20190827204347.GK27459@linux.intel.com> (raw)
In-Reply-To: <20190823213115.31908-1-sean.j.christopherson@intel.com>

On Fri, Aug 23, 2019 at 02:31:15PM -0700, Sean Christopherson wrote:
> VMX's EPT misconfig flow to handle fast-MMIO path falls back to decoding
> the instruction to determine the instruction length when running as a
> guest (Hyper-V doesn't fill VMCS.VM_EXIT_INSTRUCTION_LEN because it's
> technically not defined for EPT misconfigs).  Rather than implement the
> slow skip in VMX's generic skip_emulated_instruction(),
> handle_ept_misconfig() directly calls kvm_emulate_instruction() with
> EMULTYPE_SKIP, which intentionally doesn't do single-step detection, and
> so handle_ept_misconfig() misses a single-step #DB.
> 
> Rework the EPT misconfig fallback case to route it through
> kvm_skip_emulated_instruction() so that single-step #DBs and interrupt
> shadow updates are handled automatically.  I.e. make VMX's slow skip
> logic match SVM's and have the SVM flow not intentionally avoid the
> shadow update.
> 
> Alternatively, the handle_ept_misconfig() could manually handle single-
> step detection, but that results in EMULTYPE_SKIP having split logic for
> the interrupt shadow vs. single-step #DBs, and split emulator logic is
> largely what led to this mess in the first place.
> 
> Modifying SVM to mirror VMX flow isn't really an option as SVM's case
> isn't limited to a specific exit reason, i.e. handling the slow skip in
> skip_emulated_instruction() is mandatory for all intents and purposes.
> 
> Drop VMX's skip_emulated_instruction() wrapper since it can now fail,
> and instead WARN if it fails unexpectedly, e.g. if exit_reason somehow
> becomes corrupted.
> 
> Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
> Fixes: d391f12070672 ("x86/kvm/vmx: do not use vm-exit instruction length for fast MMIO when running nested")
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> ---
> 
> *** LOOK HERE ***
> 
> This patch applies on top my recent emulation cleanup[1][2] as it has
> non-trivial conflicts, dealing with those seemed like a waste of time,
> and this doesn't seem like a candidate for stable.  Let me know if you'd
> prefer it to be respun without the dependency.
> 
> Sadly/ironically, this unwinds some of the logic that was recently
> added by Vitaly at my suggestion.  Hindsight is 20/20 and all that...
> 
> [1] https://lkml.kernel.org/r/20190823010709.24879-1-sean.j.christopherson@intel.com
> [2] https://patchwork.kernel.org/cover/11110331/

Paolo and/or Radim,

Please ignore this patch, I'll fold it into the aforementioned emulation
cleanup since I need to spin v2 of that series.

      reply	other threads:[~2019-08-27 20:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-23 21:31 [PATCH] KVM: VMX: Handle single-step #DB for EMULTYPE_SKIP on EPT misconfig Sean Christopherson
2019-08-27 20:43 ` Sean Christopherson [this message]

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=20190827204347.GK27459@linux.intel.com \
    --to=sean.j.christopherson@intel.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.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