kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hou Wenlong <houwenlong93@linux.alibaba.com>
To: kvm@vger.kernel.org
Subject: [PATCH v2 0/3] kvm: x86: some fixes of hypercall emulation
Date: Thu,  9 Sep 2021 19:55:22 +0800	[thread overview]
Message-ID: <cover.1631188011.git.houwenlong93@linux.alibaba.com> (raw)
In-Reply-To: <cover.1631186996.git.houwenlong93@linux.alibaba.com>

Currently, use hypercall instruction in guest cpl3 would just skip
the instruction, however, that behaviour could trigger a exception
in Linux host. It is reasonable for hypervisor to inject a exception,
especially in nested guest, L1 guest could behaviour like host.

As for hypercall instruction emulation, hypervisor would replace
the wrong instruction with the right instruction instead of the real
instruction emulation. It's guest's responsibility to use the right
instruction, hypervisor could emulate it but shouldn't modify it
without guest's request. At present, Linux guest could use alternative
to choose right instruction, and hyperv guest could use hypercall to
modify instruction. So just do the real instruction emualtion job
for em_hypercall().

change from v1:
	v1 is wrong edition, sent by mistake

Hou Wenlong (3):
  kvm: x86: Introduce hypercall x86 ops for handling hypercall not in
    cpl0
  kvm: x86: Refactor kvm_emulate_hypercall() to no skip instruction
  kvm: x86: Emulate hypercall instead of fixing hypercall instruction

 arch/x86/include/asm/kvm-x86-ops.h |  1 +
 arch/x86/include/asm/kvm_host.h    |  1 +
 arch/x86/kvm/emulate.c             | 20 +++++------
 arch/x86/kvm/kvm_emulate.h         |  2 +-
 arch/x86/kvm/svm/svm.c             |  6 ++++
 arch/x86/kvm/vmx/vmx.c             |  9 +++++
 arch/x86/kvm/x86.c                 | 55 +++++++++++++++++-------------
 7 files changed, 59 insertions(+), 35 deletions(-)

--
2.31.1


  parent reply	other threads:[~2021-09-09 11:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-09 11:37 [PATCH 0/3] some fixes of hypercall emulation Hou Wenlong
2021-09-09 11:37 ` [PATCH 1/3] kvm: x86: Introduce hypercall x86 ops for handling hypercall not in cpl0 Hou Wenlong
2021-09-09 11:37 ` [PATCH 2/3] kvm: x86: Refactor kvm_emulate_hypercall() to no skip instruction Hou Wenlong
2021-09-09 11:37 ` [PATCH 3/3] kvm: x86: Emulate hypercall instead of fixing hypercall instruction Hou Wenlong
2021-09-09 11:55 ` Hou Wenlong [this message]
2021-09-09 11:55   ` [PATCH v2 1/3] kvm: x86: Introduce hypercall x86 ops for handling hypercall not in cpl0 Hou Wenlong
2021-09-09 16:39     ` Yu Zhang
2021-09-09 17:09       ` Sean Christopherson
2021-09-10  1:53         ` Yu Zhang
2021-09-09 11:55   ` [PATCH v2 2/3] kvm: x86: Refactor kvm_emulate_hypercall() to no skip instruction Hou Wenlong
2021-09-09 11:55   ` [PATCH v2 3/3] kvm: x86: Emulate hypercall instead of fixing hypercall instruction Hou Wenlong
2021-09-16 16:00     ` 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=cover.1631188011.git.houwenlong93@linux.alibaba.com \
    --to=houwenlong93@linux.alibaba.com \
    --cc=kvm@vger.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).