vm_event: clear up return value of vm_event_monitor_traps
PATCH v7 1/3 vm_event: clear up return value of vm_event_monitor_traps
The return value has not been clearly defined, with the function never returning 0 which seemingly indicated a condition where the guest should crash.
In this patch we define -rc as error condition where a subscriber is present but an error prevented the notification from being sent; 0 where there is no subscriber or the notification was sent and the vCPU is not paused (i.e. safe to continue execution as normal); and 1 where the notification was sent with the vCPU paused and we are waiting for a response.
---
Cc: Jun Nakajima <[email protected]>
Cc: Andrew Cooper <[email protected]>
v6: Remove unnecessary else clause in vmx
--- xen/arch/x86/hvm/monitor.c | 4 ++-- xen/arch/x86/hvm/vmx/vmx.c | 6 +++--- xen/common/vm_event.c | 5 +++-- 3 files changed, 8 insertions(+), 7 deletions(-)
xen/arch/x86/hvm/monitor.c +2 -2
@@ -48,8 +48,8 @@ bool_t hvm_monitor_cr(unsigned int index, unsigned long value, unsigned long old .u.write_ctrlreg.old_value = old }; -vm_event_monitor_traps (curr, sync, &req); -return 1 ; +if (vm_event_monitor_traps (curr, sync, &req) >=0 ) +return 1 ; }return 0 ;
xen/arch/x86/hvm/vmx/vmx.c +3 -3
@@ -3391,11 +3391,11 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)break ; }else { -int handled = +int rc =hvm_monitor_breakpoint (regs->eip,HVM_MONITOR_SOFTWARE_BREAKPOINT ); -if ( handled <0 ) +if ( !rc ) {struct hvm_trap trap = { .vector = TRAP_int3,
@@ -3409,7 +3409,7 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)hvm_inject_trap (&trap);break ; } -else if ( handled ) +if ( rc >0 )break ; }
xen/common/vm_event.c +3 -2
@@ -806,7 +806,7 @@ int vm_event_monitor_traps(struct vcpu *v, uint8_t sync,* If there was no ring to handle the event, then * simply continue executing normally. */ -return 1 ; +return 0 ;default :return rc; };
@@ -815,6 +815,7 @@ int vm_event_monitor_traps(struct vcpu *v, uint8_t sync, { req->flags |=VM_EVENT_FLAG_VCPU_PAUSED ;vm_event_vcpu_pause (v); + rc =1 ; }if (altp2m_active (d) )
@@ -826,7 +827,7 @@ int vm_event_monitor_traps(struct vcpu *v, uint8_t sync,vm_event_fill_regs (req);vm_event_put_request (d, &d->vm_event->monitor, req); -return 1 ; +return rc; }/*
Signature · 7 lines
2.8.1 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
PATCH v7 2/3 x86/vm_event: Add HVM debug exception vm_events
Since in-guest debug exceptions are now unconditionally trapped to Xen, adding a hook for vm_event subscribers to tap into this new always-on guest event. We rename along the way hvm_event_breakpoint_type to hvm_event_type to better match the various events that can be passed with it. We also introduce the necessary monitor_op domctl's to enable subscribing to the events.
This patch also provides monitor subscribers to int3 events proper access to the instruction length necessary for accurate event-reinjection. Without this subscribers manually have to evaluate if the int3 instruction has any prefix attached which would change the instruction length.
---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: Razvan Cojocaru <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Jun Nakajima <[email protected]>
Cc: Kevin Tian <[email protected]>
v7: Add rc < 0 clause for crash case in vmx and cosmetic fixes
--- tools/libxc/include/xenctrl.h | 3 +- tools/libxc/xc_monitor.c | 25 +++++++++++++++ tools/tests/xen-access/xen-access.c | 61 ++++++++++++++++++++++++++++++++----- xen/arch/x86/hvm/monitor.c | 21 +++++++++++-- xen/arch/x86/hvm/vmx/vmx.c | 46 ++++++++++++++++++++++------ xen/arch/x86/monitor.c | 16 ++++++++++ xen/include/asm-x86/domain.h | 2 ++ xen/include/asm-x86/hvm/monitor.h | 7 +++-- xen/include/asm-x86/monitor.h | 3 +- xen/include/public/domctl.h | 6 ++++ xen/include/public/vm_event.h | 14 +++++++-- 11 files changed, 177 insertions(+), 27 deletions(-)
tools/libxc/include/xenctrl.h +2 -1
@@ -2165,7 +2165,8 @@ int xc_monitor_software_breakpoint(xc_interface *xch, domid_t domain_id, bool enable);int xc_monitor_guest_request (xc_interface *xch,domid_t domain_id,bool enable,bool sync); - +int xc_monitor_debug_exceptions (xc_interface *xch,domid_t domain_id, +bool enable,bool sync);/** * This function enables / disables emulation for each REP for a * REP-compatible instruction.
tools/libxc/xc_monitor.c +25 -0
@@ -156,3 +156,28 @@ int xc_monitor_emulate_each_rep(xc_interface *xch, domid_t domain_id,return do_domctl (xch, &domctl); } + +int xc_monitor_debug_exceptions (xc_interface *xch,domid_t domain_id, +bool enable,bool sync) +{ +DECLARE_DOMCTL ; + + domctl.cmd = XEN_DOMCTL_monitor_op; + domctl.domain = domain_id; + domctl.u.monitor_op.op = enable ?XEN_DOMCTL_MONITOR_OP_ENABLE + :XEN_DOMCTL_MONITOR_OP_DISABLE ; + domctl.u.monitor_op.event =XEN_DOMCTL_MONITOR_EVENT_DEBUG_EXCEPTION ; + domctl.u.monitor_op.u.debug_exception.sync = sync; + +return do_domctl (xch, &domctl); +} + +/* +* Local variables: +* mode: C +* c-file-style: "BSD" +* c-basic-offset: 4 +* tab-width: 4 +* indent-tabs-mode: nil +* End: +*/
tools/tests/xen-access/xen-access.c +54 -7
147 lines not on this page · raw message
xen/arch/x86/hvm/monitor.c +18 -3
@@ -87,12 +87,13 @@ static inline unsigned long gfn_of_rip(unsigned long rip)return paging_gva_to_gfn (curr, sreg.base + rip, &pfec); } -int hvm_monitor_breakpoint (unsigned long rip, -enum hvm_monitor_breakpoint_type type) +int hvm_monitor_debug (unsigned long rip,enum hvm_monitor_debug_type type, +unsigned long trap_type,unsigned long insn_length) {struct vcpu *curr = current;struct arch_domain *ad = &curr->domain->arch;vm_event_request_t req = {}; +bool_t sync;switch ( type ) {
@@ -101,6 +102,9 @@ int hvm_monitor_breakpoint(unsigned long rip,return 0 ; req.reason =VM_EVENT_REASON_SOFTWARE_BREAKPOINT ; req.u.software_breakpoint.gfn =gfn_of_rip (rip); + req.u.software_breakpoint.type = trap_type; + req.u.software_breakpoint.insn_length = insn_length; + sync =1 ;break ;case HVM_MONITOR_SINGLESTEP_BREAKPOINT :
@@ -108,6 +112,17 @@ int hvm_monitor_breakpoint(unsigned long rip,return 0 ; req.reason =VM_EVENT_REASON_SINGLESTEP ; req.u.singlestep.gfn =gfn_of_rip (rip); + sync =1 ; +break ; + +case HVM_MONITOR_DEBUG_EXCEPTION : +if ( !ad->monitor.debug_exception_enabled ) +return 0 ; + req.reason =VM_EVENT_REASON_DEBUG_EXCEPTION ; + req.u.debug_exception.gfn =gfn_of_rip (rip); + req.u.debug_exception.type = trap_type; + req.u.debug_exception.insn_length = insn_length; + sync = !!ad->monitor.debug_exception_sync;break ;default :
@@ -116,7 +131,7 @@ int hvm_monitor_breakpoint(unsigned long rip, req.vcpu_id = curr->vcpu_id; -return vm_event_monitor_traps (curr,1 , &req); +return vm_event_monitor_traps (curr, sync, &req); }/*
xen/arch/x86/hvm/vmx/vmx.c +36 -10
71 lines not on this page · raw message
xen/arch/x86/monitor.c +16 -0
@@ -224,6 +224,22 @@ int arch_monitor_domctl_event(struct domain *d,break ; } +case XEN_DOMCTL_MONITOR_EVENT_DEBUG_EXCEPTION : + { +bool_t old_status = ad->monitor.debug_exception_enabled; + +if (unlikely (old_status == requested_status) ) +return -EEXIST ; + +domain_pause (d); + ad->monitor.debug_exception_enabled = requested_status; + ad->monitor.debug_exception_sync = requested_status ? + mop->u.debug_exception.sync : +0 ; +domain_unpause (d); +break ; + } +default :/* * Should not be reached unless arch_monitor_get_capabilities() is
xen/include/asm-x86/domain.h +2 -0
@@ -403,6 +403,8 @@ struct arch_domain unsigned int write_ctrlreg_onchangeonly : 4; unsigned int singlestep_enabled : 1; unsigned int software_breakpoint_enabled : 1; + unsigned int debug_exception_enabled : 1; + unsigned int debug_exception_sync : 1;struct monitor_msr_bitmap *msr_bitmap; } monitor;
xen/include/asm-x86/hvm/monitor.h +4 -3
@@ -23,10 +23,11 @@#include <xen/paging.h> #include <public/vm_event.h> -enum hvm_monitor_breakpoint_type +enum hvm_monitor_debug_type {HVM_MONITOR_SOFTWARE_BREAKPOINT ,HVM_MONITOR_SINGLESTEP_BREAKPOINT , +HVM_MONITOR_DEBUG_EXCEPTION , };/*
@@ -39,8 +40,8 @@ bool_t hvm_monitor_cr(unsigned int index, unsigned long value,#define hvm_monitor_crX (cr, new, old) \ hvm_monitor_cr(VM_EVENT_X86_##cr, new, old)void hvm_monitor_msr (unsigned int msr,uint64_t value); -int hvm_monitor_breakpoint (unsigned long rip, -enum hvm_monitor_breakpoint_type type); +int hvm_monitor_debug (unsigned long rip,enum hvm_monitor_debug_type type, +unsigned long trap_type,unsigned long insn_length);#endif /* __ASM_X86_HVM_MONITOR_H__ */
xen/include/asm-x86/monitor.h +2 -1
@@ -77,7 +77,8 @@ static inline uint32_t arch_monitor_get_capabilities(struct domain *d) capabilities = (1U <<XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG ) | (1U <<XEN_DOMCTL_MONITOR_EVENT_MOV_TO_MSR ) | (1U <<XEN_DOMCTL_MONITOR_EVENT_SOFTWARE_BREAKPOINT ) | - (1U <<XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST ); + (1U <<XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST ) | + (1U <<XEN_DOMCTL_MONITOR_EVENT_DEBUG_EXCEPTION );/* Since we know this is on VMX, we can just call the hvm func */ if (hvm_is_singlestep_supported () )
xen/include/public/domctl.h +6 -0
@@ -1080,6 +1080,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_psr_cmt_op_t);#define XEN_DOMCTL_MONITOR_EVENT_SINGLESTEP 2#define XEN_DOMCTL_MONITOR_EVENT_SOFTWARE_BREAKPOINT 3#define XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST 4 +#define XEN_DOMCTL_MONITOR_EVENT_DEBUG_EXCEPTION 5struct xen_domctl_monitor_op {uint32_t op;/* XEN_DOMCTL_MONITOR_OP_* */
@@ -1114,6 +1115,11 @@ struct xen_domctl_monitor_op {/* Pause vCPU until response */ uint8_t sync; } guest_request; + +struct { +/* Pause vCPU until response */ +uint8_t sync; + } debug_exception; } u; };typedef struct xen_domctl_monitor_op xen_domctl_monitor_op_t ;
xen/include/public/vm_event.h +12 -2
@@ -29,7 +29,7 @@#include "xen.h" -#define VM_EVENT_INTERFACE_VERSION 0x00000001 +#define VM_EVENT_INTERFACE_VERSION 0x00000002#if defined(__XEN__) || defined(__XEN_TOOLS__)
@@ -119,6 +119,8 @@#define VM_EVENT_REASON_SINGLESTEP 7/* An event has been requested via HVMOP_guest_request_vm_event. */ #define VM_EVENT_REASON_GUEST_REQUEST 8 +/* A debug exception was caught */ +#define VM_EVENT_REASON_DEBUG_EXCEPTION 9/* Supported values for the vm_event_write_ctrlreg index. */ #define VM_EVENT_X86_CR0 0
@@ -203,8 +205,15 @@ struct vm_event_write_ctrlreg {uint64_t old_value; }; +struct vm_event_singlestep { +uint64_t gfn; +}; +struct vm_event_debug {uint64_t gfn; +uint32_t insn_length; +uint8_t type;/* HVMOP_TRAP_* */ +uint8_t _pad[3 ]; };struct vm_event_mov_to_msr {
@@ -247,8 +256,9 @@ typedef struct vm_event_st {struct vm_event_mem_access mem_access;struct vm_event_write_ctrlreg write_ctrlreg;struct vm_event_mov_to_msr mov_to_msr; +struct vm_event_singlestep singlestep;struct vm_event_debug software_breakpoint; -struct vm_event_debug singlestep; +struct vm_event_debug debug_exception; } u;union {
Signature · 7 lines
2.8.1 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [PATCH v7 2/3] x86/vm_event: Add HVM debug exception vm_events
Quoted 22 lines · Tamas K Lengyel
Since in-guest debug exceptions are now unconditionally trapped to Xen, adding a hook for
vm_eventsubscribers to tap into this new always-on guest event. We rename along the wayhvm_event_breakpoint_typetohvm_event_typeto better match the various events that can be passed with it. We also introduce the necessarymonitor_opdomctl's to enable subscribing to the events.This patch also provides monitor subscribers to int3 events proper access to the instruction length necessary for accurate event-reinjection. Without this subscribers manually have to evaluate if the int3 instruction has any prefix attached which would change the instruction length.
Signed-off-by Tamas K Lengyel <[email protected]>---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: Razvan Cojocaru <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Jun Nakajima <[email protected]>
Cc: Kevin Tian <[email protected]>v7: Add rc < 0 clause for crash case in vmx and cosmetic fixes
Quoted 13 lines
--- tools/libxc/include/xenctrl.h | 3 +- tools/libxc/xc_monitor.c | 25 +++++++++++++++ tools/tests/xen-access/xen-access.c | 61 ++++++++++++++++++++++++++++++++----- xen/arch/x86/hvm/monitor.c | 21 +++++++++++-- xen/arch/x86/hvm/vmx/vmx.c | 46 ++++++++++++++++++++++------ xen/arch/x86/monitor.c | 16 ++++++++++ xen/include/asm-x86/domain.h | 2 ++ xen/include/asm-x86/hvm/monitor.h | 7 +++-- xen/include/asm-x86/monitor.h | 3 +- xen/include/public/domctl.h | 6 ++++ xen/include/public/vm_event.h | 14 +++++++-- 11 files changed, 177 insertions(+), 27 deletions(-)
Thanks,
Razvan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v7 2/3] x86/vm_event: Add HVM debug exception vm_events
In reply to Tamas K LengyelQuoted 21 lines
Quoted 1 line
Quoted 1 line · On 27.06.16 at 20:08, <[email protected]> wrote:
xen/arch/x86/hvm/vmx/vmx.c +13
-1@@ -3376,7 +3376,29 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)HVMTRACE_1D (TRAP_DEBUG , exit_qualification);write_debugreg (6 , exit_qualification |DR_STATUS_RESERVED_ONE );if ( !v->domain->debugger_attached ) -vmx_propagate_intr (intr_info); + { +unsigned long insn_len =0 ; +int rc; +unsigned long trap_type =MASK_EXTR (intr_info, +INTR_INFO_INTR_TYPE_MASK ); + +if ( trap_type >=X86_EVENTTYPE_SW_INTERRUPT ) +__vmread (VM_EXIT_INSTRUCTION_LEN , &insn_len); + + rc =hvm_monitor_debug (regs->eip, +HVM_MONITOR_DEBUG_EXCEPTION , + trap_type, insn_len); +
xen/arch/x86/hvm/vmx/vmx.c void vmx_vmexit_handler(struct cpu_user_regs *regs) · line 3401
Quoted 10 lines
xen/arch/x86/hvm/vmx/vmx.c +10
-0+/* +* !rc continue normally +* rc > 0 paused waiting for response, work here is done +* rc < 0 error in monitor/vm_event, crash +*/ +if ( !rc ) +vmx_propagate_intr (intr_info); +if ( rc <0 ) + goto exit_and_crash; + }
As opposed to earlier versions, here omitting the "else" seems undesirable. Or, perhaps better, simply re-order the two if()-s. This is to make clear that what is now the second if() does in no way depend on what the body of the current first if() does.
The same would then apply to patch 3, and I'd be fine doing the adjustment while committing (provided all necessary acks trickle in). Feel free to add my ack here for the few changes for which that's actually relevant.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v7 2/3] x86/vm_event: Add HVM debug exception vm_events
Quoted 37 lines · Jan Beulich
Quoted 21 lines
Quoted 1 line
Quoted 1 line · On 27.06.16 at 20:08, <[email protected]> wrote:
xen/arch/x86/hvm/vmx/vmx.c +13
-1@@ -3376,7 +3376,29 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)HVMTRACE_1D (TRAP_DEBUG , exit_qualification);write_debugreg (6 , exit_qualification |DR_STATUS_RESERVED_ONE );if ( !v->domain->debugger_attached ) -vmx_propagate_intr (intr_info); + { +unsigned long insn_len =0 ; +int rc; +unsigned long trap_type =MASK_EXTR (intr_info, +INTR_INFO_INTR_TYPE_MASK ); + +if ( trap_type >=X86_EVENTTYPE_SW_INTERRUPT ) +__vmread (VM_EXIT_INSTRUCTION_LEN , &insn_len); + + rc =hvm_monitor_debug (regs->eip, +HVM_MONITOR_DEBUG_EXCEPTION , + trap_type, insn_len); +xen/arch/x86/hvm/vmx/vmx.c void vmx_vmexit_handler(struct cpu_user_regs *regs) · line 3401
Quoted 10 lines
xen/arch/x86/hvm/vmx/vmx.c +10
-0+/* +* !rc continue normally +* rc > 0 paused waiting for response, work here is done +* rc < 0 error in monitor/vm_event, crash +*/ +if ( !rc ) +vmx_propagate_intr (intr_info); +if ( rc <0 ) + goto exit_and_crash; + }As opposed to earlier versions, here omitting the "else" seems undesirable. Or, perhaps better, simply re-order the two if()-s. This is to make clear that what is now the second
if()does in no way depend on what the body of the current firstif()does.
Quoted 6 lines
The same would then apply to patch 3, and I'd be fine doing the adjustment while committing (provided all necessary acks trickle in). Feel free to add my ack here for the few changes for which that's actually relevant.
Jan
That sounds fine to me. I think this patch only needs Wei's or Ian's ack now for the libxc changes.
Tamas
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v7 2/3] x86/vm_event: Add HVM debug exception vm_events
Quoted 40 lines
Quoted 1 line
Quoted 1 line · On 29.06.16 at 19:26, <[email protected]> wrote:
Quoted 13 lines · Jan Beulich
xen/arch/x86/hvm/vmx/vmx.c void vmx_vmexit_handler(struct cpu_user_regs *regs) · line 3383
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 27.06.16 at 20:08, <[email protected]> wrote:
xen/arch/x86/hvm/vmx/vmx.c +5
-1@@ -3376,7 +3376,29 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)HVMTRACE_1D (TRAP_DEBUG , exit_qualification);write_debugreg (6 , exit_qualification |DR_STATUS_RESERVED_ONE );if ( !v->domain->debugger_attached ) -vmx_propagate_intr (intr_info); + { +unsigned long insn_len =0 ; +int rc; + unsigned long trap_type = MASK_EXTR(intr_info, +
INTR_INFO_INTR_TYPE_MASK);Quoted 24 lines
Quoted 8 lines
xen/arch/x86/hvm/vmx/vmx.c +8
-0+ +if ( trap_type >=X86_EVENTTYPE_SW_INTERRUPT ) +__vmread (VM_EXIT_INSTRUCTION_LEN , &insn_len); + + rc =hvm_monitor_debug (regs->eip, +HVM_MONITOR_DEBUG_EXCEPTION , + trap_type, insn_len); +xen/arch/x86/hvm/vmx/vmx.c void vmx_vmexit_handler(struct cpu_user_regs *regs) · line 3401
Quoted 10 lines
xen/arch/x86/hvm/vmx/vmx.c +10
-0+/* +* !rc continue normally +* rc > 0 paused waiting for response, work here is done +* rc < 0 error in monitor/vm_event, crash +*/ +if ( !rc ) +vmx_propagate_intr (intr_info); +if ( rc <0 ) + goto exit_and_crash; + }As opposed to earlier versions, here omitting the "else" seems undesirable. Or, perhaps better, simply re-order the two if()-s. This is to make clear that what is now the second
if()does in no way depend on what the body of the current firstif()does.
Quoted 7 lines
Quoted 4 lines
The same would then apply to patch 3, and I'd be fine doing the adjustment while committing (provided all necessary acks trickle in). Feel free to add my ack here for the few changes for which that's actually relevant.
That sounds fine to me. I think this patch only needs Wei's or Ian's ack now for the libxc changes.
Indeed.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v7 2/3] x86/vm_event: Add HVM debug exception vm_events
In reply to Tamas K LengyelQuoted 9 lines
From: Tamas K Lengyel [mailto:[email protected]]
Sent: Tuesday, June 28, 2016 2:08 AMSince in-guest debug exceptions are now unconditionally trapped to Xen, adding a hook for
vm_eventsubscribers to tap into this new always-on guest event. We rename along the wayhvm_event_breakpoint_typetohvm_event_typeto better match the various events that can be passed with it. We also introduce the necessarymonitor_opdomctl's to enable subscribing to the events.
Quoted 6 lines
This patch also provides monitor subscribers to int3 events proper access to the instruction length necessary for accurate event-reinjection. Without this subscribers manually have to evaluate if the int3 instruction has any prefix attached which would change the instruction length.
Signed-off-by Tamas K Lengyel <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v7 2/3] x86/vm_event: Add HVM debug exception vm_events
In reply to Tamas K LengyelQuoted 21 lines · Tamas K Lengyel
Since in-guest debug exceptions are now unconditionally trapped to Xen, adding a hook for
vm_eventsubscribers to tap into this new always-on guest event. We rename along the wayhvm_event_breakpoint_typetohvm_event_typeto better match the various events that can be passed with it. We also introduce the necessarymonitor_opdomctl's to enable subscribing to the events.This patch also provides monitor subscribers to int3 events proper access to the instruction length necessary for accurate event-reinjection. Without this subscribers manually have to evaluate if the int3 instruction has any prefix attached which would change the instruction length.
Signed-off-by Tamas K Lengyel <[email protected]>---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: Razvan Cojocaru <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Jun Nakajima <[email protected]>
Cc: Kevin Tian <[email protected]>
Quoted 5 lines
v7: Add rc < 0 clause for crash case in vmx and cosmetic fixes
--- tools/libxc/include/xenctrl.h | 3 +- tools/libxc/xc_monitor.c | 25 +++++++++++++++ tools/tests/xen-access/xen-access.c | 61 ++++++++++++++++++++++++++++++++-----
FAOD I expect HV side committer to take care of this patch.
Wei.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH v7 3/3 x86/vmx: Clean up TRAP_int3 handling
In reply to Tamas K LengyelClean up the handling of TRAP_int3 VMEXITs to conform to the handling of TRAP_debug.
---
Cc: Jun Nakajima <[email protected]>
Cc: Kevin Tian <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
--- xen/arch/x86/hvm/vmx/vmx.c | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-)
xen/arch/x86/hvm/vmx/vmx.c +12 -24
@@ -3402,17 +3402,10 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)else domain_pause_for_debugger ();break ; -case TRAP_int3: - { +case TRAP_int3:HVMTRACE_1D (TRAP , vector); -if ( v->domain->debugger_attached ) +if ( !v->domain->debugger_attached ) { -update_guest_eip ();/* Safe: INT3 */ - v->arch.gdbsx_vcpu_event = TRAP_int3; -domain_pause_for_debugger (); -break ; - } -else {unsigned long insn_len;int rc;
@@ -3423,22 +3416,17 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs) insn_len);if ( !rc ) - { -struct hvm_trap trap = { - .vector = TRAP_int3, - .type =X86_EVENTTYPE_SW_EXCEPTION , - .error_code =HVM_DELIVER_NO_ERROR_CODE , - .insn_len = insn_len - }; -hvm_inject_trap (&trap); -break ; - } -if ( rc >0 ) -break ; +vmx_propagate_intr (intr_info); +if ( rc <0 ) + goto exit_and_crash; } - - goto exit_and_crash; - } +else + { +update_guest_eip ();/* Safe: INT3 */ + v->arch.gdbsx_vcpu_event = TRAP_int3; +domain_pause_for_debugger (); + } +break ;case TRAP_no_device:HVMTRACE_1D (TRAP , vector);vmx_fpu_dirty_intercept ();
Signature · 7 lines
2.8.1 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [PATCH v7 3/3] x86/vmx: Clean up TRAP_int3 handling
Quoted 7 lines
From: Tamas K Lengyel [mailto:[email protected]]
Sent: Tuesday, June 28, 2016 2:08 AMClean up the handling of
TRAP_int3VMEXITs to conform to the handling ofTRAP_debug.Signed-off-by Tamas K Lengyel <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel