diff mbox series

[v1,06/19] xen/sysctl: wrap around XEN_SYSCTL_perfc_op

Message ID 20250312040632.2853485-7-Penny.Zheng@amd.com (mailing list archive)
State New
Headers show
Series xen: introduce CONFIG_SYSCTL | expand

Commit Message

Penny Zheng March 12, 2025, 4:06 a.m. UTC
perfc_control() and perfc_copy_info() are responsible for providing control
of perf counters via XEN_SYSCTL_perfc_op in DOM0, so they both shall
be wrapped.

Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
---
 xen/common/perfc.c      | 2 ++
 xen/include/xen/perfc.h | 8 ++++++++
 2 files changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/xen/common/perfc.c b/xen/common/perfc.c
index 8302b7cf6d..0f3b89af2c 100644
--- a/xen/common/perfc.c
+++ b/xen/common/perfc.c
@@ -149,6 +149,7 @@  void cf_check perfc_reset(unsigned char key)
     }
 }
 
+#ifdef CONFIG_SYSCTL
 static struct xen_sysctl_perfc_desc perfc_d[NR_PERFCTRS];
 static xen_sysctl_perfc_val_t *perfc_vals;
 static unsigned int      perfc_nbr_vals;
@@ -265,6 +266,7 @@  int perfc_control(struct xen_sysctl_perfc_op *pc)
 
     return rc;
 }
+#endif /* CONFIG_SYSCTL */
 
 /*
  * Local variables:
diff --git a/xen/include/xen/perfc.h b/xen/include/xen/perfc.h
index bf0eb032f7..6cc8af12d5 100644
--- a/xen/include/xen/perfc.h
+++ b/xen/include/xen/perfc.h
@@ -5,6 +5,7 @@ 
 
 #include <xen/macros.h>
 #include <xen/percpu.h>
+#include <xen/errno.h>
 
 /*
  * NOTE: new counters must be defined in perfc_defn.h
@@ -92,7 +93,14 @@  DECLARE_PER_CPU(perfc_t[NUM_PERFCOUNTERS], perfcounters);
 #endif
 
 struct xen_sysctl_perfc_op;
+#ifdef CONFIG_SYSCTL
 int perfc_control(struct xen_sysctl_perfc_op *pc);
+#else
+static inline int perfc_control(struct xen_sysctl_perfc_op *pc)
+{
+    return -EOPNOTSUPP;
+}
+#endif
 
 extern void cf_check perfc_printall(unsigned char key);
 extern void cf_check perfc_reset(unsigned char key);