xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 1/9] vm_event: clear up return value of vm_event_monitor_traps
@ 2016-06-02 22:52 Tamas K Lengyel
  2016-06-02 22:52 ` [PATCH v5 2/9] monitor: Rename vm_event_monitor_get_capabilities Tamas K Lengyel
                   ` (10 more replies)
  0 siblings, 11 replies; 46+ messages in thread
From: Tamas K Lengyel @ 2016-06-02 22:52 UTC (permalink / raw)
  To: xen-devel
  Cc: Kevin Tian, Tamas K Lengyel, Jun Nakajima, Razvan Cojocaru,
	Andrew Cooper, Jan Beulich

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@tklengyel.com>
---
Cc: Jun Nakajima <jun.nakajima@intel.com>
Cc: Kevin Tian <kevin.tian@intel.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Razvan Cojocaru <rcojocaru@bitdefender.com>
---
 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@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 46+ messages in thread

end of thread, other threads:[~2016-06-24 10:58 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-02 22:52 [PATCH v5 1/9] vm_event: clear up return value of vm_event_monitor_traps Tamas K Lengyel
2016-06-02 22:52 ` [PATCH v5 2/9] monitor: Rename vm_event_monitor_get_capabilities Tamas K Lengyel
2016-06-17 19:07   ` Tamas K Lengyel
2016-06-21  9:20   ` Julien Grall
2016-06-02 22:52 ` [PATCH v5 3/9] monitor: Rename vm_event_monitor_guest_request Tamas K Lengyel
2016-06-17 19:10   ` Tamas K Lengyel
2016-06-21  9:18   ` Julien Grall
2016-06-02 22:52 ` [PATCH v5 4/9] monitor: Rename hvm/event to hvm/monitor Tamas K Lengyel
2016-06-02 22:52 ` [PATCH v5 5/9] monitor: ARM SMC events Tamas K Lengyel
2016-06-03  9:49   ` Julien Grall
2016-06-03 13:40     ` Tamas K Lengyel
2016-06-03 14:43       ` Julien Grall
2016-06-03 15:03         ` Tamas K Lengyel
2016-06-03 15:06           ` Julien Grall
2016-06-03 15:42             ` Tamas K Lengyel
2016-06-03 15:27         ` Tamas K Lengyel
2016-06-03 15:34           ` Tamas K Lengyel
2016-06-04  9:03             ` Edgar E. Iglesias
2016-06-04 17:40               ` Tamas K Lengyel
2016-06-06 10:07                 ` Julien Grall
     [not found]                   ` <CABfawh=tOsUP1dQi9oAZM+iy3rMmCKDW=VByT-L-xYdAMBiMKw@mail.gmail.com>
     [not found]                     ` <CABfawhkSXqky9WWp8NyKEUrH_ZzSJToxAncTeSYeKBg1q63rwg@mail.gmail.com>
2016-06-06 15:24                       ` Tamas K Lengyel
2016-06-06 15:54                         ` Julien Grall
2016-06-06 15:56                           ` Tamas K Lengyel
2016-06-06 16:14                             ` Tamas K Lengyel
2016-06-06 16:38                               ` Julien Grall
2016-06-06 17:28                                 ` Tamas K Lengyel
2016-06-07  7:13                                 ` Jan Beulich
2016-06-07 10:30                                   ` Stefano Stabellini
2016-06-07 16:06                                     ` Tamas K Lengyel
2016-06-02 22:52 ` [PATCH v5 6/9] arm/vm_event: get/set registers Tamas K Lengyel
2016-06-03 10:34   ` Jan Beulich
2016-06-03 19:27     ` Tamas K Lengyel
2016-06-02 22:52 ` [PATCH v5 7/9] tools/libxc: add xc_monitor_privileged_call Tamas K Lengyel
2016-06-02 22:52 ` [PATCH v5 8/9] x86/vm_event: Add HVM debug exception vm_events Tamas K Lengyel
2016-06-03 10:49   ` Jan Beulich
2016-06-03 13:29     ` Tamas K Lengyel
2016-06-03 14:23       ` Jan Beulich
2016-06-03 14:34         ` Tamas K Lengyel
2016-06-03 14:45           ` Jan Beulich
2016-06-03 14:51             ` Tamas K Lengyel
2016-06-02 22:52 ` [PATCH v5 9/9] tools/xen-access: add test-case for ARM SMC Tamas K Lengyel
2016-06-03  7:08 ` [PATCH v5 1/9] vm_event: clear up return value of vm_event_monitor_traps Razvan Cojocaru
2016-06-03 15:54 ` Jan Beulich
2016-06-03 16:03   ` Tamas K Lengyel
2016-06-17 19:09 ` Tamas K Lengyel
2016-06-24 10:58   ` Tian, Kevin

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).