[RESEND PATCH v2] powerpc/kernel/sysfs: Add PMU_SYSFS config option to enable PMU SPRs sysfs file creation
Michael Ellerman
mpe at ellerman.id.au
Mon Dec 9 21:01:44 AEDT 2019
Kajol Jain <kjain at linux.ibm.com> writes:
> Many of the performance moniroting unit (PMU) SPRs are
> exposed in the sysfs. "perf" API is the primary interface to program
> PMU and collect counter data in the system. So expose these
> PMU SPRs in the absence of CONFIG_PERF_EVENTS.
>
> Patch adds a new CONFIG option 'CONFIG_PMU_SYSFS'. The new config
> option used in kernel/sysfs.c for PMU SPRs sysfs file creation and
> this new option is enabled only if 'CONFIG_PERF_EVENTS' option is
> disabled.
...
> diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
> index 12543e53fa96..f3ad579c559f 100644
> --- a/arch/powerpc/platforms/Kconfig.cputype
> +++ b/arch/powerpc/platforms/Kconfig.cputype
> @@ -417,6 +417,14 @@ config PPC_MM_SLICES
> config PPC_HAVE_PMU_SUPPORT
> bool
>
> +config PMU_SYSFS
> + bool
> + default y if !PERF_EVENTS
> + help
> + This option enables PMU SPR sysfs file creation. Since PMU SPRs are
> + intended to be used via "perf" interface, config option is enabled
> + only when CONFIG_PERF_EVENTS is disabled.
This could break existing users that expect the sysfs files to exist.
The situation we have is that all these registers are currently exposed
in sysfs, but we don't *think* anything/anyone is using them.
But we're not sure, so we can't just remove them entirely. And we also
can't make them incompatible with perf, because then a user has to
choose the sysfs files OR perf, which could break someone's setup.
So the option must be user selectable, it should not depend on
PERF_EVENTS, and it should be 'default n' (which is the default).
That way it's off by default, unless someone turns it on deliberately.
cheers
More information about the Linuxppc-dev
mailing list