Skip to contentSkip to conversation

arm/monitor vm-events: Implement guest-request support

PATCH Superseded Corneliu ZUZU 6 participants 34 messages Feb 18, 2016 – Feb 23, 2016

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm/monitor vm-events: Implement guest-request support

This patch adds ARM support for guest-request monitor vm-events.

Summary of changes:
== Moved to common-side:
* XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST handling (moved from X86 arch_monitor_domctl_event to common monitor_domctl)
* hvm_event_guest_request, hvm_event_traps (also added target vcpu as param)
* guest-request bits from X86 'struct arch_domain' (to common 'struct domain')
== ARM implementations:
* do_hvm_op now handling of HVMOP_guest_request_vm_event => calls hvm_event_guest_request (as on X86)
* arch_monitor_get_capabilities: updated to reflect support for XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST
* vm_event_init_domain (does nothing), vm_event_cleanup_domain
== Misc:
* hvm_event_fill_regs renamed to arch_hvm_event_fill_regs, no longer X86-specific. ARM-side implementation of this function currently does nothing, that will be added in a separate patch.

---
 MAINTAINERS                     |   1 +
 xen/arch/arm/hvm.c              |   8 +++
 xen/arch/x86/hvm/event.c        | 116 ++++++----------------------------------
 xen/arch/x86/hvm/hvm.c          |   1 +
 xen/arch/x86/monitor.c          |  14 -----
 xen/arch/x86/vm_event.c         |   1 +
 xen/common/Makefile             |   2 +-
 xen/common/hvm/Makefile         |   3 +-
 xen/common/hvm/event.c          |  96 +++++++++++++++++++++++++++++++++
 xen/common/monitor.c            |  31 +++++++++--
 xen/include/asm-arm/hvm/event.h |  41 ++++++++++++++
 xen/include/asm-arm/monitor.h   |   7 ++-
 xen/include/asm-arm/vm_event.h  |   4 +-
 xen/include/asm-x86/domain.h    |  18 +++----
 xen/include/asm-x86/hvm/event.h |  43 ++++++++++++++-
 xen/include/xen/hvm/event.h     |  41 ++++++++++++++
 xen/include/xen/sched.h         |   6 +++
 17 files changed, 299 insertions(+), 134 deletions(-)
 create mode 100644 xen/common/hvm/event.c
 create mode 100644 xen/include/asm-arm/hvm/event.h
 create mode 100644 xen/include/xen/hvm/event.h
MAINTAINERS +1 -0
index cd4da04..768ad32 100644
@@ -356,6 +356,7 @@ M:	Tamas K Lengyel <[email protected]>
 S:	Supported
 F:	xen/common/vm_event.c
 F:	xen/common/mem_access.c
+F:	xen/common/hvm/event.c
 F:	xen/common/monitor.c
 F:	xen/arch/x86/hvm/event.c
 F:	xen/arch/x86/monitor.c
xen/arch/arm/hvm.c +8 -0
index 056db1a..767edd1 100644
@@ -22,6 +22,7 @@
 #include <xen/errno.h>
 #include <xen/guest_access.h>
 #include <xen/sched.h>
+#include <xen/hvm/event.h>
 
 #include <xsm/xsm.h>
 
@@ -72,6 +73,13 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)
         break;
     }
 
+    case HVMOP_guest_request_vm_event:
+        if ( guest_handle_is_null(arg) )
+            hvm_event_guest_request();
+        else
+            rc = -EINVAL;
+        break;
+
     default:
     {
         gdprintk(XENLOG_DEBUG, "HVMOP op=%lu: not implemented\n", op);
xen/arch/x86/hvm/event.c +17 -99

163 lines not on this page · raw message

xen/arch/x86/hvm/hvm.c +1 -0
index a29c421..11c2ef6 100644
@@ -32,6 +32,7 @@
 #include <xen/guest_access.h>
 #include <xen/event.h>
 #include <xen/paging.h>
+#include <xen/hvm/event.h>
 #include <xen/cpu.h>
 #include <xen/wait.h>
 #include <xen/mem_access.h>
xen/arch/x86/monitor.c +0 -14
index b4bd008..7768cbb 100644
@@ -124,20 +124,6 @@ int arch_monitor_domctl_event(struct domain *d,
         break;
     }
 
-    case XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST:
-    {
-        bool_t old_status = ad->monitor.guest_request_enabled;
-
-        if ( unlikely(old_status == requested_status) )
-            return -EEXIST;
-
-        domain_pause(d);
-        ad->monitor.guest_request_sync = mop->u.guest_request.sync;
-        ad->monitor.guest_request_enabled = requested_status;
-        domain_unpause(d);
-        break;
-    }
-
     default:
         /*
          * Should not be reached unless arch_monitor_get_capabilities() is not
xen/arch/x86/vm_event.c +1 -0
index 08d678a..f97dec3 100644
@@ -57,6 +57,7 @@ void vm_event_cleanup_domain(struct domain *d)
 
     d->arch.mem_access_emulate_each_rep = 0;
     memset(&d->arch.monitor, 0, sizeof(d->arch.monitor));
+    memset(&d->monitor, 0, sizeof(d->monitor));
 }
 
 void vm_event_toggle_singlestep(struct domain *d, struct vcpu *v)
xen/common/Makefile +1 -1
index 0d76efe..703faa5 100644
@@ -67,7 +67,7 @@ obj-$(xenoprof)    += xenoprof.o
 
 obj-$(CONFIG_COMPAT) += $(addprefix compat/,domain.o kernel.o memory.o multicall.o tmem_xen.o xlat.o)
 
-subdir-$(CONFIG_X86) += hvm
+subdir-y += hvm
 
 subdir-$(coverage) += gcov
 
xen/common/hvm/Makefile +2 -1
index a464a57..11e109d 100644
@@ -1 +1,2 @@
-obj-y += save.o
+obj-$(CONFIG_X86) += save.o
+obj-y += event.o
xen/common/hvm/event.c new file +96 -0

96 lines not on this page · raw message

xen/common/monitor.c +28 -3
index 2a99a04..7c3d1c8 100644
@@ -28,6 +28,7 @@
 int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *mop)
 {
     int rc;
+    bool_t requested_status = 0;
 
     if ( unlikely(current->domain == d) ) /* no domain_pause() */
         return -EPERM;
@@ -39,15 +40,16 @@ int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *mop)
     switch ( mop->op )
     {
     case XEN_DOMCTL_MONITOR_OP_ENABLE:
+        requested_status = 1;
+        /* fallthrough */
     case XEN_DOMCTL_MONITOR_OP_DISABLE:
-        /* Check if event type is available. */
         /* sanity check: avoid left-shift undefined behavior */
         if ( unlikely(mop->event > 31) )
             return -EINVAL;
+        /* Check if event type is available. */
         if ( unlikely(!(arch_monitor_get_capabilities(d) & (1U << mop->event))) )
             return -EOPNOTSUPP;
-        /* Arch-side handles enable/disable ops. */
-        return arch_monitor_domctl_event(d, mop);
+        break;
 
     case XEN_DOMCTL_MONITOR_OP_GET_CAPABILITIES:
         mop->event = arch_monitor_get_capabilities(d);
@@ -57,6 +59,29 @@ int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *mop)
         /* The monitor op is probably handled on the arch-side. */
         return arch_monitor_domctl_op(d, mop);
     }
+
+    switch ( mop->event )
+    {
+    case XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST:
+    {
+        bool_t old_status = d->monitor.guest_request_enabled;
+
+        if ( unlikely(old_status == requested_status) )
+            return -EEXIST;
+
+        domain_pause(d);
+        d->monitor.guest_request_sync = mop->u.guest_request.sync;
+        d->monitor.guest_request_enabled = requested_status;
+        domain_unpause(d);
+        break;
+    }
+
+    default:
+        /* Give arch-side the chance to handle this event */
+        return arch_monitor_domctl_event(d, mop);
+    }
+
+    return 0;
 }
 
 /*
xen/include/asm-arm/hvm/event.h new file +41 -0

41 lines not on this page · raw message

xen/include/asm-arm/monitor.h +5 -2
index 82a4a66..db1e357 100644
@@ -27,8 +27,11 @@
 
 static inline uint32_t arch_monitor_get_capabilities(struct domain *d)
 {
-    /* No monitor vm-events implemented on ARM. */
-    return 0;
+    uint32_t capabilities = 0;
+
+    capabilities = (1U << XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST);
+
+    return capabilities;
 }
 
 static inline
xen/include/asm-arm/vm_event.h +2 -2
index 4d0fbf7..017fb6f 100644
@@ -25,14 +25,14 @@
 static inline
 int vm_event_init_domain(struct domain *d)
 {
-    /* Not supported on ARM. */
+    /* Nothing to do. */
     return 0;
 }
 
 static inline
 void vm_event_cleanup_domain(struct domain *d)
 {
-    /* Not supported on ARM. */
+    memset(&d->monitor, 0, sizeof(d->monitor));
 }
 
 static inline
xen/include/asm-x86/domain.h +8 -10
index 4fad638..1de7a9e 100644
@@ -376,17 +376,15 @@ struct arch_domain
     unsigned long *pirq_eoi_map;
     unsigned long pirq_eoi_map_mfn;
 
-    /* Monitor options */
+    /* Arch-specific monitor options */
     struct {
-        unsigned int write_ctrlreg_enabled       : 4;
-        unsigned int write_ctrlreg_sync          : 4;
-        unsigned int write_ctrlreg_onchangeonly  : 4;
-        unsigned int mov_to_msr_enabled          : 1;
-        unsigned int mov_to_msr_extended         : 1;
-        unsigned int singlestep_enabled          : 1;
-        unsigned int software_breakpoint_enabled : 1;
-        unsigned int guest_request_enabled       : 1;
-        unsigned int guest_request_sync          : 1;
+        uint16_t write_ctrlreg_enabled       : 4;
+        uint16_t write_ctrlreg_sync          : 4;
+        uint16_t write_ctrlreg_onchangeonly  : 4;
+        uint16_t mov_to_msr_enabled          : 1;
+        uint16_t mov_to_msr_extended         : 1;
+        uint16_t singlestep_enabled          : 1;
+        uint16_t software_breakpoint_enabled : 1;
     } monitor;
 
     /* Mem_access emulation control */
xen/include/asm-x86/hvm/event.h +41 -2

59 lines not on this page · raw message

xen/include/xen/hvm/event.h new file +41 -0

41 lines not on this page · raw message

xen/include/xen/sched.h +6 -0
index b47a3fe..c2efb49 100644
@@ -464,6 +464,12 @@ struct domain
     /* vNUMA topology accesses are protected by rwlock. */
     rwlock_t vnuma_rwlock;
     struct vnuma_info *vnuma;
+
+    /* Common monitor options */
+    struct {
+        uint8_t guest_request_enabled       : 1;
+        uint8_t guest_request_sync          : 1;
+    } monitor;
 };
 
 /* Protect updates/reads (resp.) of domain_list and domain_hash. */
Signature · 1 line
2.5.0
#1 lore raw
Quoted 18 lines · Corneliu ZUZU

This patch adds ARM support for guest-request monitor vm-events.

Summary of changes:
== Moved to common-side:
* XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST handling (moved from X86 arch_monitor_domctl_event to common monitor_domctl)
* hvm_event_guest_request, hvm_event_traps (also added target vcpu as param)
* guest-request bits from X86 'struct arch_domain' (to common 'struct domain')
== ARM implementations:
* do_hvm_op now handling of HVMOP_guest_request_vm_event => calls hvm_event_guest_request (as on X86)
* arch_monitor_get_capabilities: updated to reflect support for XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST
* vm_event_init_domain (does nothing), vm_event_cleanup_domain
== Misc:
* hvm_event_fill_regs renamed to arch_hvm_event_fill_regs, no longer X86-specific. ARM-side implementation of this function currently does nothing, that will be added in a separate patch.

We should probably take into account what happens with Tamas' "vm_event:
consolidate hvm_event_fill_regs and p2m_vm_event_fill_regs" patch here. That patch already affects hvm_event_fill_regs().

Tamas'll probably chime in with more.

Thanks,
Razvan

#2 lore raw
Quoted 20 lines · Razvan Cojocaru
Quoted 7 lines · Corneliu ZUZU

This patch adds ARM support for guest-request monitor vm-events.

Summary of changes:
== Moved to common-side:
* XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST handling (moved from X86 arch_monitor_domctl_event to common monitor_domctl)
* hvm_event_guest_request, hvm_event_traps (also added target vcpu as

param)

Quoted 1 line

* guest-request bits from X86 'struct arch_domain' (to common 'struct

domain')

Quoted 9 lines

== ARM implementations:
* do_hvm_op now handling of HVMOP_guest_request_vm_event => calls hvm_event_guest_request (as on X86)
* arch_monitor_get_capabilities: updated to reflect support for XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST
* vm_event_init_domain (does nothing), vm_event_cleanup_domain
== Misc:
* hvm_event_fill_regs renamed to arch_hvm_event_fill_regs, no longer X86-specific. ARM-side implementation of this function currently

Quoted 7 lines

does

Quoted 1 line

nothing, that will be added in a separate patch.

We should probably take into account what happens with Tamas' "vm_event:
consolidate hvm_event_fill_regs and p2m_vm_event_fill_regs" patch here. That patch already affects hvm_event_fill_regs().

Well it seems one of us will have to rebase depending which patch gets accepted & merged first. The conflict is minimal so it's not a major issue. If my patch gets merged first then just have to introduce the empty function in the ARM header with the new name.

Tamas

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#3 lore raw
Quoted 35 lines · Tamas K Lengyel

On Thu, Feb 18, 2016 at 1:08 PM, Razvan Cojocaru <[email protected] <mailto:[email protected]>> wrote:

On 02/18/2016 09:35 PM, Corneliu ZUZU wrote:
> This patch adds ARM support for guest-request monitor vm-events. >
> Summary of changes:
> == Moved to common-side:
> * XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST handling (moved from X86
> arch_monitor_domctl_event to common monitor_domctl)
> * hvm_event_guest_request, hvm_event_traps (also added target
vcpu as param)
> * guest-request bits from X86 'struct arch_domain' (to common
'struct domain')
> == ARM implementations:
> * do_hvm_op now handling of HVMOP_guest_request_vm_event => calls
> hvm_event_guest_request (as on X86)
> * arch_monitor_get_capabilities: updated to reflect support for
> XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST
> * vm_event_init_domain (does nothing), vm_event_cleanup_domain
> == Misc:
> * hvm_event_fill_regs renamed to arch_hvm_event_fill_regs, no
longer
> X86-specific. ARM-side implementation of this function
currently does
> nothing, that will be added in a separate patch.

We should probably take into account what happens with Tamas' "vm_event:
consolidate hvm_event_fill_regs and p2m_vm_event_fill_regs" patch here.
That patch already affects hvm_event_fill_regs().

Quoted 4 lines

Well it seems one of us will have to rebase depending which patch gets accepted & merged first. The conflict is minimal so it's not a major issue. If my patch gets merged first then just have to introduce the empty function in the ARM header with the new name.

Tamas

Okay then, for me it's fine either way.

Corneliu.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#4 lore raw
In reply to Corneliu ZUZU

MAINTAINERS M: Tamas K Lengyel <[email protected]> · line 362

Quoted 12 lines · Corneliu ZUZU
MAINTAINERS +1 -0
index cd4da04..768ad32 100644
@@ -356,6 +356,7 @@ M:	Tamas K Lengyel <[email protected]>
 S:	Supported
 F:	xen/common/vm_event.c
 F:	xen/common/mem_access.c
+F:	xen/common/hvm/event.c
 F:	xen/common/monitor.c
 F:	xen/arch/x86/hvm/event.c
 F:	xen/arch/x86/monitor.c

This needs an Ack from Tamas or Razvan

Quoted 101 lines
xen/arch/arm/hvm.c +8 -0
index 056db1a..767edd1 100644
@@ -22,6 +22,7 @@
 #include <xen/errno.h>
 #include <xen/guest_access.h>
 #include <xen/sched.h>
+#include <xen/hvm/event.h>
 
 #include <xsm/xsm.h>
 
@@ -72,6 +73,13 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)
         break;
     }
 
+    case HVMOP_guest_request_vm_event:
+        if ( guest_handle_is_null(arg) )
+            hvm_event_guest_request();
+        else
+            rc = -EINVAL;
+        break;
+
     default:
     {
         gdprintk(XENLOG_DEBUG, "HVMOP op=%lu: not implemented\n", op);
xen/common/Makefile +1 -1
index 0d76efe..703faa5 100644
@@ -67,7 +67,7 @@ obj-$(xenoprof)    += xenoprof.o
 
 obj-$(CONFIG_COMPAT) += $(addprefix compat/,domain.o kernel.o memory.o multicall.o tmem_xen.o xlat.o)
 
-subdir-$(CONFIG_X86) += hvm
+subdir-y += hvm
 
 subdir-$(coverage) += gcov
 
xen/common/hvm/Makefile +2 -1
index a464a57..11e109d 100644
@@ -1 +1,2 @@
-obj-y += save.o
+obj-$(CONFIG_X86) += save.o
+obj-y += event.o
xen/common/hvm/event.c new file +48 -0
new file mode 100644
index 0000000..28ceadc
@@ -0,0 +1,96 @@
+/*
+ * xen/common/hvm/event.c
+ *
+ * Common hardware virtual machine event abstractions.
+ *
+ * Copyright (c) 2004, Intel Corporation.
+ * Copyright (c) 2005, International Business Machines Corporation.
+ * Copyright (c) 2008, Citrix Systems, Inc.
+ * Copyright (c) 2016, Bitdefender S.R.L.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <xen/hvm/event.h>
+#include <xen/vm_event.h>
+#include <asm/hvm/event.h>
+#if CONFIG_X86
+#include <asm/altp2m.h>
+#endif
+
+int hvm_event_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, &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 1;
+    default:
+        return rc;

xen/common/hvm/event.c line 58

Quoted 10 lines
xen/common/hvm/event.c new file +10 -0
+    };
+
+    if ( sync )
+    {
+        req->flags |= VM_EVENT_FLAG_VCPU_PAUSED;
+        vm_event_vcpu_pause(v);
+    }
+
+#if CONFIG_X86
+    if ( altp2m_active(d) )

I would rather

#define altp2m_active(d) (0)

on ARM, removing the two ifdefs in this file.

Quoted 38 lines
xen/common/hvm/event.c new file +38 -0
+    {
+        req->flags |= VM_EVENT_FLAG_ALTERNATE_P2M;
+        req->altp2m_idx = vcpu_altp2m(v).p2midx;
+    }
+#endif
+
+    arch_hvm_event_fill_regs(req);
+
+    vm_event_put_request(d, &d->vm_event->monitor, req);
+
+    return 1;
+}
+
+void hvm_event_guest_request(void)
+{
+    struct vcpu *curr = current;
+    struct domain *d = curr->domain;
+
+    if ( d->monitor.guest_request_enabled )
+    {
+        vm_event_request_t req = {
+            .reason = VM_EVENT_REASON_GUEST_REQUEST,
+            .vcpu_id = curr->vcpu_id,
+        };
+
+        hvm_event_traps(curr, d->monitor.guest_request_sync, &req);
+    }
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
#5 lore raw
Quoted 15 lines · Stefano Stabellini

MAINTAINERS M: Tamas K Lengyel <[email protected]> · line 362

Quoted 12 lines · Corneliu ZUZU
MAINTAINERS +1 -0
index cd4da04..768ad32 100644
@@ -356,6 +356,7 @@ M:	Tamas K Lengyel <[email protected]>
 S:	Supported
 F:	xen/common/vm_event.c
 F:	xen/common/mem_access.c
+F:	xen/common/hvm/event.c
 F:	xen/common/monitor.c
 F:	xen/arch/x86/hvm/event.c
 F:	xen/arch/x86/monitor.c

This needs an Ack from Tamas or Razvan

The MAINTAINERS change is fine with me. Unless Tamas has an issue with it (which he most likely doesn't), it should be fine.

Quoted 114 lines
Quoted 101 lines
xen/arch/arm/hvm.c +8 -0
index 056db1a..767edd1 100644
@@ -22,6 +22,7 @@
 #include <xen/errno.h>
 #include <xen/guest_access.h>
 #include <xen/sched.h>
+#include <xen/hvm/event.h>
 
 #include <xsm/xsm.h>
 
@@ -72,6 +73,13 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)
         break;
     }
 
+    case HVMOP_guest_request_vm_event:
+        if ( guest_handle_is_null(arg) )
+            hvm_event_guest_request();
+        else
+            rc = -EINVAL;
+        break;
+
     default:
     {
         gdprintk(XENLOG_DEBUG, "HVMOP op=%lu: not implemented\n", op);
xen/common/Makefile +1 -1
index 0d76efe..703faa5 100644
@@ -67,7 +67,7 @@ obj-$(xenoprof)    += xenoprof.o
 
 obj-$(CONFIG_COMPAT) += $(addprefix compat/,domain.o kernel.o memory.o multicall.o tmem_xen.o xlat.o)
 
-subdir-$(CONFIG_X86) += hvm
+subdir-y += hvm
 
 subdir-$(coverage) += gcov
 
xen/common/hvm/Makefile +2 -1
index a464a57..11e109d 100644
@@ -1 +1,2 @@
-obj-y += save.o
+obj-$(CONFIG_X86) += save.o
+obj-y += event.o
xen/common/hvm/event.c new file +48 -0
new file mode 100644
index 0000000..28ceadc
@@ -0,0 +1,96 @@
+/*
+ * xen/common/hvm/event.c
+ *
+ * Common hardware virtual machine event abstractions.
+ *
+ * Copyright (c) 2004, Intel Corporation.
+ * Copyright (c) 2005, International Business Machines Corporation.
+ * Copyright (c) 2008, Citrix Systems, Inc.
+ * Copyright (c) 2016, Bitdefender S.R.L.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <xen/hvm/event.h>
+#include <xen/vm_event.h>
+#include <asm/hvm/event.h>
+#if CONFIG_X86
+#include <asm/altp2m.h>
+#endif
+
+int hvm_event_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, &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 1;
+    default:
+        return rc;

xen/common/hvm/event.c line 58

Quoted 10 lines
xen/common/hvm/event.c new file +10 -0
+    };
+
+    if ( sync )
+    {
+        req->flags |= VM_EVENT_FLAG_VCPU_PAUSED;
+        vm_event_vcpu_pause(v);
+    }
+
+#if CONFIG_X86
+    if ( altp2m_active(d) )

I would rather

Quoted 3 lines

#define altp2m_active(d) (0)

on ARM, removing the two ifdefs in this file.

I second that, not a big fan of the #ifdefs.

Thanks,
Razvan

#6 lore raw
In reply to Stefano Stabellini
Quoted 12 lines · Stefano Stabellini

xen/common/hvm/event.c line 58

Quoted 9 lines · Corneliu ZUZU
xen/common/hvm/event.c new file +9 -0
+
+    if ( sync )
+    {
+        req->flags |= VM_EVENT_FLAG_VCPU_PAUSED;
+        vm_event_vcpu_pause(v);
+    }
+
+#if CONFIG_X86
+    if ( altp2m_active(d) )

I would rather

Quoted 3 lines

#define altp2m_active(d) (0)

on ARM, removing the two ifdefs in this file.

Yeah, I actually wanted to get rid of that too at some point, the question is, what do I do with "req->altp2m_idx = vcpu_altp2m(v).p2midx"? I'm not familiar w/ altp2m design, maybe someone that knows more of the internals of that can give a suggestion.

Thanks,
Corneliu.

#7 lore raw
Quoted 13 lines · Corneliu ZUZU
Quoted 12 lines · Stefano Stabellini

xen/common/hvm/event.c line 58

Quoted 9 lines · Corneliu ZUZU
xen/common/hvm/event.c new file +9 -0
+
+    if ( sync )
+    {
+        req->flags |= VM_EVENT_FLAG_VCPU_PAUSED;
+        vm_event_vcpu_pause(v);
+    }
+
+#if CONFIG_X86
+    if ( altp2m_active(d) )

I would rather

Quoted 8 lines
Quoted 3 lines

#define altp2m_active(d) (0)

on ARM, removing the two ifdefs in this file.

Yeah, I actually wanted to get rid of that too at some point, the question is, what do I do with "req->altp2m_idx = vcpu_altp2m(v).p2midx"? I'm not familiar w/ altp2m design, maybe someone that knows more of the internals of that can give a suggestion.

If you #define altp2m_active to (0), gcc will automatically avoid the if statement.

#8 lore raw
Quoted 16 lines · Stefano Stabellini
Quoted 15 lines · Corneliu ZUZU
Quoted 14 lines · Stefano Stabellini

xen/common/hvm/event.c line 58

Quoted 9 lines · Corneliu ZUZU
xen/common/hvm/event.c new file +9 -0
+
+    if ( sync )
+    {
+        req->flags |= VM_EVENT_FLAG_VCPU_PAUSED;
+        vm_event_vcpu_pause(v);
+    }
+
+#if CONFIG_X86
+    if ( altp2m_active(d) )

I would rather

#define altp2m_active(d) (0)

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

on ARM, removing the two ifdefs in this file.

Yeah, I actually wanted to get rid of that too at some point, the question is, what do I do with "req->altp2m_idx = vcpu_altp2m(v).p2midx"? I'm not familiar w/ altp2m design, maybe someone that knows more of the internals of that can give a suggestion.

If you #define altp2m_active to (0), gcc will automatically avoid the if statement.

You will still get the compile error from ARM's struct vcpu not having altp2m information.

~Andrew

#9 lore raw
Quoted 22 lines · Andrew Cooper
Quoted 21 lines · Stefano Stabellini
Quoted 20 lines · Corneliu ZUZU
Quoted 12 lines · Stefano Stabellini

xen/common/hvm/event.c line 58

Quoted 9 lines · Corneliu ZUZU
xen/common/hvm/event.c new file +9 -0
+
+    if ( sync )
+    {
+        req->flags |= VM_EVENT_FLAG_VCPU_PAUSED;
+        vm_event_vcpu_pause(v);
+    }
+
+#if CONFIG_X86
+    if ( altp2m_active(d) )

I would rather

Quoted 3 lines

#define altp2m_active(d) (0)

on ARM, removing the two ifdefs in this file.

Yeah, I actually wanted to get rid of that too at some point, the question is, what do I do with "req->altp2m_idx = vcpu_altp2m(v).p2midx"? I'm not familiar w/ altp2m design, maybe someone that knows more of the internals of that can give a suggestion.

Quoted 7 lines
Quoted 2 lines

If you #define altp2m_active to (0), gcc will automatically avoid the if statement.

You will still get the compile error from ARM's struct vcpu not having altp2m information.

~Andrew

Yep.

Corneliu.

#10 lore raw
Quoted 28 lines · Corneliu ZUZU
Quoted 27 lines · Andrew Cooper
Quoted 26 lines · Stefano Stabellini
Quoted 15 lines · Corneliu ZUZU
Quoted 14 lines · Stefano Stabellini

xen/common/hvm/event.c line 58

Quoted 9 lines · Corneliu ZUZU
xen/common/hvm/event.c new file +9 -0
+
+    if ( sync )
+    {
+        req->flags |= VM_EVENT_FLAG_VCPU_PAUSED;
+        vm_event_vcpu_pause(v);
+    }
+
+#if CONFIG_X86
+    if ( altp2m_active(d) )

I would rather

#define altp2m_active(d) (0)

Quoted 8 lines
Quoted 1 line

on ARM, removing the two ifdefs in this file.

Yeah, I actually wanted to get rid of that too at some point, the question is,
what do I do with "req->altp2m_idx = vcpu_altp2m(v).p2midx"? I'm not familiar
w/ altp2m design, maybe someone that knows more of the internals of that can
give a suggestion.

If you #define altp2m_active to (0), gcc will automatically avoid the if statement.

Quoted 7 lines
Quoted 5 lines

You will still get the compile error from ARM's struct vcpu not having altp2m information.

~Andrew

Yep.

Yes, you are right, especially given that Xen is compiled -Wall -Werror.

How do you plan to introduce altp2m support on ARM? Is there going to be a struct altp2mvcpu on ARM too? It is not nice to access stuff under v->arch from common code. Maybe we need another arch_blah function to set altp2m_idx.

#11 lore raw
Quoted 38 lines · Stefano Stabellini
Quoted 16 lines · Corneliu ZUZU
Quoted 15 lines · Andrew Cooper
Quoted 14 lines · Stefano Stabellini
Quoted 13 lines · Corneliu ZUZU
Quoted 12 lines · Stefano Stabellini

Review

Quoted 9 lines · Corneliu ZUZU
(quoted diff) +9 -0
+
+    if ( sync )
+    {
+        req->flags |= VM_EVENT_FLAG_VCPU_PAUSED;
+        vm_event_vcpu_pause(v);
+    }
+
+#if CONFIG_X86
+    if ( altp2m_active(d) )

I would rather

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

#define altp2m_active(d) (0)

on ARM, removing the two ifdefs in this file.

Yeah, I actually wanted to get rid of that too at some point, the question is,
what do I do with "req->altp2m_idx = vcpu_altp2m(v).p2midx"? I'm

not

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

familiar
w/ altp2m design, maybe someone that knows more of the internals

of that

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines

can
give a suggestion.

If you #define altp2m_active to (0), gcc will automatically avoid

the if

Quoted 7 lines
Quoted 6 lines
Quoted 1 line

statement.

You will still get the compile error from ARM's struct vcpu not having altp2m information.

~Andrew

Quoted 9 lines
Quoted 1 line

Yep.

Yes, you are right, especially given that Xen is compiled -Wall -Werror.

How do you plan to introduce altp2m support on ARM? Is there going to be a struct altp2mvcpu on ARM too? It is not nice to access stuff under v->arch from common code. Maybe we need another arch_blah function to set altp2m_idx.

As altp2m could be implemented for ARM as well it might make sense to start introducing bits and pieces that would make it easier to do that work in the future. But I agree, accessing v->arch directly from common is not a good way to go about it.

Tamas

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#12 lore raw
Quoted 56 lines · Tamas K Lengyel

On Fri, Feb 19, 2016 at 10:47 AM, Stefano Stabellini <[email protected] <mailto:[email protected]>> wrote:

    On Fri, 19 Feb 2016, Corneliu ZUZU wrote:
    > On 2/19/2016 6:05 PM, Andrew Cooper wrote:
    > > On 19/02/16 16:00, Stefano Stabellini wrote:
    > > > On Fri, 19 Feb 2016, Corneliu ZUZU wrote:
    > > > > On 2/19/2016 3:49 PM, Stefano Stabellini wrote:
    > > > > > On Thu, 18 Feb 2016, Corneliu ZUZU wrote:
    > > > > > > +
    > > > > > > +    if ( sync )
    > > > > > > +    {
    > > > > > > +        req->flags |= VM_EVENT_FLAG_VCPU_PAUSED;
    > > > > > > + vm_event_vcpu_pause(v);
    > > > > > > +    }
    > > > > > > +
    > > > > > > +#if CONFIG_X86
    > > > > > > +    if ( altp2m_active(d) )
    > > > > > I would rather
    > > > > >
    > > > > > #define altp2m_active(d) (0)
    > > > > >
    > > > > > on ARM, removing the two ifdefs in this file.
    > > > > Yeah, I actually wanted to get rid of that too at some
    point, the
    > > > > question is,
    > > > > what do I do with "req->altp2m_idx =
    vcpu_altp2m(v).p2midx"? I'm not
    > > > > familiar
    > > > > w/ altp2m design, maybe someone that knows more of the
    internals of that
    > > > > can
    > > > > give a suggestion.
    > > > If you #define altp2m_active to (0), gcc will automatically
    avoid the if
    > > > statement.
    > > You will still get the compile error from ARM's struct vcpu
    not having
    > > altp2m information.
    > >
    > > ~Andrew
    > >
    >
    > Yep.

    Yes, you are right, especially given that Xen is compiled -Wall
    -Werror.

    How do you plan to introduce altp2m support on ARM? Is there going
    to be
    a struct altp2mvcpu on ARM too? It is not nice to access stuff under
    v->arch from common code. Maybe we need another arch_blah function to
    set altp2m_idx.
Quoted 3 lines

As altp2m could be implemented for ARM as well it might make sense to start introducing bits and pieces that would make it easier to do that work in the future. But I agree, accessing v->arch directly from common is not a good way to go about it.

Tamas

I am not at all familiar w/ altp2m at the moment, but I'll try to look into it.
Since that doesn't relate so much with the code motion of this changeset and it might not be that straightforward to implement, would it be ok to leave the #ifdef CONFIG_X86 there for now and remove it in a separate patch?

Corneliu.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#13 lore raw
Quoted 60 lines · Corneliu ZUZU

On 2/19/2016 7:54 PM, Tamas K Lengyel wrote:

Quoted 38 lines · On Fri, Feb 19, 2016 at 10:47 AM, Stefano Stabellini <…
Quoted 16 lines · Corneliu ZUZU
Quoted 15 lines · Andrew Cooper
Quoted 14 lines · Stefano Stabellini
Quoted 13 lines · Corneliu ZUZU
Quoted 12 lines · Stefano Stabellini

Review

Quoted 9 lines · Corneliu ZUZU
(quoted diff) +9 -0
+
+    if ( sync )
+    {
+        req->flags |= VM_EVENT_FLAG_VCPU_PAUSED;
+        vm_event_vcpu_pause(v);
+    }
+
+#if CONFIG_X86
+    if ( altp2m_active(d) )

I would rather

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

#define altp2m_active(d) (0)

on ARM, removing the two ifdefs in this file.

Yeah, I actually wanted to get rid of that too at some point, the question is,
what do I do with "req->altp2m_idx = vcpu_altp2m(v).p2midx"? I'm

not

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

familiar
w/ altp2m design, maybe someone that knows more of the internals

of that

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines

can
give a suggestion.

If you #define altp2m_active to (0), gcc will automatically avoid

the if

Quoted 7 lines
Quoted 6 lines
Quoted 1 line

statement.

You will still get the compile error from ARM's struct vcpu not having altp2m information.

~Andrew

Quoted 9 lines
Quoted 1 line

Yep.

Yes, you are right, especially given that Xen is compiled -Wall -Werror.

How do you plan to introduce altp2m support on ARM? Is there going to be a struct altp2mvcpu on ARM too? It is not nice to access stuff under v->arch from common code. Maybe we need another arch_blah function to set altp2m_idx.

As altp2m could be implemented for ARM as well it might make sense to start introducing bits and pieces that would make it easier to do that work in the future. But I agree, accessing v->arch directly from common is not a good way to go about it.

Quoted 9 lines

Tamas

I am not at all familiar w/ altp2m at the moment, but I'll try to look into it.
Since that doesn't relate so much with the code motion of this changeset and it might not be that straightforward to implement, would it be ok to leave the #ifdef CONFIG_X86 there for now and remove it in a separate patch?

We are trying to avoid having to do ifdefs where-ever possible. So in this case too introducing arch-specific function(s) that are empty for ARM would be more appropriate.

Tamas

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#14 lore raw
Quoted 80 lines · Tamas K Lengyel

On Fri, Feb 19, 2016 at 11:11 AM, Corneliu ZUZU <[email protected] <mailto:[email protected]>> wrote:

    On 2/19/2016 7:54 PM, Tamas K Lengyel wrote:
Quoted 60 lines

    On Fri, Feb 19, 2016 at 10:47 AM, Stefano Stabellini
    <[email protected]
    <mailto:[email protected]>> wrote:

        On Fri, 19 Feb 2016, Corneliu ZUZU wrote:
        > On 2/19/2016 6:05 PM, Andrew Cooper wrote:
        > > On 19/02/16 16:00, Stefano Stabellini wrote:
        > > > On Fri, 19 Feb 2016, Corneliu ZUZU wrote:
        > > > > On 2/19/2016 3:49 PM, Stefano Stabellini wrote:
        > > > > > On Thu, 18 Feb 2016, Corneliu ZUZU wrote:
        > > > > > > +
        > > > > > > +    if ( sync )
        > > > > > > +    {
        > > > > > > + req->flags |= VM_EVENT_FLAG_VCPU_PAUSED;
        > > > > > > + vm_event_vcpu_pause(v);
        > > > > > > +    }
        > > > > > > +
        > > > > > > +#if CONFIG_X86
        > > > > > > +    if ( altp2m_active(d) )
        > > > > > I would rather
        > > > > >
        > > > > > #define altp2m_active(d) (0)
        > > > > >
        > > > > > on ARM, removing the two ifdefs in this file.
        > > > > Yeah, I actually wanted to get rid of that too at
        some point, the
        > > > > question is,
        > > > > what do I do with "req->altp2m_idx =
        vcpu_altp2m(v).p2midx"? I'm not
        > > > > familiar
        > > > > w/ altp2m design, maybe someone that knows more of
        the internals of that
        > > > > can
        > > > > give a suggestion.
        > > > If you #define altp2m_active to (0), gcc will
        automatically avoid the if
        > > > statement.
        > > You will still get the compile error from ARM's struct
        vcpu not having
        > > altp2m information.
        > >
        > > ~Andrew
        > >
        >
        > Yep.

        Yes, you are right, especially given that Xen is compiled
        -Wall -Werror.

        How do you plan to introduce altp2m support on ARM? Is there
        going to be
        a struct altp2mvcpu on ARM too? It is not nice to access
        stuff under
        v->arch from common code. Maybe we need another arch_blah
        function to
        set altp2m_idx.
Quoted 6 lines
    As altp2m could be implemented for ARM as well it might make
    sense to start introducing bits and pieces that would make it
    easier to do that work in the future. But I agree, accessing
    v->arch directly from common is not a good way to go about it.

    Tamas

I am not at all familiar w/ altp2m at the moment, but I'll try to look into it.
Since that doesn't relate so much with the code motion of this changeset and it might not be that straightforward to implement, would it be ok to leave the #ifdef CONFIG_X86 there for now and remove it in a separate patch?

Quoted 4 lines

We are trying to avoid having to do ifdefs where-ever possible. So in this case too introducing arch-specific function(s) that are empty for ARM would be more appropriate.

Tamas

I understand that, I was merely asking if it would be okay to do it in another patch, because it didn't seem that straightforward. More concretely, are you suggesting to:
* do the "#define altp2m_active(d) (0)" as Stefano suggested
* incorporate "vcpu_altp2m(v).p2midx" into an arch_foo function
?

That seems easy enough to do. If so, how should I call this arch_foo function and where would it be appropriate to put it?

Thanks,
Corneliu.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#15 lore raw
Quoted 82 lines · Corneliu ZUZU

On 2/19/2016 8:27 PM, Tamas K Lengyel wrote:

Quoted 61 lines · Corneliu ZUZU

On 2/19/2016 7:54 PM, Tamas K Lengyel wrote:

Quoted 39 lines · Stefano Stabellini
Quoted 16 lines · Corneliu ZUZU
Quoted 15 lines · Andrew Cooper
Quoted 14 lines · Stefano Stabellini
Quoted 13 lines · Corneliu ZUZU
Quoted 12 lines · Stefano Stabellini

Review

Quoted 9 lines · Corneliu ZUZU
(quoted diff) +9 -0
+
+    if ( sync )
+    {
+        req->flags |= VM_EVENT_FLAG_VCPU_PAUSED;
+        vm_event_vcpu_pause(v);
+    }
+
+#if CONFIG_X86
+    if ( altp2m_active(d) )

I would rather

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

#define altp2m_active(d) (0)

on ARM, removing the two ifdefs in this file.

Yeah, I actually wanted to get rid of that too at some point, the question is,
what do I do with "req->altp2m_idx = vcpu_altp2m(v).p2midx"? I'm

not

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

familiar
w/ altp2m design, maybe someone that knows more of the internals

of that

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines

can
give a suggestion.

If you #define altp2m_active to (0), gcc will automatically avoid

the if

Quoted 2 lines
Quoted 2 lines
Quoted 1 line

statement.

You will still get the compile error from ARM's struct vcpu not

having

Quoted 5 lines
Quoted 4 lines

altp2m information.

~Andrew

Quoted 9 lines
Quoted 1 line

Yep.

Yes, you are right, especially given that Xen is compiled -Wall -Werror.

How do you plan to introduce altp2m support on ARM? Is there going to be a struct altp2mvcpu on ARM too? It is not nice to access stuff under v->arch from common code. Maybe we need another arch_blah function to set altp2m_idx.

As altp2m could be implemented for ARM as well it might make sense to start introducing bits and pieces that would make it easier to do that work in the future. But I agree, accessing v->arch directly from common is not a good way to go about it.

Quoted 9 lines

Tamas

I am not at all familiar w/ altp2m at the moment, but I'll try to look into it.
Since that doesn't relate so much with the code motion of this changeset and it might not be that straightforward to implement, would it be ok to leave the #ifdef CONFIG_X86 there for now and remove it in a separate patch?

We are trying to avoid having to do ifdefs where-ever possible. So in this case too introducing arch-specific function(s) that are empty for ARM would be more appropriate.

Quoted 8 lines

Tamas

I understand that, I was merely asking if it would be okay to do it in another patch, because it didn't seem that straightforward. More concretely, are you suggesting to:
* do the "#define altp2m_active(d) (0)" as Stefano suggested

That is easy enough to implement so go with that.

Quoted 2 lines

* incorporate "vcpu_altp2m(v).p2midx" into an arch_foo function

Implement an arch-specific function for this, say p2m_get_vcpu_altp2m_idx(v) which would just return 0 on ARM for now.

Tamas

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#16 lore raw
Quoted 100 lines · Tamas K Lengyel

On Fri, Feb 19, 2016 at 11:33 AM, Corneliu ZUZU <[email protected] <mailto:[email protected]>> wrote:

    On 2/19/2016 8:27 PM, Tamas K Lengyel wrote:
Quoted 82 lines

    On Fri, Feb 19, 2016 at 11:11 AM, Corneliu ZUZU
    <[email protected] <mailto:[email protected]>> wrote:

        On 2/19/2016 7:54 PM, Tamas K Lengyel wrote:
Quoted 60 lines

        On Fri, Feb 19, 2016 at 10:47 AM, Stefano Stabellini
        <[email protected]
        <mailto:[email protected]>> wrote:

            On Fri, 19 Feb 2016, Corneliu ZUZU wrote:
            > On 2/19/2016 6:05 PM, Andrew Cooper wrote:
            > > On 19/02/16 16:00, Stefano Stabellini wrote:
            > > > On Fri, 19 Feb 2016, Corneliu ZUZU wrote:
            > > > > On 2/19/2016 3:49 PM, Stefano Stabellini wrote:
            > > > > > On Thu, 18 Feb 2016, Corneliu ZUZU wrote:
            > > > > > > +
            > > > > > > +    if ( sync )
            > > > > > > +    {
            > > > > > > + req->flags |= VM_EVENT_FLAG_VCPU_PAUSED;
            > > > > > > + vm_event_vcpu_pause(v);
            > > > > > > +    }
            > > > > > > +
            > > > > > > +#if CONFIG_X86
            > > > > > > +    if ( altp2m_active(d) )
            > > > > > I would rather
            > > > > >
            > > > > > #define altp2m_active(d) (0)
            > > > > >
            > > > > > on ARM, removing the two ifdefs in this file.
            > > > > Yeah, I actually wanted to get rid of that too
            at some point, the
            > > > > question is,
            > > > > what do I do with "req->altp2m_idx =
            vcpu_altp2m(v).p2midx"? I'm not
            > > > > familiar
            > > > > w/ altp2m design, maybe someone that knows more
            of the internals of that
            > > > > can
            > > > > give a suggestion.
            > > > If you #define altp2m_active to (0), gcc will
            automatically avoid the if
            > > > statement.
            > > You will still get the compile error from ARM's
            struct vcpu not having
            > > altp2m information.
            > >
            > > ~Andrew
            > >
            >
            > Yep.

            Yes, you are right, especially given that Xen is
            compiled -Wall -Werror.

            How do you plan to introduce altp2m support on ARM? Is
            there going to be
            a struct altp2mvcpu on ARM too? It is not nice to access
            stuff under
            v->arch from common code. Maybe we need another
            arch_blah function to
            set altp2m_idx.
Quoted 7 lines
        As altp2m could be implemented for ARM as well it might make
        sense to start introducing bits and pieces that would make
        it easier to do that work in the future. But I agree,
        accessing v->arch directly from common is not a good way to
        go about it.

        Tamas

I am not at all familiar w/ altp2m at the moment, but I'll try to look into it.
Since that doesn't relate so much with the code motion of this changeset and it might not be that straightforward to implement, would it be ok to leave the #ifdef CONFIG_X86 there for now and remove it in a separate patch?

Quoted 6 lines

We are trying to avoid having to do ifdefs where-ever possible. So in this case too introducing arch-specific function(s) that are empty for ARM would be more appropriate.

Tamas

I understand that, I was merely asking if it would be okay to do it in another patch, because it didn't seem that straightforward. More concretely, are you suggesting to:
* do the "#define altp2m_active(d) (0)" as Stefano suggested

Quoted 9 lines

That is easy enough to implement so go with that.

* incorporate "vcpu_altp2m(v).p2midx" into an arch_foo function

Implement an arch-specific function for this, say p2m_get_vcpu_altp2m_idx(v) which would just return 0 on ARM for now.

Tamas

Got it.

Corneliu.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#17 lore raw
In reply to Corneliu ZUZU
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 18.02.16 at 20:35, <[email protected]> wrote:
---
 MAINTAINERS                     |   1 +
 xen/arch/arm/hvm.c              |   8 +++
 xen/arch/x86/hvm/event.c        | 116 ++++++----------------------------------
 xen/arch/x86/hvm/hvm.c          |   1 +
 xen/arch/x86/monitor.c          |  14 -----
 xen/arch/x86/vm_event.c         |   1 +
 xen/common/Makefile             |   2 +-
 xen/common/hvm/Makefile         |   3 +-
 xen/common/hvm/event.c          |  96 +++++++++++++++++++++++++++++++++

So here you _again_ try to introduce something HVM-ish for ARM. Why? Why can't this code live in common/vm_event.c?

Quoted 16 lines
xen/include/asm-x86/domain.h +1 -8
@@ -376,17 +376,15 @@ struct arch_domain
     unsigned long *pirq_eoi_map;
     unsigned long pirq_eoi_map_mfn;
 
-    /* Monitor options */
+    /* Arch-specific monitor options */
     struct {
-        unsigned int write_ctrlreg_enabled       : 4;
-        unsigned int write_ctrlreg_sync          : 4;
-        unsigned int write_ctrlreg_onchangeonly  : 4;
-        unsigned int mov_to_msr_enabled          : 1;
-        unsigned int mov_to_msr_extended         : 1;
-        unsigned int singlestep_enabled          : 1;
-        unsigned int software_breakpoint_enabled : 1;

xen/include/asm-x86/domain.h struct arch_domain · line 388

Quoted 10 lines
xen/include/asm-x86/domain.h +7 -2
-        unsigned int guest_request_enabled       : 1;
-        unsigned int guest_request_sync          : 1;
+        uint16_t write_ctrlreg_enabled       : 4;
+        uint16_t write_ctrlreg_sync          : 4;
+        uint16_t write_ctrlreg_onchangeonly  : 4;
+        uint16_t mov_to_msr_enabled          : 1;
+        uint16_t mov_to_msr_extended         : 1;
+        uint16_t singlestep_enabled          : 1;
+        uint16_t software_breakpoint_enabled : 1;
     } monitor;

What is this type change supposed to achieve in general, and in particular in the context of this patch?

xen/include/asm-x86/hvm/event.h line 6

Quoted 10 lines
xen/include/asm-x86/hvm/event.h +5 -1
@@ -1,5 +1,9 @@
 /*
- * event.h: Hardware virtual machine assist events.
+ * include/asm-x86/hvm/event.h
+ *
+ * Arch-specific hardware virtual machine event abstractions.
+ *
+ * Copyright (c) 2016, Bitdefender S.R.L.

Is this true? Namely, was _all_ of the code here written by people on your company, including what may have got moved here from elsewhere?

Jan

#18 lore raw
Quoted 13 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 18.02.16 at 20:35, <[email protected]> wrote:
---
 MAINTAINERS                     |   1 +
 xen/arch/arm/hvm.c              |   8 +++
 xen/arch/x86/hvm/event.c        | 116

++++++----------------------------------

Quoted 6 lines
 xen/arch/x86/hvm/hvm.c          |   1 +
 xen/arch/x86/monitor.c          |  14 -----
 xen/arch/x86/vm_event.c         |   1 +
 xen/common/Makefile             |   2 +-
 xen/common/hvm/Makefile         |   3 +-
 xen/common/hvm/event.c          |  96 +++++++++++++++++++++++++++++++++
Quoted 3 lines

So here you _again_ try to introduce something HVM-ish for ARM. Why? Why can't this code live in common/vm_event.c?

I too am wondering if this is the right way to architect this. It would be better to move the guest-requested stuff into the generic vm_event component as it doesn't seem to be HVM specific other then it using an HVMOP hypercall to be triggered.

Tamas

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#19 lore raw
Quoted 18 lines · Tamas K Lengyel
Quoted 5 lines · On Fri, Feb 19, 2016 at 7:26 AM, Jan Beulich <[email protected]…
Quoted 1 line
Quoted 1 line · On 18.02.16 at 20:35, <[email protected] <mailto:[email protected]>>…
---
 MAINTAINERS                     |   1 +
 xen/arch/arm/hvm.c              |   8 +++
 xen/arch/x86/hvm/event.c        | 116

++++++----------------------------------
> xen/arch/x86/hvm/hvm.c | 1 +
> xen/arch/x86/monitor.c | 14 -----
> xen/arch/x86/vm_event.c | 1 +
> xen/common/Makefile | 2 +-
> xen/common/hvm/Makefile | 3 +-
> xen/common/hvm/event.c | 96
+++++++++++++++++++++++++++++++++

Quoted 8 lines

So here you _again_ try to introduce something HVM-ish for ARM. Why? Why can't this code live in common/vm_event.c?

I too am wondering if this is the right way to architect this. It would be better to move the guest-requested stuff into the generic vm_event component as it doesn't seem to be HVM specific other then it using an HVMOP hypercall to be triggered.

Tamas

Oh, that. "xen/common/hvm/event.c". I too don't know if it's the right way, but Jan, please at least don't attribute the way the code already is to me, I did not architect it. And it's not human to expect doing everything perfectly in a single shot. If you're of the opinion that it should be in vm_event.c I will gladly try to put it there. Of course, that could also be done in another patch.

Corneliu.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#20 lore raw
In reply to Jan Beulich
Quoted 11 lines · Jan Beulich
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 18.02.16 at 20:35, <[email protected]> wrote:
---
  MAINTAINERS                     |   1 +
  xen/arch/arm/hvm.c              |   8 +++
  xen/arch/x86/hvm/event.c        | 116 ++++++----------------------------------
  xen/arch/x86/hvm/hvm.c          |   1 +
  xen/arch/x86/monitor.c          |  14 -----
  xen/arch/x86/vm_event.c         |   1 +
  xen/common/Makefile             |   2 +-
  xen/common/hvm/Makefile         |   3 +-
  xen/common/hvm/event.c          |  96 +++++++++++++++++++++++++++++++++
Quoted 2 lines

So here you _again_ try to introduce something HVM-ish for ARM. Why? Why can't this code live in common/vm_event.c?

Are you referring to "xen/arch/arm/hvm.c"? If so, I did not introduce that file, it was already there, all I did is add handling of HVMOP_guest_request_vm_event to ARM-side's already existing do_hvm_op :). On the "HVM-ish" note, is there some incompatibility between ARM and the concept of HVM?

Quoted 21 lines
Quoted 21 lines
xen/include/asm-x86/domain.h +3 -10
@@ -376,17 +376,15 @@ struct arch_domain
      unsigned long *pirq_eoi_map;
      unsigned long pirq_eoi_map_mfn;
 
-    /* Monitor options */
+    /* Arch-specific monitor options */
      struct {
-        unsigned int write_ctrlreg_enabled       : 4;
-        unsigned int write_ctrlreg_sync          : 4;
-        unsigned int write_ctrlreg_onchangeonly  : 4;
-        unsigned int mov_to_msr_enabled          : 1;
-        unsigned int mov_to_msr_extended         : 1;
-        unsigned int singlestep_enabled          : 1;
-        unsigned int software_breakpoint_enabled : 1;
-        unsigned int guest_request_enabled       : 1;
-        unsigned int guest_request_sync          : 1;
+        uint16_t write_ctrlreg_enabled       : 4;
+        uint16_t write_ctrlreg_sync          : 4;
Quoted 8 lines

xen/include/asm-x86/domain.h struct arch_domain · line 388

Quoted 6 lines
xen/include/asm-x86/domain.h +5 -0
+        uint16_t write_ctrlreg_onchangeonly  : 4;
+        uint16_t mov_to_msr_enabled          : 1;
+        uint16_t mov_to_msr_extended         : 1;
+        uint16_t singlestep_enabled          : 1;
+        uint16_t software_breakpoint_enabled : 1;
      } monitor;

What is this type change supposed to achieve in general, and in particular in the context of this patch?

Some time before this patch there was a discussion I had w/ ARM maintainer Ian Campbell who made the suggestion to try and move parts of the monitor vm-events code to the common-side.
(you can find that discussion here: https://www.mail-archive.com/[email protected]/msg54139.html).
In short, the reason for his suggestion was that that previous attempt of mine to add guest-request support for ARM highlighted code duplication between X86 and ARM if I were to leave the monitor vm-events code as it was (that is, completely arch-specific). In an effort to avoid that, I first submitted a 7 patch-series which tried to move as much as possible to the common-side.
"As much as possible" meant guest-request, ctrl-reg write, single-step and software breakpoints, all moved to the common-side. That also meant introducing some Kconfigs to selectively activate some parts of that now-common code, since not all of it was used on ARM at that moment. Although conceptually that code could have remained on the common-side, Tamas pointed out that we could get rid of the Kconfigs (which in his opinion bloated the code) by only moving at the moment what is implemented on both X86 and ARM. As for the rest, he noted that when I add implementations for the other monitor vm-events on ARM as well, I could move that to common as well. The above is a result of that - guest-request is implemented on both X86 and ARM with this patch, hence I also moved it to common.

Quoted 14 lines

xen/include/asm-x86/hvm/event.h line 6

Quoted 10 lines
xen/include/asm-x86/hvm/event.h +5 -1
@@ -1,5 +1,9 @@
  /*
- * event.h: Hardware virtual machine assist events.
+ * include/asm-x86/hvm/event.h
+ *
+ * Arch-specific hardware virtual machine event abstractions.
+ *
+ * Copyright (c) 2016, Bitdefender S.R.L.

Is this true? Namely, was _all_ of the code here written by people on your company, including what may have got moved here from elsewhere?

Quoted 3 lines

Jan

My bad. Removing that line would be satisfactory, yes?

Corneliu.

#21 lore raw
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 19.02.16 at 17:25, <[email protected]> wrote:
Quoted 11 lines · Jan Beulich
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 18.02.16 at 20:35, <[email protected]> wrote:
---
  MAINTAINERS                     |   1 +
  xen/arch/arm/hvm.c              |   8 +++
  xen/arch/x86/hvm/event.c        | 116 ++++++----------------------------------
  xen/arch/x86/hvm/hvm.c          |   1 +
  xen/arch/x86/monitor.c          |  14 -----
  xen/arch/x86/vm_event.c         |   1 +
  xen/common/Makefile             |   2 +-
  xen/common/hvm/Makefile         |   3 +-
  xen/common/hvm/event.c          |  96 +++++++++++++++++++++++++++++++++
Quoted 6 lines
Quoted 2 lines

So here you _again_ try to introduce something HVM-ish for ARM. Why? Why can't this code live in common/vm_event.c?

Are you referring to "xen/arch/arm/hvm.c"? If so, I did not introduce that file, it was already there, all I did is add handling of HVMOP_guest_request_vm_event to ARM-side's already existing do_hvm_op :).

No, I'm referring to your initial attempt to create arch/arm/hvm/...

Quoted 2 lines

On the "HVM-ish" note, is there some incompatibility between ARM and the concept of HVM?

ARM guests are neither PV nor HVM right now, but somewhere in the middle (PVHv2 may come closest).

Quoted 44 lines
Quoted 20 lines
Quoted 20 lines
xen/include/asm-x86/domain.h +3 -10
@@ -376,17 +376,15 @@ struct arch_domain
      unsigned long *pirq_eoi_map;
      unsigned long pirq_eoi_map_mfn;
 
-    /* Monitor options */
+    /* Arch-specific monitor options */
      struct {
-        unsigned int write_ctrlreg_enabled       : 4;
-        unsigned int write_ctrlreg_sync          : 4;
-        unsigned int write_ctrlreg_onchangeonly  : 4;
-        unsigned int mov_to_msr_enabled          : 1;
-        unsigned int mov_to_msr_extended         : 1;
-        unsigned int singlestep_enabled          : 1;
-        unsigned int software_breakpoint_enabled : 1;
-        unsigned int guest_request_enabled       : 1;
-        unsigned int guest_request_sync          : 1;
+        uint16_t write_ctrlreg_enabled       : 4;
+        uint16_t write_ctrlreg_sync          : 4;
Quoted 8 lines

xen/include/asm-x86/domain.h struct arch_domain · line 388

Quoted 6 lines
xen/include/asm-x86/domain.h +5 -0
+        uint16_t write_ctrlreg_onchangeonly  : 4;
+        uint16_t mov_to_msr_enabled          : 1;
+        uint16_t mov_to_msr_extended         : 1;
+        uint16_t singlestep_enabled          : 1;
+        uint16_t software_breakpoint_enabled : 1;
      } monitor;

What is this type change supposed to achieve in general, and in particular in the context of this patch?

Some time before this patch there was a discussion I had w/ ARM maintainer Ian Campbell who made the suggestion to try and move parts of the monitor vm-events code to the common-side.
(you can find that discussion here:
https://www.mail-archive.com/[email protected]/msg54139.html).
In short, the reason for his suggestion was that that previous attempt of mine to add guest-request support for ARM highlighted code duplication between X86 and ARM if I were to leave the monitor vm-events code as it was (that is, completely arch-specific). In an effort to avoid that, I first submitted a 7 patch-series which tried to move as much as possible to the common-side.
"As much as possible" meant guest-request, ctrl-reg write, single-step and software breakpoints, all moved to the common-side. That also meant introducing some Kconfigs to selectively activate some parts of that now-common code, since not all of it was used on ARM at that moment.

Quoted 8 lines

Although conceptually that code could have remained on the common-side, Tamas pointed out that we could get rid of the Kconfigs (which in his opinion bloated the code) by only moving at the moment what is implemented on both X86 and ARM. As for the rest, he noted that when I add implementations for the other monitor vm-events on ARM as well, I could move that to common as well. The above is a result of that - guest-request is implemented on both X86 and ARM with this patch, hence I also moved it to common.

I agree there are two fields being removed. But the question was why you also change the type of the other fields.

Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
xen/include/asm-x86/hvm/event.h +0 -1
@@ -1,5 +1,9 @@
  /*
- * event.h: Hardware virtual machine assist events.
Quoted 8 lines

xen/include/asm-x86/hvm/event.h line 6

Quoted 5 lines
xen/include/asm-x86/hvm/event.h +5 -0
+ * include/asm-x86/hvm/event.h
+ *
+ * Arch-specific hardware virtual machine event abstractions.
+ *
+ * Copyright (c) 2016, Bitdefender S.R.L.

Is this true? Namely, was _all_ of the code here written by people on your company, including what may have got moved here from elsewhere?

Quoted 1 line

My bad. Removing that line would be satisfactory, yes?

To me, yes.

Jan

#22 lore raw
Quoted 13 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 19.02.16 at 17:25, <[email protected]> wrote:
Quoted 11 lines · Jan Beulich
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 18.02.16 at 20:35, <[email protected]> wrote:
---
   MAINTAINERS                     |   1 +
   xen/arch/arm/hvm.c              |   8 +++
   xen/arch/x86/hvm/event.c        | 116 ++++++----------------------------------
   xen/arch/x86/hvm/hvm.c          |   1 +
   xen/arch/x86/monitor.c          |  14 -----
   xen/arch/x86/vm_event.c         |   1 +
   xen/common/Makefile             |   2 +-
   xen/common/hvm/Makefile         |   3 +-
   xen/common/hvm/event.c          |  96 +++++++++++++++++++++++++++++++++
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

So here you _again_ try to introduce something HVM-ish for ARM. Why? Why can't this code live in common/vm_event.c?

Are you referring to "xen/arch/arm/hvm.c"? If so, I did not introduce that file, it was already there, all I did is add handling of HVMOP_guest_request_vm_event to ARM-side's already existing do_hvm_op :).

No, I'm referring to your initial attempt to create arch/arm/hvm/...

I don't understand. Have I done that again with this patch?

Quoted 5 lines
Quoted 3 lines

On the "HVM-ish" note, is there some incompatibility between ARM and the concept of HVM?

ARM guests are neither PV nor HVM right now, but somewhere in the middle (PVHv2 may come closest).

I did not know that, but the fact that there is already "hvm-like" code written for ARM didn't hint me towards that fact either :)
I'm aware that I'm far from familiar with the codebase right now, I'm browsing more of the code these days and taking notes to try and understand in depth at least the parts I'm sending contributions for. I've already got some questions I want to post to the mailing list soon, *including* exactly how the distinction between the guest-types comes into play w/ the vm-events code. Specifically, I'm talking for example about the following piece of code from the X86 arch_monitor_get_capabilities:

    /*
     * At the moment only Intel HVM domains are supported. However, event
     * delivery could be extended to AMD and PV domains.
     */
    if ( !is_hvm_domain(d) || !cpu_has_vmx )
        return capabilities;

== "However, event delivery could be extended to AMD and PV domains".
This comment begs for questions like:
* what would be necessary to extend support to PV domains?
* can we really do this operation without hardware assisted virtualization whatsoever? If not, how much can we do without that?
* what about pvh?

Since I have other questions like the above and I'll probably have more while I'm trying to get a better picture of the code, would it be ok if we defer addressing these issues to then?

Quoted 52 lines
Quoted 44 lines
Quoted 21 lines
Quoted 21 lines
xen/include/asm-x86/domain.h +3 -10
@@ -376,17 +376,15 @@ struct arch_domain
       unsigned long *pirq_eoi_map;
       unsigned long pirq_eoi_map_mfn;
 
-    /* Monitor options */
+    /* Arch-specific monitor options */
       struct {
-        unsigned int write_ctrlreg_enabled       : 4;
-        unsigned int write_ctrlreg_sync          : 4;
-        unsigned int write_ctrlreg_onchangeonly  : 4;
-        unsigned int mov_to_msr_enabled          : 1;
-        unsigned int mov_to_msr_extended         : 1;
-        unsigned int singlestep_enabled          : 1;
-        unsigned int software_breakpoint_enabled : 1;
-        unsigned int guest_request_enabled       : 1;
-        unsigned int guest_request_sync          : 1;
+        uint16_t write_ctrlreg_enabled       : 4;
+        uint16_t write_ctrlreg_sync          : 4;
Quoted 8 lines

xen/include/asm-x86/domain.h struct arch_domain · line 388

Quoted 6 lines
xen/include/asm-x86/domain.h +5 -0
+        uint16_t write_ctrlreg_onchangeonly  : 4;
+        uint16_t mov_to_msr_enabled          : 1;
+        uint16_t mov_to_msr_extended         : 1;
+        uint16_t singlestep_enabled          : 1;
+        uint16_t software_breakpoint_enabled : 1;
       } monitor;

What is this type change supposed to achieve in general, and in particular in the context of this patch?

Some time before this patch there was a discussion I had w/ ARM maintainer Ian Campbell who made the suggestion to try and move parts of the monitor vm-events code to the common-side.
(you can find that discussion here:
https://www.mail-archive.com/[email protected]/msg54139.html).
In short, the reason for his suggestion was that that previous attempt of mine to add guest-request support for ARM highlighted code duplication between X86 and ARM if I were to leave the monitor vm-events code as it was (that is, completely arch-specific). In an effort to avoid that, I first submitted a 7 patch-series which tried to move as much as possible to the common-side.
"As much as possible" meant guest-request, ctrl-reg write, single-step and software breakpoints, all moved to the common-side. That also meant introducing some Kconfigs to selectively activate some parts of that now-common code, since not all of it was used on ARM at that moment.

Quoted 8 lines

Although conceptually that code could have remained on the common-side, Tamas pointed out that we could get rid of the Kconfigs (which in his opinion bloated the code) by only moving at the moment what is implemented on both X86 and ARM. As for the rest, he noted that when I add implementations for the other monitor vm-events on ARM as well, I could move that to common as well. The above is a result of that - guest-request is implemented on both X86 and ARM with this patch, hence I also moved it to common.

Quoted 2 lines

I agree there are two fields being removed. But the question was why you also change the type of the other fields.

It made sense because:
* we don't need 32-bits to store that data anymore
* as implementations are laid out for ARM also, more of those bits will get moved to common, so even less bits will be needed

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines

xen/include/asm-x86/hvm/event.h line 6

Quoted 10 lines
xen/include/asm-x86/hvm/event.h +5 -1
@@ -1,5 +1,9 @@
   /*
- * event.h: Hardware virtual machine assist events.
+ * include/asm-x86/hvm/event.h
+ *
+ * Arch-specific hardware virtual machine event abstractions.
+ *
+ * Copyright (c) 2016, Bitdefender S.R.L.

Is this true? Namely, was _all_ of the code here written by people on your company, including what may have got moved here from elsewhere?

Quoted 5 lines
Quoted 1 line

My bad. Removing that line would be satisfactory, yes?

To me, yes.

Jan

Noted.

Corneliu.

#23 lore raw
Quoted 15 lines
Quoted 1 line
Quoted 1 line · On 19.02.16 at 19:01, <[email protected]> wrote:
Quoted 13 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 19.02.16 at 17:25, <[email protected]> wrote:
Quoted 11 lines · Jan Beulich
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 18.02.16 at 20:35, <[email protected]> wrote:
---
   MAINTAINERS                     |   1 +
   xen/arch/arm/hvm.c              |   8 +++
   xen/arch/x86/hvm/event.c        | 116 ++++++----------------------------------
   xen/arch/x86/hvm/hvm.c          |   1 +
   xen/arch/x86/monitor.c          |  14 -----
   xen/arch/x86/vm_event.c         |   1 +
   xen/common/Makefile             |   2 +-
   xen/common/hvm/Makefile         |   3 +-
   xen/common/hvm/event.c          |  96 +++++++++++++++++++++++++++++++++
Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

So here you _again_ try to introduce something HVM-ish for ARM. Why? Why can't this code live in common/vm_event.c?

Are you referring to "xen/arch/arm/hvm.c"? If so, I did not introduce that file, it was already there, all I did is add handling of HVMOP_guest_request_vm_event to ARM-side's already existing do_hvm_op :).

No, I'm referring to your initial attempt to create arch/arm/hvm/...

I don't understand. Have I done that again with this patch?

Not the exact same thing, but something going along those same lines of thinking.

Quoted 30 lines
Quoted 4 lines
Quoted 2 lines

On the "HVM-ish" note, is there some incompatibility between ARM and the concept of HVM?

ARM guests are neither PV nor HVM right now, but somewhere in the middle (PVHv2 may come closest).

I did not know that, but the fact that there is already "hvm-like" code written for ARM didn't hint me towards that fact either :) I'm aware that I'm far from familiar with the codebase right now, I'm browsing more of the code these days and taking notes to try and understand in depth at least the parts I'm sending contributions for. I've already got some questions I want to post to the mailing list soon, *including* exactly how the distinction between the guest-types comes into play w/ the vm-events code.
Specifically, I'm talking for example about the following piece of code from the X86 arch_monitor_get_capabilities:

     /*
      * At the moment only Intel HVM domains are supported. However, event
      * delivery could be extended to AMD and PV domains.
      */
     if ( !is_hvm_domain(d) || !cpu_has_vmx )
         return capabilities;

== "However, event delivery could be extended to AMD and PV domains". This comment begs for questions like:
* what would be necessary to extend support to PV domains?
* can we really do this operation without hardware assisted virtualization whatsoever? If not, how much can we do without that?
* what about pvh?

Quoted 3 lines

Since I have other questions like the above and I'll probably have more while I'm trying to get a better picture of the code, would it be ok if we defer addressing these issues to then?

Yes, you should definitely not hijack this thread for other, more general inquiries.

Quoted 51 lines
Quoted 51 lines
Quoted 51 lines
Quoted 20 lines
Quoted 20 lines
xen/include/asm-x86/domain.h +3 -10
@@ -376,17 +376,15 @@ struct arch_domain
       unsigned long *pirq_eoi_map;
       unsigned long pirq_eoi_map_mfn;
 
-    /* Monitor options */
+    /* Arch-specific monitor options */
       struct {
-        unsigned int write_ctrlreg_enabled       : 4;
-        unsigned int write_ctrlreg_sync          : 4;
-        unsigned int write_ctrlreg_onchangeonly  : 4;
-        unsigned int mov_to_msr_enabled          : 1;
-        unsigned int mov_to_msr_extended         : 1;
-        unsigned int singlestep_enabled          : 1;
-        unsigned int software_breakpoint_enabled : 1;
-        unsigned int guest_request_enabled       : 1;
-        unsigned int guest_request_sync          : 1;
+        uint16_t write_ctrlreg_enabled       : 4;
+        uint16_t write_ctrlreg_sync          : 4;
Quoted 8 lines

xen/include/asm-x86/domain.h struct arch_domain · line 388

Quoted 6 lines
xen/include/asm-x86/domain.h +5 -0
+        uint16_t write_ctrlreg_onchangeonly  : 4;
+        uint16_t mov_to_msr_enabled          : 1;
+        uint16_t mov_to_msr_extended         : 1;
+        uint16_t singlestep_enabled          : 1;
+        uint16_t software_breakpoint_enabled : 1;
       } monitor;

What is this type change supposed to achieve in general, and in particular in the context of this patch?

Some time before this patch there was a discussion I had w/ ARM maintainer Ian Campbell who made the suggestion to try and move parts of the monitor vm-events code to the common-side.
(you can find that discussion here:
https://www.mail-archive.com/[email protected]/msg54139.html).
In short, the reason for his suggestion was that that previous attempt of mine to add guest-request support for ARM highlighted code duplication between X86 and ARM if I were to leave the monitor vm-events code as it was (that is, completely arch-specific). In an effort to avoid that, I first submitted a 7 patch-series which tried to move as much as possible to the common-side.
"As much as possible" meant guest-request, ctrl-reg write, single-step and software breakpoints, all moved to the common-side. That also meant introducing some Kconfigs to selectively activate some parts of that now-common code, since not all of it was used on ARM at that moment. Although conceptually that code could have remained on the common-side, Tamas pointed out that we could get rid of the Kconfigs (which in his opinion bloated the code) by only moving at the moment what is implemented on both X86 and ARM. As for the rest, he noted that when I add implementations for the other monitor vm-events on ARM as well, I could move that to common as well. The above is a result of that - guest-request is implemented on both X86 and ARM with this patch, hence I also moved it to common.

Quoted 7 lines
Quoted 2 lines

I agree there are two fields being removed. But the question was why you also change the type of the other fields.

It made sense because:
* we don't need 32-bits to store that data anymore
* as implementations are laid out for ARM also, more of those bits will get moved to common, so even less bits will be needed

Altering bit field types from signed or unsigned int to some other type always need more rational than that, because from a strict language perspective only those two types can be used for bit fields in a compatible manner. Furthermore, gcc had (and maybe still has) some "interesting" (at least to someone having come from a different world years ago) behavior for bit fields of types wider than "int", which implicitly makes it desirable to avoid non- standard types unless absolutely needed in a specific case. (And such then shouldn't be mixed in with other changes, to make both the adjustment and the reasons for them stand out.)

Jan

#24 lore raw
Quoted 54 lines · Jan Beulich
Quoted 15 lines
Quoted 1 line
Quoted 1 line · On 19.02.16 at 19:01, <[email protected]> wrote:
Quoted 13 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 19.02.16 at 17:25, <[email protected]> wrote:
Quoted 11 lines · Jan Beulich
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 18.02.16 at 20:35, <[email protected]> wrote:
---
    MAINTAINERS                     |   1 +
    xen/arch/arm/hvm.c              |   8 +++
    xen/arch/x86/hvm/event.c        | 116 ++++++----------------------------------
    xen/arch/x86/hvm/hvm.c          |   1 +
    xen/arch/x86/monitor.c          |  14 -----
    xen/arch/x86/vm_event.c         |   1 +
    xen/common/Makefile             |   2 +-
    xen/common/hvm/Makefile         |   3 +-
    xen/common/hvm/event.c          |  96 +++++++++++++++++++++++++++++++++
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

So here you _again_ try to introduce something HVM-ish for ARM. Why? Why can't this code live in common/vm_event.c?

Are you referring to "xen/arch/arm/hvm.c"? If so, I did not introduce that file, it was already there, all I did is add handling of HVMOP_guest_request_vm_event to ARM-side's already existing do_hvm_op :).

No, I'm referring to your initial attempt to create arch/arm/hvm/...

I don't understand. Have I done that again with this patch?

Not the exact same thing, but something going along those same lines of thinking.

Quoted 29 lines
Quoted 4 lines
Quoted 2 lines

On the "HVM-ish" note, is there some incompatibility between ARM and the concept of HVM?

ARM guests are neither PV nor HVM right now, but somewhere in the middle (PVHv2 may come closest).

I did not know that, but the fact that there is already "hvm-like" code written for ARM didn't hint me towards that fact either :) I'm aware that I'm far from familiar with the codebase right now, I'm browsing more of the code these days and taking notes to try and understand in depth at least the parts I'm sending contributions for. I've already got some questions I want to post to the mailing list soon, *including* exactly how the distinction between the guest-types comes into play w/ the vm-events code.
Specifically, I'm talking for example about the following piece of code from the X86 arch_monitor_get_capabilities:

      /*
       * At the moment only Intel HVM domains are supported. However, event
       * delivery could be extended to AMD and PV domains.
       */
      if ( !is_hvm_domain(d) || !cpu_has_vmx )
          return capabilities;

== "However, event delivery could be extended to AMD and PV domains". This comment begs for questions like:
* what would be necessary to extend support to PV domains?
* can we really do this operation without hardware assisted virtualization whatsoever? If not, how much can we do without that?
* what about pvh?

Quoted 5 lines
Quoted 3 lines

Since I have other questions like the above and I'll probably have more while I'm trying to get a better picture of the code, would it be ok if we defer addressing these issues to then?

Yes, you should definitely not hijack this thread for other, more general inquiries.

Ok then, should I also understand then that for now it's ok to keep the "HVM-ish" hvm_event_traps & hvm_event_guest_request (I suppose you were referring to these 2 functions above) on the common-side event.c until we address these issues? Or I could try to move them to common/vm_event.c as you suggest renamed to vm_event_traps & vm_event_guest_request and also rename arch_hvm_event_fill_regs to arch_vm_event_fill_regs (?).

Quoted 68 lines
Quoted 51 lines
Quoted 51 lines
Quoted 51 lines
Quoted 20 lines
Quoted 20 lines
xen/include/asm-x86/domain.h +3 -10
@@ -376,17 +376,15 @@ struct arch_domain
        unsigned long *pirq_eoi_map;
        unsigned long pirq_eoi_map_mfn;
 
-    /* Monitor options */
+    /* Arch-specific monitor options */
        struct {
-        unsigned int write_ctrlreg_enabled       : 4;
-        unsigned int write_ctrlreg_sync          : 4;
-        unsigned int write_ctrlreg_onchangeonly  : 4;
-        unsigned int mov_to_msr_enabled          : 1;
-        unsigned int mov_to_msr_extended         : 1;
-        unsigned int singlestep_enabled          : 1;
-        unsigned int software_breakpoint_enabled : 1;
-        unsigned int guest_request_enabled       : 1;
-        unsigned int guest_request_sync          : 1;
+        uint16_t write_ctrlreg_enabled       : 4;
+        uint16_t write_ctrlreg_sync          : 4;
Quoted 8 lines

xen/include/asm-x86/domain.h struct arch_domain · line 388

Quoted 6 lines
xen/include/asm-x86/domain.h +5 -0
+        uint16_t write_ctrlreg_onchangeonly  : 4;
+        uint16_t mov_to_msr_enabled          : 1;
+        uint16_t mov_to_msr_extended         : 1;
+        uint16_t singlestep_enabled          : 1;
+        uint16_t software_breakpoint_enabled : 1;
        } monitor;

What is this type change supposed to achieve in general, and in particular in the context of this patch?

Some time before this patch there was a discussion I had w/ ARM maintainer Ian Campbell who made the suggestion to try and move parts of the monitor vm-events code to the common-side.
(you can find that discussion here:
https://www.mail-archive.com/[email protected]/msg54139.html).
In short, the reason for his suggestion was that that previous attempt of mine to add guest-request support for ARM highlighted code duplication between X86 and ARM if I were to leave the monitor vm-events code as it was (that is, completely arch-specific). In an effort to avoid that, I first submitted a 7 patch-series which tried to move as much as possible to the common-side.
"As much as possible" meant guest-request, ctrl-reg write, single-step and software breakpoints, all moved to the common-side. That also meant introducing some Kconfigs to selectively activate some parts of that now-common code, since not all of it was used on ARM at that moment. Although conceptually that code could have remained on the common-side, Tamas pointed out that we could get rid of the Kconfigs (which in his opinion bloated the code) by only moving at the moment what is implemented on both X86 and ARM. As for the rest, he noted that when I add implementations for the other monitor vm-events on ARM as well, I could move that to common as well. The above is a result of that - guest-request is implemented on both X86 and ARM with this patch, hence I also moved it to common.

Quoted 6 lines
Quoted 2 lines

I agree there are two fields being removed. But the question was why you also change the type of the other fields.

It made sense because:
* we don't need 32-bits to store that data anymore
* as implementations are laid out for ARM also, more of those bits will get moved to common, so even less bits will be needed

Altering bit field types from signed or unsigned int to some other type always need more rational than that, because from a strict language perspective only those two types can be used for bit fields in a compatible manner. Furthermore, gcc had (and maybe still has) some "interesting" (at least to someone having come from a different world years ago) behavior for bit fields of types wider than "int", which implicitly makes it desirable to avoid non- standard types unless absolutely needed in a specific case. (And such then shouldn't be mixed in with other changes, to make both the adjustment and the reasons for them stand out.)

Quoted 2 lines

Jan

That's another reason for me to read the C standard someday.
(C90, 6.5.2.1) "A bit-field shall have a type that is a qualified or unqualified version of one of int, unsigned int, or signed int"
(C99, 6.7.2.1p4) "A bit-field shall have a type that is a qualified or unqualified version of _Bool, signed int, unsigned int, or some other implementation-defined type."

I've always used bitfields w/ arbitrary sizes: char, short, int, long long...GCC never has complained about it, I didn't know types other than signed/unsigned int were non-standard extensions. GCC warns me about this if I use "-std=gnu90 -pedantic", w/ gnu99 it doesn't, maybe because of the "or some other implementation-defined type" part (which I don't fully understand).

Will change back the uint16_t to plain unsigned int and uint8_t here:

+ /* Common monitor options */
+ struct {

+        uint8_t guest_request_enabled       : 1;
+        uint8_t guest_request_sync          : 1;

+ } monitor;

to unsigned int as well.

Thanks,
Corneliu.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#25 lore raw
Quoted 42 lines
Quoted 1 line
Quoted 1 line · On 22.02.16 at 12:26, <[email protected]> wrote:
Quoted 34 lines · Jan Beulich
Quoted 34 lines
Quoted 1 line
Quoted 1 line · On 19.02.16 at 19:01, <[email protected]> wrote:
Quoted 7 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 19.02.16 at 17:25, <[email protected]> wrote:
Quoted 1 line · Jan Beulich
Quoted 1 line
Quoted 1 line
Quoted 1 line · On 18.02.16 at 20:35, <[email protected]> wrote:

On the "HVM-ish" note, is there some incompatibility between ARM and the concept of HVM?

ARM guests are neither PV nor HVM right now, but somewhere in the middle (PVHv2 may come closest).

I did not know that, but the fact that there is already "hvm-like" code written for ARM didn't hint me towards that fact either :) I'm aware that I'm far from familiar with the codebase right now, I'm browsing more of the code these days and taking notes to try and understand in depth at least the parts I'm sending contributions for. I've already got some questions I want to post to the mailing list soon, *including* exactly how the distinction between the guest-types comes into play w/ the vm-events code.
Specifically, I'm talking for example about the following piece of code from the X86 arch_monitor_get_capabilities:

      /*
       * At the moment only Intel HVM domains are supported. However, event
       * delivery could be extended to AMD and PV domains.
       */
      if ( !is_hvm_domain(d) || !cpu_has_vmx )
          return capabilities;

== "However, event delivery could be extended to AMD and PV domains". This comment begs for questions like:
* what would be necessary to extend support to PV domains?
* can we really do this operation without hardware assisted virtualization whatsoever? If not, how much can we do without that?
* what about pvh?

Quoted 5 lines
Quoted 3 lines

Since I have other questions like the above and I'll probably have more while I'm trying to get a better picture of the code, would it be ok if we defer addressing these issues to then?

Yes, you should definitely not hijack this thread for other, more general inquiries.

Quoted 7 lines

Ok then, should I also understand then that for now it's ok to keep the "HVM-ish" hvm_event_traps & hvm_event_guest_request (I suppose you were referring to these 2 functions above) on the common-side event.c until we address these issues?
Or I could try to move them to common/vm_event.c as you suggest renamed to vm_event_traps & vm_event_guest_request and also rename arch_hvm_event_fill_regs to arch_vm_event_fill_regs (?).

I'd say dropping the hvm_ suffixes / infixes would be fine (and even desirable) alongside their movement to common/vm_event.c, but the question really needs to go to the maintainers of that code.

Jan

#26 lore raw
Quoted 50 lines · Jan Beulich
Quoted 42 lines
Quoted 1 line
Quoted 1 line · On 22.02.16 at 12:26, <[email protected]> wrote:
Quoted 34 lines · Jan Beulich
Quoted 34 lines
Quoted 1 line
Quoted 1 line · On 19.02.16 at 19:01, <[email protected]> wrote:
Quoted 7 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 19.02.16 at 17:25, <[email protected]> wrote:
Quoted 1 line · Jan Beulich
Quoted 1 line
Quoted 1 line
Quoted 1 line · On 18.02.16 at 20:35, <[email protected]> wrote:

On the "HVM-ish" note, is there some incompatibility between ARM and the concept of HVM?

ARM guests are neither PV nor HVM right now, but somewhere in the middle (PVHv2 may come closest).

I did not know that, but the fact that there is already "hvm-like" code written for ARM didn't hint me towards that fact either :) I'm aware that I'm far from familiar with the codebase right now, I'm browsing more of the code these days and taking notes to try and understand in depth at least the parts I'm sending contributions for. I've already got some questions I want to post to the mailing list soon, *including* exactly how the distinction between the guest-types comes into play w/ the vm-events code.
Specifically, I'm talking for example about the following piece of code from the X86 arch_monitor_get_capabilities:

      /*
       * At the moment only Intel HVM domains are supported. However, event
       * delivery could be extended to AMD and PV domains.
       */
      if ( !is_hvm_domain(d) || !cpu_has_vmx )
          return capabilities;

== "However, event delivery could be extended to AMD and PV domains". This comment begs for questions like:
* what would be necessary to extend support to PV domains?
* can we really do this operation without hardware assisted virtualization whatsoever? If not, how much can we do without that?
* what about pvh?

Quoted 5 lines
Quoted 3 lines

Since I have other questions like the above and I'll probably have more while I'm trying to get a better picture of the code, would it be ok if we defer addressing these issues to then?

Yes, you should definitely not hijack this thread for other, more general inquiries.

Quoted 7 lines

Ok then, should I also understand then that for now it's ok to keep the "HVM-ish" hvm_event_traps & hvm_event_guest_request (I suppose you were referring to these 2 functions above) on the common-side event.c until we address these issues?
Or I could try to move them to common/vm_event.c as you suggest renamed to vm_event_traps & vm_event_guest_request and also rename arch_hvm_event_fill_regs to arch_vm_event_fill_regs (?).

Quoted 4 lines

I'd say dropping the hvm_ suffixes / infixes would be fine (and even desirable) alongside their movement to common/vm_event.c, but the question really needs to go to the maintainers of that code.

I agree.

Thanks,
Razvan

#27 lore raw
In reply to Corneliu ZUZU
Quoted 19 lines · Corneliu ZUZU

This patch adds ARM support for guest-request monitor vm-events.

Summary of changes:
== Moved to common-side:
* XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST handling (moved from X86 arch_monitor_domctl_event to common monitor_domctl)
* hvm_event_guest_request, hvm_event_traps (also added target vcpu as param)
* guest-request bits from X86 'struct arch_domain' (to common 'struct domain')
== ARM implementations:
* do_hvm_op now handling of HVMOP_guest_request_vm_event => calls hvm_event_guest_request (as on X86)
* arch_monitor_get_capabilities: updated to reflect support for XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST
* vm_event_init_domain (does nothing), vm_event_cleanup_domain
== Misc:
* hvm_event_fill_regs renamed to arch_hvm_event_fill_regs, no longer X86-specific. ARM-side implementation of this function currently does nothing, that will be added in a separate patch.

Quoted 1 line

Before sending in the next revision of this patch, I have a few questions I'd like to ask.
That being the case, I thought it would be ok to also include *all* the changes that will be done in the next revision here for (potentially) additional feedback.

Already discussed changes TBD:
* Add #define altp2m_active(d) (0) and implement p2m_get_vcpu_altp2m_idx(v) for ARM to remove #ifdef CONFIG_X86 in hvm_event_traps (Stefano, Tamas)
* Remove wrong copyright comment (Jan)
* Change bitfields members type back to unsigned int (Jan)
* Move hvm_event_traps and hvm_event_guest_request to common/vm_event.c and rename them to vm_event_traps and vm_event_guest_request (Jan)

Questions:

1) I've noticed the practice in Xen is to prepend the arch_ prefix to functions that usually have a counterpart on the common-side, i.e. there are a lot of arch-specific functions missing this prefix. Would it then be advised to:
- rename arch_monitor_get_capabilities to
vm_event_monitor_get_capabilities and move it to vm_event.h
- rename arch_hvm_event_fill_regs to vm_event_fill_regs and move it
to vm_event.h

2) For Tamas: would it be ok if I put p2m_get_vcpu_altp2m_idx in asm/altp2m.h and rename it to altp2m_vcpu_idx(v) (to obey function-naming pattern in that file)?

3) I've noticed that on X86 on a guest-request monitor vm-event the RIP is automatically incremented. On ARM, with the current changeset, that doesn't seem to happen.

    X86 code path: vmx_vmexit_handler(EXIT_REASON_VMCALL) -> 
hvm_do_hypercall -> do_hvm_op(HVMOP_guest_request_vm_event) -> hvm_do_hypercall returns HVM_HCALL_completed -> vmx_vmexit_handler calls update_guest_eip(), which increments the RIP.
    ARM code path, e.g. AArch64: do_trap_hypervisor(HSR_EC_HVC64) -> 

do_trap_hypercall -> do_hvm_op(HVMOP_guest_request_vm_event). Notice that do_trap_hypercall checks if the PC has changed after doing the hypercall. If it didn't, it poisons the hypercall argument registers, as on X86 (DEADBEEF), which happens on a debug build, which means that the PC isn't updated anywhere. I've also noticed that this seems to hold for other hvm ops such as HVMOP_set_param/HVMOP_get_param. I'm wondering if the logic behind this is ok as it is or if I should call advance_pc after handling HVMOP_guest_request_vm_event in do_hvm_op (?)

Thank you,
Corneliu.

#28 lore raw
Quoted 42 lines · Corneliu ZUZU
Quoted 22 lines · Corneliu ZUZU

This patch adds ARM support for guest-request monitor vm-events.

Summary of changes:
== Moved to common-side:
* XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST handling (moved from X86 arch_monitor_domctl_event to common monitor_domctl)
* hvm_event_guest_request, hvm_event_traps (also added target vcpu
as param)
* guest-request bits from X86 'struct arch_domain' (to common
'struct domain')
== ARM implementations:
* do_hvm_op now handling of HVMOP_guest_request_vm_event => calls hvm_event_guest_request (as on X86)
* arch_monitor_get_capabilities: updated to reflect support for XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST
* vm_event_init_domain (does nothing), vm_event_cleanup_domain
== Misc:
* hvm_event_fill_regs renamed to arch_hvm_event_fill_regs, no longer X86-specific. ARM-side implementation of this function
currently does
nothing, that will be added in a separate patch.

Quoted 1 line

Before sending in the next revision of this patch, I have a few questions I'd like to ask.
That being the case, I thought it would be ok to also include *all* the changes that will be done in the next revision here for (potentially) additional feedback.

Already discussed changes TBD:
* Add #define altp2m_active(d) (0) and implement p2m_get_vcpu_altp2m_idx(v) for ARM to remove #ifdef CONFIG_X86 in hvm_event_traps (Stefano, Tamas)
* Remove wrong copyright comment (Jan)
* Change bitfields members type back to unsigned int (Jan)
* Move hvm_event_traps and hvm_event_guest_request to common/vm_event.c and rename them to vm_event_traps and vm_event_guest_request (Jan)

Questions:

Quoted 8 lines

1) I've noticed the practice in Xen is to prepend the arch_ prefix to functions that usually have a counterpart on the common-side, i.e. there are a lot of arch-specific functions missing this prefix. Would it then be advised to:
- rename arch_monitor_get_capabilities to
vm_event_monitor_get_capabilities and move it to vm_event.h
- rename arch_hvm_event_fill_regs to vm_event_fill_regs and move it
to vm_event.h

Please see the recent commit adc75eba8b15c7103a010f736fe62e3fb2383964 in staging.

Cheers,
Razvan

#29 lore raw
Quoted 50 lines · Razvan Cojocaru
Quoted 41 lines · Corneliu ZUZU
Quoted 22 lines · Corneliu ZUZU

This patch adds ARM support for guest-request monitor vm-events.

Summary of changes:
== Moved to common-side:
* XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST handling (moved from X86 arch_monitor_domctl_event to common monitor_domctl)
* hvm_event_guest_request, hvm_event_traps (also added target vcpu
as param)
* guest-request bits from X86 'struct arch_domain' (to common
'struct domain')
== ARM implementations:
* do_hvm_op now handling of HVMOP_guest_request_vm_event => calls hvm_event_guest_request (as on X86)
* arch_monitor_get_capabilities: updated to reflect support for XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST
* vm_event_init_domain (does nothing), vm_event_cleanup_domain
== Misc:
* hvm_event_fill_regs renamed to arch_hvm_event_fill_regs, no longer X86-specific. ARM-side implementation of this function
currently does
nothing, that will be added in a separate patch.

Quoted 1 line

Before sending in the next revision of this patch, I have a few questions I'd like to ask.
That being the case, I thought it would be ok to also include *all* the changes that will be done in the next revision here for (potentially) additional feedback.

Already discussed changes TBD:
* Add #define altp2m_active(d) (0) and implement p2m_get_vcpu_altp2m_idx(v) for ARM to remove #ifdef CONFIG_X86 in hvm_event_traps (Stefano, Tamas)
* Remove wrong copyright comment (Jan)
* Change bitfields members type back to unsigned int (Jan)
* Move hvm_event_traps and hvm_event_guest_request to common/vm_event.c and rename them to vm_event_traps and vm_event_guest_request (Jan)

Questions:

Quoted 8 lines

1) I've noticed the practice in Xen is to prepend the arch_ prefix to functions that usually have a counterpart on the common-side, i.e. there are a lot of arch-specific functions missing this prefix. Would it then be advised to:
- rename arch_monitor_get_capabilities to
vm_event_monitor_get_capabilities and move it to vm_event.h
- rename arch_hvm_event_fill_regs to vm_event_fill_regs and move it
to vm_event.h

Quoted 7 lines

Please see the recent commit adc75eba8b15c7103a010f736fe62e3fb2383964 in staging.

Cheers,
Razvan

Great, that settles arch_hvm_event_fill_regs -> vm_event_fill_regs. Should I then do the same for arch_monitor_get_capabilities (-> vm_event_monitor_get_capabilities)?

Thanks,
Corneliu.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#30 lore raw
Quoted 55 lines · Corneliu ZUZU
Quoted 54 lines · Razvan Cojocaru
Quoted 41 lines · Corneliu ZUZU
Quoted 22 lines · Corneliu ZUZU

This patch adds ARM support for guest-request monitor vm-events.

Summary of changes:
== Moved to common-side:
* XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST handling (moved from X86 arch_monitor_domctl_event to common monitor_domctl)
* hvm_event_guest_request, hvm_event_traps (also added target vcpu
as param)
* guest-request bits from X86 'struct arch_domain' (to common
'struct domain')
== ARM implementations:
* do_hvm_op now handling of HVMOP_guest_request_vm_event => calls hvm_event_guest_request (as on X86)
* arch_monitor_get_capabilities: updated to reflect support for XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST
* vm_event_init_domain (does nothing), vm_event_cleanup_domain
== Misc:
* hvm_event_fill_regs renamed to arch_hvm_event_fill_regs, no longer X86-specific. ARM-side implementation of this function
currently does
nothing, that will be added in a separate patch.

Quoted 1 line

Before sending in the next revision of this patch, I have a few questions I'd like to ask.
That being the case, I thought it would be ok to also include *all* the changes that will be done in the next revision here for (potentially) additional feedback.

Already discussed changes TBD:
* Add #define altp2m_active(d) (0) and implement p2m_get_vcpu_altp2m_idx(v) for ARM to remove #ifdef CONFIG_X86 in hvm_event_traps (Stefano, Tamas)
* Remove wrong copyright comment (Jan)
* Change bitfields members type back to unsigned int (Jan)
* Move hvm_event_traps and hvm_event_guest_request to common/vm_event.c and rename them to vm_event_traps and vm_event_guest_request (Jan)

Questions:

Quoted 8 lines

1) I've noticed the practice in Xen is to prepend the arch_ prefix to functions that usually have a counterpart on the common-side, i.e. there are a lot of arch-specific functions missing this prefix. Would it then be advised to:
- rename arch_monitor_get_capabilities to
vm_event_monitor_get_capabilities and move it to vm_event.h
- rename arch_hvm_event_fill_regs to vm_event_fill_regs and move it
to vm_event.h

Please see the recent commit adc75eba8b15c7103a010f736fe62e3fb2383964 in staging.

Quoted 7 lines
Quoted 3 lines

Cheers,
Razvan

Great, that settles arch_hvm_event_fill_regs -> vm_event_fill_regs. Should I then do the same for arch_monitor_get_capabilities (-> vm_event_monitor_get_capabilities)?

Sounds good to me, so yes, unless Tamas or Jan think otherwise.

Thanks,
Razvan

#31 lore raw
Quoted 8 lines
Quoted 5 lines

Great, that settles arch_hvm_event_fill_regs -> vm_event_fill_regs. Should I then do the same for arch_monitor_get_capabilities (-> vm_event_monitor_get_capabilities)?

Sounds good to me, so yes, unless Tamas or Jan think otherwise.

SGTM too.

Tamas

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#33 lore raw
Quoted 11 lines · Tamas K Lengyel

2) For Tamas: would it be ok if I put p2m_get_vcpu_altp2m_idx in asm/altp2m.h and rename it to altp2m_vcpu_idx(v) (to obey function-naming pattern in that file)?

Yes, that works.

Tamas

Thanks. Any thoughts on 3)?

Corneliu.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel