Message ID | 20211117153842.302159-16-alexandru.elisei@arm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | KVM: arm64: Add Statistical Profiling Extension (SPE) support | expand |
Hi Alexandru, I've been taking a look at this series, it needs a little tweak to build successfully as a module which I've appended below. Cheers, Calvin On Wed, Nov 17, 2021 at 03:38:19PM +0000, Alexandru Elisei wrote: > KVM will soon want to make use of struct arm_spe_pmu, move it to a separate > header where it will be easily accessible. This is a straightforward move > and functionality should not be impacted. > > CC: Will Deacon <will@kernel.org> > Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com> > --- <snip> > +++ b/include/linux/perf/arm_spe_pmu.h > @@ -0,0 +1,49 @@ > +/* SPDX-License-Identifier: GPL-2.0-only */ > +/* > + * Split from from drivers/perf/arm_spe_pmu.c. > + * > + * Copyright (C) 2021 ARM Limited > + */ > + > +#ifndef __ARM_SPE_PMU_H__ > +#define __ARM_SPE_PMU_H__ > + > +#include <linux/cpumask.h> > +#include <linux/perf_event.h> > +#include <linux/platform_device.h> > +#include <linux/types.h> > + > +#ifdef CONFIG_ARM_SPE_PMU Here, we need to use the IS_ENABLED() macro for the ARM_SPE_PMU=m case. Signed-off-by: Calvin Owens <calvinow@qti.qualcomm.com> --- include/linux/perf/arm_spe_pmu.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/perf/arm_spe_pmu.h b/include/linux/perf/arm_spe_pmu.h index 505a8867daad..b643e5e7a766 100644 --- a/include/linux/perf/arm_spe_pmu.h +++ b/include/linux/perf/arm_spe_pmu.h @@ -13,7 +13,7 @@ #include <linux/platform_device.h> #include <linux/types.h> -#ifdef CONFIG_ARM_SPE_PMU +#if IS_ENABLED(CONFIG_ARM_SPE_PMU) struct arm_spe_pmu { struct pmu pmu; @@ -50,6 +50,6 @@ void kvm_host_spe_init(struct arm_spe_pmu *spe_pmu); #define kvm_host_spe_init(x) do { } while(0) #endif -#endif /* CONFIG_ARM_SPE_PMU */ +#endif /* IS_ENABLED(CONFIG_ARM_SPE_PMU) */ #endif /* __ARM_SPE_PMU_H__ */
Hi Calvin, Thank you for the interest! FYI, I'm working on the next iteration of the series where I'm planning to remove the dependency on CONFIG_NUMA_BALANCING being unset. On Tue, Jul 05, 2022 at 09:57:22AM -0700, Calvin Owens wrote: > Hi Alexandru, > > I've been taking a look at this series, it needs a little tweak to > build successfully as a module which I've appended below. > > Cheers, > Calvin > > On Wed, Nov 17, 2021 at 03:38:19PM +0000, Alexandru Elisei wrote: > > KVM will soon want to make use of struct arm_spe_pmu, move it to a separate > > header where it will be easily accessible. This is a straightforward move > > and functionality should not be impacted. > > > > CC: Will Deacon <will@kernel.org> > > Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com> > > --- > > <snip> > > > +++ b/include/linux/perf/arm_spe_pmu.h > > @@ -0,0 +1,49 @@ > > +/* SPDX-License-Identifier: GPL-2.0-only */ > > +/* > > + * Split from from drivers/perf/arm_spe_pmu.c. > > + * > > + * Copyright (C) 2021 ARM Limited > > + */ > > + > > +#ifndef __ARM_SPE_PMU_H__ > > +#define __ARM_SPE_PMU_H__ > > + > > +#include <linux/cpumask.h> > > +#include <linux/perf_event.h> > > +#include <linux/platform_device.h> > > +#include <linux/types.h> > > + > > +#ifdef CONFIG_ARM_SPE_PMU > > Here, we need to use the IS_ENABLED() macro for the ARM_SPE_PMU=m case. > > Signed-off-by: Calvin Owens <calvinow@qti.qualcomm.com> > --- > include/linux/perf/arm_spe_pmu.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/include/linux/perf/arm_spe_pmu.h b/include/linux/perf/arm_spe_pmu.h > index 505a8867daad..b643e5e7a766 100644 > --- a/include/linux/perf/arm_spe_pmu.h > +++ b/include/linux/perf/arm_spe_pmu.h > @@ -13,7 +13,7 @@ > #include <linux/platform_device.h> > #include <linux/types.h> > > -#ifdef CONFIG_ARM_SPE_PMU > +#if IS_ENABLED(CONFIG_ARM_SPE_PMU) > > struct arm_spe_pmu { > struct pmu pmu; > @@ -50,6 +50,6 @@ void kvm_host_spe_init(struct arm_spe_pmu *spe_pmu); > #define kvm_host_spe_init(x) do { } while(0) > #endif > > -#endif /* CONFIG_ARM_SPE_PMU */ > +#endif /* IS_ENABLED(CONFIG_ARM_SPE_PMU) */ > > #endif /* __ARM_SPE_PMU_H__ */ > -- > 2.30.2 This indeed fixes the nasty screenfulls of errors that I get when trying to compile with CONFIG_ARM_SPE_PMU=m. If that's alright with you, I'll fold the fix into the patch and I'll CC you. Thanks, Alex
diff --git a/drivers/perf/arm_spe_pmu.c b/drivers/perf/arm_spe_pmu.c index d44bcc29d99c..ccb92c182527 100644 --- a/drivers/perf/arm_spe_pmu.c +++ b/drivers/perf/arm_spe_pmu.c @@ -27,7 +27,7 @@ #include <linux/of_address.h> #include <linux/of_device.h> #include <linux/perf_event.h> -#include <linux/perf/arm_pmu.h> +#include <linux/perf/arm_spe_pmu.h> #include <linux/platform_device.h> #include <linux/printk.h> #include <linux/slab.h> @@ -47,33 +47,6 @@ struct arm_spe_pmu_buf { void *base; }; -struct arm_spe_pmu { - struct pmu pmu; - struct platform_device *pdev; - cpumask_t supported_cpus; - struct hlist_node hotplug_node; - - int irq; /* PPI */ - u16 pmsver; - u16 min_period; - u16 counter_sz; - -#define SPE_PMU_FEAT_FILT_EVT (1UL << 0) -#define SPE_PMU_FEAT_FILT_TYP (1UL << 1) -#define SPE_PMU_FEAT_FILT_LAT (1UL << 2) -#define SPE_PMU_FEAT_ARCH_INST (1UL << 3) -#define SPE_PMU_FEAT_LDS (1UL << 4) -#define SPE_PMU_FEAT_ERND (1UL << 5) -#define SPE_PMU_FEAT_DEV_PROBED (1UL << 63) - u64 features; - - u16 max_record_sz; - u16 align; - struct perf_output_handle __percpu *handle; -}; - -#define to_spe_pmu(p) (container_of(p, struct arm_spe_pmu, pmu)) - /* Convert a free-running index from perf into an SPE buffer offset */ #define PERF_IDX2OFF(idx, buf) ((idx) % ((buf)->nr_pages << PAGE_SHIFT)) diff --git a/include/linux/perf/arm_spe_pmu.h b/include/linux/perf/arm_spe_pmu.h new file mode 100644 index 000000000000..7711e59c5727 --- /dev/null +++ b/include/linux/perf/arm_spe_pmu.h @@ -0,0 +1,49 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Split from from drivers/perf/arm_spe_pmu.c. + * + * Copyright (C) 2021 ARM Limited + */ + +#ifndef __ARM_SPE_PMU_H__ +#define __ARM_SPE_PMU_H__ + +#include <linux/cpumask.h> +#include <linux/perf_event.h> +#include <linux/platform_device.h> +#include <linux/types.h> + +#ifdef CONFIG_ARM_SPE_PMU + +struct arm_spe_pmu { + struct pmu pmu; + struct platform_device *pdev; + cpumask_t supported_cpus; + struct hlist_node hotplug_node; + + int irq; /* PPI */ + u16 pmsver; + u16 min_period; + u16 counter_sz; + +#define SPE_PMU_FEAT_FILT_EVT (1UL << 0) +#define SPE_PMU_FEAT_FILT_TYP (1UL << 1) +#define SPE_PMU_FEAT_FILT_LAT (1UL << 2) +#define SPE_PMU_FEAT_ARCH_INST (1UL << 3) +#define SPE_PMU_FEAT_LDS (1UL << 4) +#define SPE_PMU_FEAT_ERND (1UL << 5) +#define SPE_PMU_FEAT_DEV_PROBED (1UL << 63) + u64 features; + + u16 max_record_sz; + u16 align; + struct perf_output_handle __percpu *handle; +}; + +#define to_spe_pmu(p) (container_of(p, struct arm_spe_pmu, pmu)) + +#define ARMV8_SPE_PDEV_NAME "arm,spe-v1" + +#endif /* CONFIG_ARM_SPE_PMU */ + +#endif /* __ARM_SPE_PMU_H__ */
KVM will soon want to make use of struct arm_spe_pmu, move it to a separate header where it will be easily accessible. This is a straightforward move and functionality should not be impacted. CC: Will Deacon <will@kernel.org> Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com> --- drivers/perf/arm_spe_pmu.c | 29 +------------------ include/linux/perf/arm_spe_pmu.h | 49 ++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 28 deletions(-) create mode 100644 include/linux/perf/arm_spe_pmu.h