From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Don Slutz <dslutz@verizon.com>, xen-devel@lists.xen.org
Cc: Kevin Tian <kevin.tian@intel.com>, Keir Fraser <keir@xen.org>,
Ian Campbell <ian.campbell@citrix.com>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
Jun Nakajima <jun.nakajima@intel.com>,
Eddie Dong <eddie.dong@intel.com>,
Ian Jackson <ian.jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>,
Jan Beulich <jbeulich@suse.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Subject: Re: [PATCH v3 04/16] hypervisor part of add vmware_port to xl.cfg
Date: Mon, 08 Sep 2014 11:01:10 -0400 [thread overview]
Message-ID: <540DC4B6.1000707@oracle.com> (raw)
In-Reply-To: <1410182158-8542-5-git-send-email-dslutz@verizon.com>
On 09/08/2014 09:15 AM, Don Slutz wrote:
> diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
> index b5188e6..12079be 100644
> --- a/xen/arch/x86/hvm/svm/svm.c
> +++ b/xen/arch/x86/hvm/svm/svm.c
> @@ -59,6 +59,7 @@
> #include <public/sched.h>
> #include <asm/hvm/vpt.h>
> #include <asm/hvm/trace.h>
> +#include <asm/hvm/vmport.h>
> #include <asm/hap.h>
> #include <asm/apic.h>
> #include <asm/debugger.h>
> @@ -2065,6 +2066,38 @@ svm_vmexit_do_vmsave(struct vmcb_struct *vmcb,
> return;
> }
>
> +static void svm_vmexit_gp_intercept(struct cpu_user_regs *regs,
> + struct vcpu *v)
> +{
> + struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
> + unsigned long inst_len;
> + unsigned long inst_addr = svm_rip2pointer(v);
> + int rc;
> + static const enum instruction_index list[] = {
> + INSTR_INL_DX, INSTR_INB_DX, INSTR_OUTL_DX, INSTR_OUTB_DX
> + };
> +
> + regs->error_code = vmcb->exitinfo1;
I am not sure this is a good idea. I have a feeling this may mess up
fault reporting in case of double faults (e.g. see AMD volume 2 section
15.2, Example paragraph).
Do you really need to save it into regs or can out pass exitinfo1 as
error_code argument directly to vmport_gp_check()?
> + inst_len = __get_instruction_length_from_list(
> + v, list, ARRAY_SIZE(list), 0);
> +
> + rc = vmport_gp_check(regs, v, inst_len, inst_addr, vmcb->exitinfo2);
You probably want to call this only when
__get_instruction_length_from_list() succeeded (i.e. instr_len >0)
What happens when you have a non-VMware-aware guest that performs this
access? Prior to this patch it would get a #GP but now it will continue
happily running, right? This changes user-visible behavior.
I wonder whether we should enable #GP intercepts only when we know that
the guest is VMware-aware (which we do as far as I can tell since we
have a config option).
-boris
> + if ( !rc )
> + __update_guest_eip(regs, inst_len);
> + else
> + {
> + VMPORT_DBG_LOG(VMPORT_LOG_GP_UNKNOWN,
> + "gp: rc=%d e2=%lx ec=%lx ip=%"PRIx64" (%ld) ax=%"PRIx64
> + " bx=%"PRIx64" cx=%"PRIx64" dx=%"PRIx64" si=%"PRIx64
> + " di=%"PRIx64, rc,
> + (unsigned long)vmcb->exitinfo2,
> + (unsigned long)regs->error_code,
> + regs->rip, inst_len, regs->rax, regs->rbx, regs->rcx,
> + regs->rdx, regs->rsi, regs->rdi);
> + hvm_inject_hw_exception(TRAP_gp_fault, regs->error_code);
> + }
> +}
> +
>
next prev parent reply other threads:[~2014-09-08 15:01 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-08 13:15 [PATCH v3 00/16] Xen VMware tools support Don Slutz
2014-09-08 13:15 ` [PATCH v3 01/16] hypervisor part of add vmware_hw to xl.cfg Don Slutz
2014-09-11 10:52 ` George Dunlap
2014-09-11 17:21 ` Don Slutz
2014-09-08 13:15 ` [PATCH v3 02/16] tools " Don Slutz
2014-09-11 11:23 ` George Dunlap
2014-09-11 17:48 ` Don Slutz
2014-09-08 13:15 ` [PATCH v3 03/16] vmware: Add VMware provided include files Don Slutz
2014-09-08 13:15 ` [PATCH v3 04/16] hypervisor part of add vmware_port to xl.cfg Don Slutz
2014-09-08 15:01 ` Boris Ostrovsky [this message]
2014-09-08 15:22 ` Jan Beulich
2014-09-08 15:32 ` Andrew Cooper
2014-09-08 15:43 ` Boris Ostrovsky
2014-09-08 17:56 ` Don Slutz
2014-09-08 17:20 ` Don Slutz
2014-09-11 15:34 ` George Dunlap
2014-09-08 13:15 ` [PATCH v3 05/16] tools " Don Slutz
2014-09-15 10:03 ` George Dunlap
2014-09-20 15:52 ` Slutz, Donald Christopher
2014-09-08 13:15 ` [PATCH v3 06/16] hypervisor part of convert vmware_port to xentrace usage Don Slutz
2014-09-08 13:15 ` [PATCH v3 07/16] tools " Don Slutz
2014-09-08 13:15 ` [PATCH v3 08/16] hypervisor part of add limited support of VMware's hyper-call rpc Don Slutz
2014-09-08 13:15 ` [PATCH v3 09/16] tools " Don Slutz
2014-09-08 13:15 ` [PATCH v3 10/16] Add VMware tool's triggers Don Slutz
2014-09-08 13:15 ` [PATCH v3 11/16] Add live migration of VMware's hyper-call RPC Don Slutz
2014-09-08 13:15 ` [PATCH v3 12/16] Add dump of HVM_SAVE_CODE(VMPORT) to xen-hvmctx Don Slutz
2014-09-08 13:15 ` [optional][PATCH v3 13/16] Add xen-hvm-param Don Slutz
2014-09-08 13:15 ` [optional][PATCH v3 14/16] Add xen-vmware-guestinfo Don Slutz
2014-09-08 13:15 ` [optional][PATCH v3 15/16] Add xen-list-vmware-guestinfo Don Slutz
2014-09-08 13:15 ` [optional][PATCH v3 16/16] Add xen-hvm-send-trigger Don Slutz
2014-09-08 13:38 ` [PATCH v3 00/16] Xen VMware tools support Ian Campbell
2014-09-08 16:58 ` Don Slutz
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=540DC4B6.1000707@oracle.com \
--to=boris.ostrovsky@oracle.com \
--cc=Aravind.Gopalakrishnan@amd.com \
--cc=andrew.cooper3@citrix.com \
--cc=dslutz@verizon.com \
--cc=eddie.dong@intel.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=jun.nakajima@intel.com \
--cc=keir@xen.org \
--cc=kevin.tian@intel.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=suravee.suthikulpanit@amd.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.