|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v5 1/9] 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 the notification was not sent, 0 where the notification was sent
and the vCPU is not paused and 1 that the notification was sent and
that the vCPU is paused.
Signed-off-by: Tamas K Lengyel <tamas@xxxxxxxxxxxxx>
---
Cc: Jun Nakajima <jun.nakajima@xxxxxxxxx>
Cc: Kevin Tian <kevin.tian@xxxxxxxxx>
Cc: Jan Beulich <jbeulich@xxxxxxxx>
Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Cc: Razvan Cojocaru <rcojocaru@xxxxxxxxxxxxxxx>
---
xen/arch/x86/hvm/event.c | 4 ++--
xen/arch/x86/hvm/vmx/vmx.c | 6 +++---
xen/common/vm_event.c | 5 +++--
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/xen/arch/x86/hvm/event.c b/xen/arch/x86/hvm/event.c
index 56c5514..5772c6b 100644
--- a/xen/arch/x86/hvm/event.c
+++ b/xen/arch/x86/hvm/event.c
@@ -47,8 +47,8 @@ bool_t hvm_event_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;
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 3acf1ab..097d97c 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -3392,11 +3392,11 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
break;
}
else {
- int handled =
+ int rc =
hvm_event_breakpoint(regs->eip,
HVM_EVENT_SOFTWARE_BREAKPOINT);
- if ( handled < 0 )
+ if ( !rc )
{
struct hvm_trap trap = {
.vector = TRAP_int3,
@@ -3410,7 +3410,7 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
hvm_inject_trap(&trap);
break;
}
- else if ( handled )
+ else if ( rc > 0 )
break;
}
diff --git a/xen/common/vm_event.c b/xen/common/vm_event.c
index 2906407..fe86fb9 100644
--- a/xen/common/vm_event.c
+++ b/xen/common/vm_event.c
@@ -801,7 +801,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;
};
@@ -810,6 +810,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) )
@@ -821,7 +822,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;
}
void vm_event_monitor_guest_request(void)
--
2.8.1
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |