Skip to contentSkip to conversation

xen: fix HYPERVISOR_dm_op() prototype

PATCH In review Sergey Dyasli 2 participants 5 messages Jun 5, 2017 – Jun 6, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen: fix HYPERVISOR_dm_op() prototype

Change the third parameter to be the required struct xen_dm_op_buf * instead of a generic void * (which blindly accepts any pointer).

---
 arch/x86/include/asm/xen/hypercall.h | 3 ++-
 include/xen/arm/hypercall.h          | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)
arch/x86/include/asm/xen/hypercall.h +2 -1
index f6d20f6cca12..e111ae874647 100644
@@ -49,6 +49,7 @@
 #include <xen/interface/physdev.h>
 #include <xen/interface/platform.h>
 #include <xen/interface/xen-mca.h>
+#include <xen/interface/hvm/dm_op.h>
 
 /*
  * The hypercall asms have to meet several constraints:
@@ -474,7 +475,7 @@ HYPERVISOR_xenpmu_op(unsigned int op, void *arg)
 
 static inline int
 HYPERVISOR_dm_op(
-	domid_t dom, unsigned int nr_bufs, void *bufs)
+	domid_t dom, unsigned int nr_bufs, struct xen_dm_op_buf *bufs)
 {
 	return _hypercall3(int, dm_op, dom, nr_bufs, bufs);
 }
include/xen/arm/hypercall.h +3 -1
index 73db4b2eeb89..d3a732d1ede8 100644
@@ -38,6 +38,7 @@
 #include <xen/interface/xen.h>
 #include <xen/interface/sched.h>
 #include <xen/interface/platform.h>
+#include <xen/interface/hvm/dm_op.h>
 
 long privcmd_call(unsigned call, unsigned long a1,
 		unsigned long a2, unsigned long a3,
@@ -53,7 +54,8 @@ int HYPERVISOR_physdev_op(int cmd, void *arg);
 int HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args);
 int HYPERVISOR_tmem_op(void *arg);
 int HYPERVISOR_vm_assist(unsigned int cmd, unsigned int type);
-int HYPERVISOR_dm_op(domid_t domid, unsigned int nr_bufs, void *bufs);
+int HYPERVISOR_dm_op(domid_t domid, unsigned int nr_bufs,
+		     struct xen_dm_op_buf *bufs);
 int HYPERVISOR_platform_op_raw(void *arg);
 static inline int HYPERVISOR_platform_op(struct xen_platform_op *op)
 {
Signature · 1 line
2.11.0
#1 lore raw

arch/x86/include/asm/xen/hypercall.h line 52

Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 05.06.17 at 10:41, <[email protected]> wrote:
arch/x86/include/asm/xen/hypercall.h +1 -0
@@ -49,6 +49,7 @@
 #include <xen/interface/physdev.h>
 #include <xen/interface/platform.h>
 #include <xen/interface/xen-mca.h>
+#include <xen/interface/hvm/dm_op.h>

Why?

arch/x86/include/asm/xen/hypercall.h HYPERVISOR_xenpmu_op(unsigned int op, void *arg) · line 478

Quoted 6 lines
arch/x86/include/asm/xen/hypercall.h +1 -1
@@ -474,7 +475,7 @@ HYPERVISOR_xenpmu_op(unsigned int op, void *arg)
 
 static inline int
 HYPERVISOR_dm_op(
-	domid_t dom, unsigned int nr_bufs, void *bufs)
+	domid_t dom, unsigned int nr_bufs, struct xen_dm_op_buf *bufs)

All you need above here is a forward declaration of the structure. We should really avoid forcing source files to include all sorts of headers without actually needing anything from them.

include/xen/arm/hypercall.h line 41

Quoted 7 lines
include/xen/arm/hypercall.h +1 -0
@@ -38,6 +38,7 @@
 #include <xen/interface/xen.h>
 #include <xen/interface/sched.h>
 #include <xen/interface/platform.h>
+#include <xen/interface/hvm/dm_op.h>

Same here.

include/xen/arm/hypercall.h int HYPERVISOR_physdev_op(int cmd, void *arg); · line 58

Quoted 7 lines
include/xen/arm/hypercall.h +2 -1
@@ -53,7 +54,8 @@ int HYPERVISOR_physdev_op(int cmd, void *arg);
 int HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args);
 int HYPERVISOR_tmem_op(void *arg);
 int HYPERVISOR_vm_assist(unsigned int cmd, unsigned int type);
-int HYPERVISOR_dm_op(domid_t domid, unsigned int nr_bufs, void *bufs);
+int HYPERVISOR_dm_op(domid_t domid, unsigned int nr_bufs,
+		     struct xen_dm_op_buf *bufs);

How come you get away with changing a declaration without also changing the matching definition?

Jan

#2 lore raw
Quoted 14 lines · Jan Beulich

arch/x86/include/asm/xen/hypercall.h line 52

Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 05.06.17 at 10:41, <[email protected]> wrote:
arch/x86/include/asm/xen/hypercall.h +1 -0
@@ -49,6 +49,7 @@
 #include <xen/interface/physdev.h>
 #include <xen/interface/platform.h>
 #include <xen/interface/xen-mca.h>
+#include <xen/interface/hvm/dm_op.h>

Why?

Quoted 2 lines
arch/x86/include/asm/xen/hypercall.h +0 -0
@@ -474,7 +475,7 @@ HYPERVISOR_xenpmu_op(unsigned int op, void *arg)
 
Quoted 8 lines

arch/x86/include/asm/xen/hypercall.h HYPERVISOR_xenpmu_op(unsigned int op, void *arg) · line 478

Quoted 4 lines
arch/x86/include/asm/xen/hypercall.h +1 -1
 static inline int
 HYPERVISOR_dm_op(
-	domid_t dom, unsigned int nr_bufs, void *bufs)
+	domid_t dom, unsigned int nr_bufs, struct xen_dm_op_buf *bufs)

All you need above here is a forward declaration of the structure. We should really avoid forcing source files to include all sorts of headers without actually needing anything from them.

Thank you for the good suggestion. I will fix this in v2.

Quoted 11 lines

include/xen/arm/hypercall.h line 41

Quoted 8 lines
include/xen/arm/hypercall.h +1 -0
@@ -38,6 +38,7 @@
 #include <xen/interface/xen.h>
 #include <xen/interface/sched.h>
 #include <xen/interface/platform.h>
+#include <xen/interface/hvm/dm_op.h>

Same here.

Quoted 10 lines

include/xen/arm/hypercall.h int HYPERVISOR_physdev_op(int cmd, void *arg); · line 58

Quoted 7 lines
include/xen/arm/hypercall.h +2 -1
@@ -53,7 +54,8 @@ int HYPERVISOR_physdev_op(int cmd, void *arg);
 int HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args);
 int HYPERVISOR_tmem_op(void *arg);
 int HYPERVISOR_vm_assist(unsigned int cmd, unsigned int type);
-int HYPERVISOR_dm_op(domid_t domid, unsigned int nr_bufs, void *bufs);
+int HYPERVISOR_dm_op(domid_t domid, unsigned int nr_bufs,
+		     struct xen_dm_op_buf *bufs);

How come you get away with changing a declaration without also changing the matching definition?

The definition of HYPERVISOR_dm_op() is in arch/arm/xen/hypercall.S

Signature · 6 lines
Thanks,
Sergey
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#3 lore raw
In reply to Jan Beulich
Quoted 14 lines · Jan Beulich

arch/x86/include/asm/xen/hypercall.h line 52

Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 05.06.17 at 10:41, <[email protected]> wrote:
arch/x86/include/asm/xen/hypercall.h +1 -0
@@ -49,6 +49,7 @@
 #include <xen/interface/physdev.h>
 #include <xen/interface/platform.h>
 #include <xen/interface/xen-mca.h>
+#include <xen/interface/hvm/dm_op.h>

Why?

Quoted 2 lines
arch/x86/include/asm/xen/hypercall.h +0 -0
@@ -474,7 +475,7 @@ HYPERVISOR_xenpmu_op(unsigned int op, void *arg)
 
Quoted 8 lines

arch/x86/include/asm/xen/hypercall.h HYPERVISOR_xenpmu_op(unsigned int op, void *arg) · line 478

Quoted 4 lines
arch/x86/include/asm/xen/hypercall.h +1 -1
 static inline int
 HYPERVISOR_dm_op(
-	domid_t dom, unsigned int nr_bufs, void *bufs)
+	domid_t dom, unsigned int nr_bufs, struct xen_dm_op_buf *bufs)

All you need above here is a forward declaration of the structure. We should really avoid forcing source files to include all sorts of headers without actually needing anything from them.

Thank you for the good suggestion. I will fix this in v2.

Quoted 11 lines

include/xen/arm/hypercall.h line 41

Quoted 8 lines
include/xen/arm/hypercall.h +1 -0
@@ -38,6 +38,7 @@
 #include <xen/interface/xen.h>
 #include <xen/interface/sched.h>
 #include <xen/interface/platform.h>
+#include <xen/interface/hvm/dm_op.h>

Same here.

Quoted 10 lines

include/xen/arm/hypercall.h int HYPERVISOR_physdev_op(int cmd, void *arg); · line 58

Quoted 7 lines
include/xen/arm/hypercall.h +2 -1
@@ -53,7 +54,8 @@ int HYPERVISOR_physdev_op(int cmd, void *arg);
 int HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args);
 int HYPERVISOR_tmem_op(void *arg);
 int HYPERVISOR_vm_assist(unsigned int cmd, unsigned int type);
-int HYPERVISOR_dm_op(domid_t domid, unsigned int nr_bufs, void *bufs);
+int HYPERVISOR_dm_op(domid_t domid, unsigned int nr_bufs,
+		     struct xen_dm_op_buf *bufs);

How come you get away with changing a declaration without also changing the matching definition?

The definition of HYPERVISOR_dm_op() is in arch/arm/xen/hypercall.S

Signature · 2 lines
Thanks,
Sergey
#4 lore raw
In reply to Sergey Dyasli

arch/x86/include/asm/xen/hypercall.h line 52

Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 05.06.17 at 10:41, <[email protected]> wrote:
arch/x86/include/asm/xen/hypercall.h +1 -0
@@ -49,6 +49,7 @@
 #include <xen/interface/physdev.h>
 #include <xen/interface/platform.h>
 #include <xen/interface/xen-mca.h>
+#include <xen/interface/hvm/dm_op.h>

Why?

arch/x86/include/asm/xen/hypercall.h HYPERVISOR_xenpmu_op(unsigned int op, void *arg) · line 478

Quoted 6 lines
arch/x86/include/asm/xen/hypercall.h +1 -1
@@ -474,7 +475,7 @@ HYPERVISOR_xenpmu_op(unsigned int op, void *arg)
 
 static inline int
 HYPERVISOR_dm_op(
-	domid_t dom, unsigned int nr_bufs, void *bufs)
+	domid_t dom, unsigned int nr_bufs, struct xen_dm_op_buf *bufs)

All you need above here is a forward declaration of the structure. We should really avoid forcing source files to include all sorts of headers without actually needing anything from them.

include/xen/arm/hypercall.h line 41

Quoted 7 lines
include/xen/arm/hypercall.h +1 -0
@@ -38,6 +38,7 @@
 #include <xen/interface/xen.h>
 #include <xen/interface/sched.h>
 #include <xen/interface/platform.h>
+#include <xen/interface/hvm/dm_op.h>

Same here.

include/xen/arm/hypercall.h int HYPERVISOR_physdev_op(int cmd, void *arg); · line 58

Quoted 7 lines
include/xen/arm/hypercall.h +2 -1
@@ -53,7 +54,8 @@ int HYPERVISOR_physdev_op(int cmd, void *arg);
 int HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args);
 int HYPERVISOR_tmem_op(void *arg);
 int HYPERVISOR_vm_assist(unsigned int cmd, unsigned int type);
-int HYPERVISOR_dm_op(domid_t domid, unsigned int nr_bufs, void *bufs);
+int HYPERVISOR_dm_op(domid_t domid, unsigned int nr_bufs,
+		     struct xen_dm_op_buf *bufs);

How come you get away with changing a declaration without also changing the matching definition?

Jan

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