diff mbox series

[v1,07/19] xen/sysctl: wrap around XEN_SYSCTL_lockprof_op

Message ID 20250312040632.2853485-8-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
The following function is only to serve spinlock profiling via
XEN_SYSCTL_lockprof_op, so it shall be wrapped:
- spinlock_profile_control

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

Patch

diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c
index 38caa10a2e..0389293b09 100644
--- a/xen/common/spinlock.c
+++ b/xen/common/spinlock.c
@@ -690,6 +690,7 @@  void cf_check spinlock_profile_reset(unsigned char key)
     spinlock_profile_iterate(spinlock_profile_reset_elem, NULL);
 }
 
+#ifdef CONFIG_SYSCTL
 typedef struct {
     struct xen_sysctl_lockprof_op *pc;
     int                      rc;
@@ -749,6 +750,7 @@  int spinlock_profile_control(struct xen_sysctl_lockprof_op *pc)
 
     return rc;
 }
+#endif /* CONFIG_SYSCTL */
 
 void _lock_profile_register_struct(
     int32_t type, struct lock_profile_qhead *qhead, int32_t idx)
diff --git a/xen/include/xen/spinlock.h b/xen/include/xen/spinlock.h
index ca9d8c7ec0..7f2a814ee0 100644
--- a/xen/include/xen/spinlock.h
+++ b/xen/include/xen/spinlock.h
@@ -164,7 +164,14 @@  void _lock_profile_deregister_struct(int32_t type,
 #define lock_profile_deregister_struct(type, ptr)                             \
     _lock_profile_deregister_struct(type, &((ptr)->profile_head))
 
+#ifdef CONFIG_SYSCTL
 extern int spinlock_profile_control(struct xen_sysctl_lockprof_op *pc);
+#else
+static inline int spinlock_profile_control(struct xen_sysctl_lockprof_op *pc)
+{
+    return -EOPNOTSUPP;
+}
+#endif
 extern void cf_check spinlock_profile_printall(unsigned char key);
 extern void cf_check spinlock_profile_reset(unsigned char key);