[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH RFC] x86/xen: Return error for xc_hvm_inject_trap() with pending events
xc_hvm_inject_trap() sets v->arch.hvm_vcpu.inject_trap.vector, which is then checked in hvm_do_resume(), and if != -1, a trap is injected, regardless of whether vmx_idtv_reinject() has written VM_ENTRY_INTR_INFO directly. If that's the case, the toolstack injected interrupt will overwrite the reinjected one, which will get lost forever. This patch returns -EBUSY not only if v->arch.hvm_vcpu.inject_trap.vector != -1, but also if hvm_event_pending(v). hvm_event_pending() has also been modified to be able to run on a VCPU which is not current. Signed-off-by: Razvan Cojocaru <rcojocaru@xxxxxxxxxxxxxxx> --- xen/arch/x86/hvm/hvm.c | 2 +- xen/arch/x86/hvm/vmx/vmx.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 704fd64..cf01ae4 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -5938,7 +5938,7 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg) if ( tr.vcpuid >= d->max_vcpus || (v = d->vcpu[tr.vcpuid]) == NULL ) goto injtrap_fail; - if ( v->arch.hvm_vcpu.inject_trap.vector != -1 ) + if ( v->arch.hvm_vcpu.inject_trap.vector != -1 || hvm_event_pending(v) ) rc = -EBUSY; else { diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 9a8f694..f50a593 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -1790,8 +1790,9 @@ static int vmx_event_pending(struct vcpu *v) { unsigned long intr_info; - ASSERT(v == current); + vmx_vmcs_enter(v); __vmread(VM_ENTRY_INTR_INFO, &intr_info); + vmx_vmcs_exit(v); return intr_info & INTR_INFO_VALID_MASK; } -- 1.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |