Re: [PATCH] perf/core: move all of the pmu devices into their own location

Greg Kroah-Hartman
2025-02-04T07:05:57Z

On Mon, Feb 03, 2025 at 11:44:13AM -0800, Ian Rogers wrote:
> On Mon, Feb 3, 2025 at 11:25 AM Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> >
> > In sysfs, for some reason, all pmu devices seem to show up in the "root"
> > of /sys/devices/ making for a confusing mess as these devices are not
> > really at the root of the system at all.
> >
> > Create a fake root devices, "pmu_bus" and place them all under there if
> > they do not already have a parent device set, cleaning up sysfs to look
> > more sane.
> >
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Cc: Ingo Molnar <mingo@redhat.com>
> > Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
> > Cc: Namhyung Kim <namhyung@kernel.org>
> > Cc: Mark Rutland <mark.rutland@arm.com>
> > Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> > Cc: Jiri Olsa <jolsa@kernel.org>
> > Cc: Ian Rogers <irogers@google.com>
> > Cc: Adrian Hunter <adrian.hunter@intel.com>
> > Cc: "Liang, Kan" <kan.liang@linux.intel.com>
> > Cc: linux-perf-users@vger.kernel.org
> > Cc: linux-kernel@vger.kernel.org
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > ---
> >
> > Note, if you all don't like "pmu_bus" for the name, that's fine, please
> > let me know and I can rename it to something else, but it should be
> > something to get these objects out of the root sysfs directory.
>
> Excuse my ignorance, does the event_source bus already provide a
> similar solution?
> ```
> $ ls /sys/bus/event_source/devices
> breakpoint i915 msr uncore_arb uncore_cbox_3
> uncore_cbox_7 uprobe
> cpu intel_bts power uncore_cbox_0 uncore_cbox_4 uncore_clock
> cstate_core intel_pt software uncore_cbox_1 uncore_cbox_5
> uncore_imc_free_running_0
> cstate_pkg kprobe tracepoint uncore_cbox_2 uncore_cbox_6
> uncore_imc_free_running_1
> $ ls /sys/devices
> breakpoint intel_pt platform uncore_arb uncore_cbox_5
> uprobe
> cpu isa pnp0 uncore_cbox_0 uncore_cbox_6
> virtual
> cstate_core kprobe power uncore_cbox_1 uncore_cbox_7
> cstate_pkg LNXSYSTM:00 software uncore_cbox_2 uncore_clock
> i915 msr system uncore_cbox_3 uncore_imc_free_running_0
> intel_bts pci0000:00 tracepoint uncore_cbox_4 uncore_imc_free_running_1
> ```

Those are the exact same device structures :)

Look at /sys/bus/event_source/devices/ those are symlinks back to
/sys/devices. In other words, that's the exact same structures, and
the mess in /sys/devices/ with these event devices is what I am trying
to clean up.

thanks,

greg k-h