Thread (4 messages) flat view 4 messages, 3 authors, 2019-12-09

Re: [RESEND PATCH v2] powerpc/kernel/sysfs: Add PMU_SYSFS config option to enable PMU SPRs sysfs file creation

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2019-12-09 10:03:57

Kajol Jain [off-list ref] 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.
...
quoted hunk ↗ jump to hunk
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help