Re: [Xen-devel] [PATCH v8 1/6] monitor: rename and relocate vm_event_monitor_traps

2016-07-05 Thread Razvan Cojocaru
On 07/05/16 21:37, Tamas K Lengyel wrote:
> The function vm_event_monitor_traps actually belongs in the monitor subsystem.
> As part of this patch we fix the sync input's type to bool_t to match how
> the callers use it.
> 
> Signed-off-by: Tamas K Lengyel 
> ---
> Cc: Jan Beulich 
> Cc: Andrew Cooper 
> Cc: Razvan Cojocaru 
> ---
>  xen/arch/x86/hvm/monitor.c |  7 ---
>  xen/common/monitor.c   | 44 +++-
>  xen/common/vm_event.c  | 45 -
>  xen/include/xen/monitor.h  |  6 +-
>  xen/include/xen/vm_event.h |  6 --
>  5 files changed, 52 insertions(+), 56 deletions(-)

Acked-by: Razvan Cojocaru 


Thanks,
Razvan

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v8 1/6] monitor: rename and relocate vm_event_monitor_traps

2016-07-05 Thread Tamas K Lengyel
The function vm_event_monitor_traps actually belongs in the monitor subsystem.
As part of this patch we fix the sync input's type to bool_t to match how
the callers use it.

Signed-off-by: Tamas K Lengyel 
---
Cc: Jan Beulich 
Cc: Andrew Cooper 
Cc: Razvan Cojocaru 
---
 xen/arch/x86/hvm/monitor.c |  7 ---
 xen/common/monitor.c   | 44 +++-
 xen/common/vm_event.c  | 45 -
 xen/include/xen/monitor.h  |  6 +-
 xen/include/xen/vm_event.h |  6 --
 5 files changed, 52 insertions(+), 56 deletions(-)

diff --git a/xen/arch/x86/hvm/monitor.c b/xen/arch/x86/hvm/monitor.c
index bbe5952..fb493bb 100644
--- a/xen/arch/x86/hvm/monitor.c
+++ b/xen/arch/x86/hvm/monitor.c
@@ -23,6 +23,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -48,7 +49,7 @@ bool_t hvm_monitor_cr(unsigned int index, unsigned long 
value, unsigned long old
 .u.write_ctrlreg.old_value = old
 };
 
-if ( vm_event_monitor_traps(curr, sync, ) >= 0 )
+if ( monitor_traps(curr, sync, ) >= 0 )
 return 1;
 }
 
@@ -68,7 +69,7 @@ void hvm_monitor_msr(unsigned int msr, uint64_t value)
 .u.mov_to_msr.value = value,
 };
 
-vm_event_monitor_traps(curr, 1, );
+monitor_traps(curr, 1, );
 }
 }
 
@@ -131,7 +132,7 @@ int hvm_monitor_debug(unsigned long rip, enum 
hvm_monitor_debug_type type,
 
 req.vcpu_id = curr->vcpu_id;
 
-return vm_event_monitor_traps(curr, sync, );
+return monitor_traps(curr, sync, );
 }
 
 /*
diff --git a/xen/common/monitor.c b/xen/common/monitor.c
index 436214a..5fce61e 100644
--- a/xen/common/monitor.c
+++ b/xen/common/monitor.c
@@ -19,12 +19,15 @@
  * License along with this program; If not, see .
  */
 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 
 int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *mop)
 {
@@ -85,6 +88,45 @@ int monitor_domctl(struct domain *d, struct 
xen_domctl_monitor_op *mop)
 return 0;
 }
 
+int monitor_traps(struct vcpu *v, bool_t sync, vm_event_request_t *req)
+{
+int rc;
+struct domain *d = v->domain;
+
+rc = vm_event_claim_slot(d, >vm_event->monitor);
+switch ( rc )
+{
+case 0:
+break;
+case -ENOSYS:
+/*
+ * If there was no ring to handle the event, then
+ * simply continue executing normally.
+ */
+return 0;
+default:
+return rc;
+};
+
+if ( sync )
+{
+req->flags |= VM_EVENT_FLAG_VCPU_PAUSED;
+vm_event_vcpu_pause(v);
+rc = 1;
+}
+
+if ( altp2m_active(d) )
+{
+req->flags |= VM_EVENT_FLAG_ALTERNATE_P2M;
+req->altp2m_idx = altp2m_vcpu_idx(v);
+}
+
+vm_event_fill_regs(req);
+vm_event_put_request(d, >vm_event->monitor, req);
+
+return rc;
+}
+
 void monitor_guest_request(void)
 {
 struct vcpu *curr = current;
@@ -97,7 +139,7 @@ void monitor_guest_request(void)
 .vcpu_id = curr->vcpu_id,
 };
 
-vm_event_monitor_traps(curr, d->monitor.guest_request_sync, );
+monitor_traps(curr, d->monitor.guest_request_sync, );
 }
 }
 
diff --git a/xen/common/vm_event.c b/xen/common/vm_event.c
index 17d2716..22bbfc1 100644
--- a/xen/common/vm_event.c
+++ b/xen/common/vm_event.c
@@ -26,7 +26,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -789,50 +788,6 @@ void vm_event_vcpu_unpause(struct vcpu *v)
 }
 
 /*
- * Monitor vm-events
- */
-
-int vm_event_monitor_traps(struct vcpu *v, uint8_t sync,
-   vm_event_request_t *req)
-{
-int rc;
-struct domain *d = v->domain;
-
-rc = vm_event_claim_slot(d, >vm_event->monitor);
-switch ( rc )
-{
-case 0:
-break;
-case -ENOSYS:
-/*
- * If there was no ring to handle the event, then
- * simply continue executing normally.
- */
-return 0;
-default:
-return rc;
-};
-
-if ( sync )
-{
-req->flags |= VM_EVENT_FLAG_VCPU_PAUSED;
-vm_event_vcpu_pause(v);
-rc = 1;
-}
-
-if ( altp2m_active(d) )
-{
-req->flags |= VM_EVENT_FLAG_ALTERNATE_P2M;
-req->altp2m_idx = altp2m_vcpu_idx(v);
-}
-
-vm_event_fill_regs(req);
-vm_event_put_request(d, >vm_event->monitor, req);
-
-return rc;
-}
-
-/*
  * Local variables:
  * mode: C
  * c-file-style: "BSD"
diff --git a/xen/include/xen/monitor.h b/xen/include/xen/monitor.h
index 204d5cc..2171d04 100644
--- a/xen/include/xen/monitor.h
+++ b/xen/include/xen/monitor.h
@@ -3,7 +3,7 @@
  *
  * Common monitor_op domctl handler.
  *
- * Copyright (c) 2015 Tamas K Lengyel (ta...@tklengyel.com)
+ * Copyright (c) 2015-2016 Tamas K Lengyel