Skip to contentSkip to conversation

Vm-events: move monitor vm-events code to common-side.

PATCH In review Corneliu ZUZU 3 participants 6 messages Feb 17, 2016

lore
Share & tools
lore
#0 lore raw

v5 cover Vm-events: move monitor vm-events code to common-side.

This patch series is an attempt to move some of the monitor vm-events code to the common-side. Done to make it easier to move additional parts that can be moved to common when ARM-side implementations are to be added.

Patches summary:
1. Fix file comment

2. Move monitor_domctl to common-side.

Note: ARM support for guest-request, control-register write monitor vm-events will follow after review of this patch-series.

---
Changed since v4:
1/2: nothing changed
2/2: arch_monitor_domctl_event:
replaced !old_status w/ requested_status (equivalent but more readable)

Corneliu ZUZU (2):
xen/arm: fix file comments
xen/vm-events: Move parts of monitor_domctl code to common-side.

 MAINTAINERS                   |   1 +
 xen/arch/arm/hvm.c            |  29 +++++++-
 xen/arch/x86/monitor.c        | 153 +++++++++++-------------------------------
 xen/common/Makefile           |   1 +
 xen/common/domctl.c           |   2 +-
 xen/common/monitor.c          |  69 +++++++++++++++++++
 xen/include/asm-arm/monitor.h |  30 +++++++--
 xen/include/asm-x86/monitor.h |  53 +++++++++++++--
 xen/include/xen/monitor.h     |  30 +++++++++
 9 files changed, 245 insertions(+), 123 deletions(-)
 create mode 100644 xen/common/monitor.c
 create mode 100644 xen/include/xen/monitor.h
Signature · 1 line
2.5.0
#1 lore raw

PATCH v5 1/2 xen/arm: fix file comments

Add file header comment and local variable block @ EOF of xen/arch/arm/hvm.c.

---
Changed since v4: <nothing changed>

---
 xen/arch/arm/hvm.c | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)
xen/arch/arm/hvm.c +28 -1
index 5fd0753..056db1a 100644
@@ -1,3 +1,21 @@
+/*
+ * arch/arm/hvm.c
+ *
+ * Arch-specific hardware virtual machine abstractions.
+ *
+ * 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/config.h>
 #include <xen/init.h>
 #include <xen/lib.h>
@@ -14,7 +32,6 @@
 #include <asm/hypercall.h>
 
 long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)
-
 {
     long rc = 0;
 
@@ -65,3 +82,13 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)
 
     return rc;
 }
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
Signature · 1 line
2.5.0
#2 lore raw

PATCH v5 2/2 xen/vm-events: Move parts of monitor_domctl code to common-side.

In reply to Corneliu ZUZU

This patch moves monitor_domctl to common-side.
Purpose: move what's common to common, prepare for implementation of such vm-events on ARM.

* move get_capabilities to arch-side => arch_monitor_get_capabilities.
* add arch-side monitor op handling function => arch_monitor_domctl_op. e.g. X86-side handles XEN_DOMCTL_MONITOR_OP_EMULATE_EACH_REP op
* add arch-side monitor event handling function => arch_monitor_domctl_event. e.g. X86-side handles XEN_DOMCTL_MONITOR_EVENT_MOV_TO_MSR event enable/disable
* remove status_check

---
Changed since v4:
* arch_monitor_domctl_event @ x86/monitor.c:
replaced !old_status w/ requested_status (equivalent but more readable)

---
 MAINTAINERS                   |   1 +
 xen/arch/x86/monitor.c        | 153 +++++++++++-------------------------------
 xen/common/Makefile           |   1 +
 xen/common/domctl.c           |   2 +-
 xen/common/monitor.c          |  69 +++++++++++++++++++
 xen/include/asm-arm/monitor.h |  30 +++++++--
 xen/include/asm-x86/monitor.h |  53 +++++++++++++--
 xen/include/xen/monitor.h     |  30 +++++++++
 8 files changed, 217 insertions(+), 122 deletions(-)
 create mode 100644 xen/common/monitor.c
 create mode 100644 xen/include/xen/monitor.h
MAINTAINERS +1 -0
index f07384c..5cbb1dc 100644
@@ -355,6 +355,7 @@ M:	Tamas K Lengyel <[email protected]>
 S:	Supported
 F:	xen/common/vm_event.c
 F:	xen/common/mem_access.c
+F:	xen/common/monitor.c
 F:	xen/arch/x86/hvm/event.c
 F:	xen/arch/x86/monitor.c
 F:	xen/arch/*/vm_event.c
xen/arch/x86/monitor.c +40 -113

241 lines not on this page · raw message

xen/common/Makefile +1 -0
index 6e82b33..0d76efe 100644
@@ -20,6 +20,7 @@ obj-y += lib.o
 obj-y += lzo.o
 obj-$(CONFIG_HAS_MEM_ACCESS) += mem_access.o
 obj-y += memory.o
+obj-y += monitor.o
 obj-y += multicall.o
 obj-y += notifier.o
 obj-y += page_alloc.o
xen/common/domctl.c +1 -1
index 22fa5d5..b34c0a1 100644
@@ -25,11 +25,11 @@
 #include <xen/paging.h>
 #include <xen/hypercall.h>
 #include <xen/vm_event.h>
+#include <xen/monitor.h>
 #include <asm/current.h>
 #include <asm/irq.h>
 #include <asm/page.h>
 #include <asm/p2m.h>
-#include <asm/monitor.h>
 #include <public/domctl.h>
 #include <xsm/xsm.h>
 
xen/common/monitor.c new file +69 -0

69 lines not on this page · raw message

xen/include/asm-arm/monitor.h +26 -4
index a3a9703..82a4a66 100644
@@ -1,9 +1,10 @@
 /*
  * include/asm-arm/monitor.h
  *
- * Architecture-specific monitor_op domctl handler.
+ * Arch-specific monitor_op domctl handler.
  *
  * Copyright (c) 2015 Tamas K Lengyel ([email protected])
+ * Copyright (c) 2016, Bitdefender S.R.L.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public
@@ -24,10 +25,31 @@
 #include <xen/sched.h>
 #include <public/domctl.h>
 
+static inline uint32_t arch_monitor_get_capabilities(struct domain *d)
+{
+    /* No monitor vm-events implemented on ARM. */
+    return 0;
+}
+
+static inline
+int arch_monitor_domctl_op(struct domain *d, struct xen_domctl_monitor_op *mop)
+{
+    /* No arch-specific monitor ops on ARM. */
+    return -EOPNOTSUPP;
+}
+
 static inline
-int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *op)
+int arch_monitor_domctl_event(struct domain *d,
+                              struct xen_domctl_monitor_op *mop)
 {
-    return -ENOSYS;
+    /*
+     * No arch-specific monitor vm-events on ARM.
+     *
+     * Should not be reached unless arch_monitor_get_capabilities() is not
+     * properly implemented.
+     */
+    ASSERT_UNREACHABLE();
+    return -EOPNOTSUPP;
 }
 
-#endif /* __ASM_X86_MONITOR_H__ */
+#endif /* __ASM_ARM_MONITOR_H__ */
xen/include/asm-x86/monitor.h +49 -4

69 lines not on this page · raw message

xen/include/xen/monitor.h new file +30 -0
new file mode 100644
index 0000000..7015e6d
@@ -0,0 +1,30 @@
+/*
+ * include/xen/monitor.h
+ *
+ * Common monitor_op domctl handler.
+ *
+ * Copyright (c) 2015 Tamas K Lengyel ([email protected])
+ * Copyright (c) 2016, Bitdefender S.R.L.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License v2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that 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/>.
+ */
+
+#ifndef __XEN_MONITOR_H__
+#define __XEN_MONITOR_H__
+
+struct domain;
+struct xen_domctl_monitor_op;
+
+int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *op);
+
+#endif /* __XEN_MONITOR_H__ */
Signature · 1 line
2.5.0
Acked-by on v5 2/2
#3 lore raw

Re: [PATCH v5 2/2] xen/vm-events: Move parts of monitor_domctl code to common-side.

Quoted 13 lines · Corneliu ZUZU

This patch moves monitor_domctl to common-side.
Purpose: move what's common to common, prepare for implementation of such vm-events on ARM.

* move get_capabilities to arch-side => arch_monitor_get_capabilities.
* add arch-side monitor op handling function => arch_monitor_domctl_op. e.g. X86-side handles XEN_DOMCTL_MONITOR_OP_EMULATE_EACH_REP op
* add arch-side monitor event handling function => arch_monitor_domctl_event.
e.g. X86-side handles XEN_DOMCTL_MONITOR_EVENT_MOV_TO_MSR event
enable/disable
* remove status_check

Quoted 4 lines

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

#4 lore raw
In reply to Corneliu ZUZU
Quoted 3 lines · Corneliu ZUZU

This patch series is an attempt to move some of the monitor vm-events code to the common-side. Done to make it easier to move additional parts that can be moved to common when ARM-side implementations are to be added.

Both applied.

Quoted 42 lines

Patches summary:
1. Fix file comment

2. Move monitor_domctl to common-side.

Note: ARM support for guest-request, control-register write monitor vm-events will follow after review of this patch-series.

---
Changed since v4:
1/2: nothing changed
2/2: arch_monitor_domctl_event:
replaced !old_status w/ requested_status (equivalent but more readable)

Corneliu ZUZU (2):
xen/arm: fix file comments
xen/vm-events: Move parts of monitor_domctl code to common-side.

 MAINTAINERS                   |   1 +
 xen/arch/arm/hvm.c            |  29 +++++++-
 xen/arch/x86/monitor.c        | 153 +++++++++++-------------------------------
 xen/common/Makefile           |   1 +
 xen/common/domctl.c           |   2 +-
 xen/common/monitor.c          |  69 +++++++++++++++++++
 xen/include/asm-arm/monitor.h |  30 +++++++--
 xen/include/asm-x86/monitor.h |  53 +++++++++++++--
 xen/include/xen/monitor.h     |  30 +++++++++
 9 files changed, 245 insertions(+), 123 deletions(-)
 create mode 100644 xen/common/monitor.c
 create mode 100644 xen/include/xen/monitor.h
Signature · 7 lines
2.5.0


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#5 lore raw
Quoted 46 lines · Konrad Rzeszutek Wilk
Quoted 3 lines · Corneliu ZUZU

This patch series is an attempt to move some of the monitor vm-events code to the common-side. Done to make it easier to move additional parts that can be moved to common when ARM-side implementations are to be added.

Both applied.

Quoted 41 lines

Patches summary:
1. Fix file comment

2. Move monitor_domctl to common-side.

Note: ARM support for guest-request, control-register write monitor vm-events will follow after review of this patch-series.

---
Changed since v4:
1/2: nothing changed
2/2: arch_monitor_domctl_event:
replaced !old_status w/ requested_status (equivalent but more readable)

Corneliu ZUZU (2):
xen/arm: fix file comments
xen/vm-events: Move parts of monitor_domctl code to common-side.

  MAINTAINERS                   |   1 +
  xen/arch/arm/hvm.c            |  29 +++++++-
  xen/arch/x86/monitor.c        | 153 +++++++++++-------------------------------
  xen/common/Makefile           |   1 +
  xen/common/domctl.c           |   2 +-
  xen/common/monitor.c          |  69 +++++++++++++++++++
  xen/include/asm-arm/monitor.h |  30 +++++++--
  xen/include/asm-x86/monitor.h |  53 +++++++++++++--
  xen/include/xen/monitor.h     |  30 +++++++++
  9 files changed, 245 insertions(+), 123 deletions(-)

create mode 100644 xen/common/monitor.c
create mode 100644 xen/include/xen/monitor.h

Signature · 7 lines
2.5.0


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

Thanks!

Corneliu.