perf/x86/rapl: Flip logic on default events visibility
authorStephane Eranian <eranian@google.com>
Wed, 27 May 2020 22:46:57 +0000 (15:46 -0700)
committerIngo Molnar <mingo@kernel.org>
Thu, 28 May 2020 05:58:55 +0000 (07:58 +0200)
commit2a3e3f73a23b4ff2c0065d3a42edc18ad94b7851
tree137e42a50b5cc1c1f9f00c5e907d8bb31528e72f
parent5c95c68949880035b68e5c48fdf4899ec0989631
perf/x86/rapl: Flip logic on default events visibility

This patch modifies the default visibility of the attribute_group
for each RAPL event. By default if the grp.is_visible field is NULL,
sysfs considers that it must display the attribute group.
If the field is not NULL (callback function), then the return value
of the callback determines the visibility (0 = not visible). The RAPL
attribute groups had the field set to NULL, meaning that unless they
failed the probing from perf_msr_probe(), they would be visible. We want
to avoid having to specify attribute groups that are not supported by the HW
in the rapl_msrs[] array, they don't have an MSR address to begin with.

Therefore, we intialize the visible field of all RAPL attribute groups
to a callback that returns 0. If the RAPL msr goes through probing
and succeeds the is_visible field will be set back to NULL (visible).
If the probing fails the field is set to a callback that return 0 (not visible).

Signed-off-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20200527224659.206129-4-eranian@google.com
arch/x86/events/rapl.c