Skip to contentSkip to conversation

PATCH: remove perfcounter array bound

PATCH Tristan Gingold 1 participant 1 message Aug 4, 2006

lore
Share & tools
lore
#0 lore raw

Hi,

the current dom0_perfcounter hypercall has a limit on the number of values per counter (64). On ia64 we'd like to use arrays bigger than this limit. This patch removes this hard-limit: perfcounter descriptors and values are now passed by two distinct buffers.

This break the API compatibility. However because DOM0_PERFCCONTROL is used only by xenperf and only by developpers the patch didn't change DOM0_INTERFACE_VERSION.

Tested on ia64.

Tristan.

# HG changeset patch
# User gingold@virtu10
# Node ID 6286aede6482ff468795ca9d9c58c94fae2dd758 # Parent 90fe9eed7f98394743b5499d28d92bf8f71ffa38 Change DOM0_PERFCCONTROL: remove array limit.

Descriptors and values are passed by two distinct buffers.

tools/libxc/xc_misc.c +11 -2
diff -r 90fe9eed7f98 -r 6286aede6482 tools/libxc/xc_misc.c
@@ -68,7 +68,10 @@ int xc_sched_id(int xc_handle,
 
 int xc_perfc_control(int xc_handle,
                      uint32_t opcode,
-                     xc_perfc_desc_t *desc)
+                     xc_perfc_desc_t *desc,
+                     xc_perfc_val_t *val,
+                     int *nbr_desc,
+                     int *nbr_val)
 {
     int rc;
     DECLARE_DOM0_OP;
@@ -76,10 +79,16 @@ int xc_perfc_control(int xc_handle,
     op.cmd = DOM0_PERFCCONTROL;
     op.u.perfccontrol.op   = opcode;
     set_xen_guest_handle(op.u.perfccontrol.desc, desc);
+    set_xen_guest_handle(op.u.perfccontrol.val, val);
 
     rc = do_dom0_op(xc_handle, &op);
 
-    return (rc == 0) ? op.u.perfccontrol.nr_counters : rc;
+    if (nbr_desc)
+        *nbr_desc = op.u.perfccontrol.nr_counters;
+    if (nbr_val)
+        *nbr_val = op.u.perfccontrol.nr_vals;
+
+    return rc;
 }
 
 long long xc_msr_read(int xc_handle, int cpu_mask, int msr)
tools/libxc/xenctrl.h +7 -2
diff -r 90fe9eed7f98 -r 6286aede6482 tools/libxc/xenctrl.h
@@ -466,10 +466,15 @@ unsigned long xc_make_page_below_4G(int 
                                     unsigned long mfn);
 
 typedef dom0_perfc_desc_t xc_perfc_desc_t;
-/* IMPORTANT: The caller is responsible for mlock()'ing the @desc array. */
+typedef dom0_perfc_val_t xc_perfc_val_t;
+/* IMPORTANT: The caller is responsible for mlock()'ing the @desc and @val
+   arrays. */
 int xc_perfc_control(int xc_handle,
                      uint32_t op,
-                     xc_perfc_desc_t *desc);
+                     xc_perfc_desc_t *desc,
+                     xc_perfc_val_t *val,
+                     int *nbr_desc,
+                     int *nbr_val);
 
 /* read/write msr */
 long long xc_msr_read(int xc_handle, int cpu_mask, int msr);
tools/misc/xenperf.c +35 -25

96 lines not on this page · raw message

xen/common/perfc.c +25 -16

100 lines not on this page · raw message

xen/include/public/dom0_ops.h +5 -2
diff -r 90fe9eed7f98 -r 6286aede6482 xen/include/public/dom0_ops.h
@@ -361,17 +361,20 @@ struct dom0_perfc_desc {
 struct dom0_perfc_desc {
     char         name[80];             /* name of perf counter */
     uint32_t     nr_vals;              /* number of values for this counter */
-    uint32_t     vals[64];             /* array of values */
 };
 typedef struct dom0_perfc_desc dom0_perfc_desc_t;
 DEFINE_XEN_GUEST_HANDLE(dom0_perfc_desc_t);
+typedef uint32_t dom0_perfc_val_t;
+DEFINE_XEN_GUEST_HANDLE(dom0_perfc_val_t);
 
 struct dom0_perfccontrol {
     /* IN variables. */
     uint32_t       op;                /*  DOM0_PERFCCONTROL_OP_??? */
     /* OUT variables. */
-    uint32_t       nr_counters;       /*  number of counters */
+    uint32_t       nr_counters;       /*  number of counters description  */
+    uint32_t       nr_vals;			  /*  number of values  */
     XEN_GUEST_HANDLE(dom0_perfc_desc_t) desc; /*  counter information (or NULL) */
+    XEN_GUEST_HANDLE(dom0_perfc_val_t) val;   /*  counter values (or NULL)  */
 };
 typedef struct dom0_perfccontrol dom0_perfccontrol_t;
 DEFINE_XEN_GUEST_HANDLE(dom0_perfccontrol_t);

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