|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v1 06/19] xen/sysctl: wrap around XEN_SYSCTL_perfc_op
On Wed, 12 Mar 2025, Penny Zheng wrote:
> 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@xxxxxxx>
> ---
> xen/common/perfc.c | 2 ++
> xen/include/xen/perfc.h | 8 ++++++++
> 2 files changed, 10 insertions(+)
>
> 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
I think in this case it would be best to make CONFIG_PERF_COUNTERS
depending on CONFIG_SYSCTL. The consequence is that without
CONFIG_SYSCTL, xen/common/perfc.c will be disabled in the build.
> 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);
> --
> 2.34.1
>
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |