From: Tamas K Lengyel <tamas@tklengyel.com>
To: xen-devel@lists.xenproject.org
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Kevin Tian <kevin.tian@intel.com>,
Tamas K Lengyel <tamas@tklengyel.com>,
Jun Nakajima <jun.nakajima@intel.com>
Subject: [PATCH v6 4/5] vm_event: clear up return value of vm_event_monitor_traps
Date: Thu, 23 Jun 2016 11:07:26 -0600 [thread overview]
Message-ID: <1466701647-21733-4-git-send-email-tamas@tklengyel.com> (raw)
In-Reply-To: <1466701647-21733-1-git-send-email-tamas@tklengyel.com>
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.
Signed-off-by: Tamas K Lengyel <tamas@tklengyel.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
---
Cc: Jun Nakajima <jun.nakajima@intel.com>
Cc: Kevin Tian <kevin.tian@intel.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
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(-)
diff --git a/xen/arch/x86/hvm/monitor.c b/xen/arch/x86/hvm/monitor.c
index f0ab33a..472926c 100644
--- a/xen/arch/x86/hvm/monitor.c
+++ b/xen/arch/x86/hvm/monitor.c
@@ -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;
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index a56926c..03fcba7 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -3388,11 +3388,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,
@@ -3406,7 +3406,7 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
hvm_inject_trap(&trap);
break;
}
- else if ( handled )
+ if ( rc > 0 )
break;
}
diff --git a/xen/common/vm_event.c b/xen/common/vm_event.c
index ca1eced..b303180 100644
--- a/xen/common/vm_event.c
+++ b/xen/common/vm_event.c
@@ -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;
}
/*
--
2.8.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-06-23 17:07 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-23 17:07 [PATCH v6 1/5] monitor: Rename vm_event_monitor_get_capabilities Tamas K Lengyel
2016-06-23 17:07 ` [PATCH v6 2/5] monitor: Rename vm_event_monitor_guest_request Tamas K Lengyel
2016-06-23 17:07 ` [PATCH v6 3/5] monitor: Rename hvm/event to hvm/monitor Tamas K Lengyel
2016-06-23 17:07 ` Tamas K Lengyel [this message]
2016-06-24 10:59 ` [PATCH v6 4/5] vm_event: clear up return value of vm_event_monitor_traps Tian, Kevin
2016-06-23 17:07 ` [PATCH v6 5/5] x86/vm_event: Add HVM debug exception vm_events Tamas K Lengyel
2016-06-24 7:14 ` Jan Beulich
2016-06-24 7:56 ` Razvan Cojocaru
2016-06-24 18:48 ` Tamas K Lengyel
2016-06-24 19:49 ` Razvan Cojocaru
2016-06-24 11:20 ` Tian, Kevin
2016-06-24 11:24 ` Jan Beulich
2016-06-24 16:29 ` Tamas K Lengyel
2016-06-27 7:08 ` Jan Beulich
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=1466701647-21733-4-git-send-email-tamas@tklengyel.com \
--to=tamas@tklengyel.com \
--cc=andrew.cooper3@citrix.com \
--cc=jun.nakajima@intel.com \
--cc=kevin.tian@intel.com \
--cc=xen-devel@lists.xenproject.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).