Skip to content

Commit 01b28e4

Browse files
Kan Liangacmel
authored andcommitted
perf regs x86: Fix arch__intr_reg_mask() for the hybrid platform
The X86 specific arch__intr_reg_mask() is to check whether the kernel and hardware can collect XMM registers. But it doesn't work on some hybrid platform. Without the patch on ADL-N: $ perf record -I? available registers: AX BX CX DX SI DI BP SP IP FLAGS CS SS R8 R9 R10 R11 R12 R13 R14 R15 The config of the test event doesn't contain the PMU information. The kernel may fail to initialize it on the correct hybrid PMU and return the wrong non-supported information. Add the PMU information into the config for the hybrid platform. The same register set is supported among different hybrid PMUs. Checking the first available one is good enough. With the patch on ADL-N: $ perf record -I? available registers: AX BX CX DX SI DI BP SP IP FLAGS CS SS R8 R9 R10 R11 R12 R13 R14 R15 XMM0 XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7 XMM8 XMM9 XMM10 XMM11 XMM12 XMM13 XMM14 XMM15 Fixes: 6466ec1 ("perf regs x86: Add X86 specific arch__intr_reg_mask()") Reported-by: Ammy Yi <[email protected]> Signed-off-by: Kan Liang <[email protected]> Acked-by: Ian Rogers <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Kan Liang <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Xing Zhengjun <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 451ed80 commit 01b28e4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tools/perf/arch/x86/util/perf_regs.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include "../../../util/perf_regs.h"
1010
#include "../../../util/debug.h"
1111
#include "../../../util/event.h"
12+
#include "../../../util/pmu.h"
13+
#include "../../../util/pmu-hybrid.h"
1214

1315
const struct sample_reg sample_reg_masks[] = {
1416
SMPL_REG(AX, PERF_REG_X86_AX),
@@ -284,12 +286,22 @@ uint64_t arch__intr_reg_mask(void)
284286
.disabled = 1,
285287
.exclude_kernel = 1,
286288
};
289+
struct perf_pmu *pmu;
287290
int fd;
288291
/*
289292
* In an unnamed union, init it here to build on older gcc versions
290293
*/
291294
attr.sample_period = 1;
292295

296+
if (perf_pmu__has_hybrid()) {
297+
/*
298+
* The same register set is supported among different hybrid PMUs.
299+
* Only check the first available one.
300+
*/
301+
pmu = list_first_entry(&perf_pmu__hybrid_pmus, typeof(*pmu), hybrid_list);
302+
attr.config |= (__u64)pmu->type << PERF_PMU_TYPE_SHIFT;
303+
}
304+
293305
event_attr_init(&attr);
294306

295307
fd = sys_perf_event_open(&attr, 0, -1, -1, 0);

0 commit comments

Comments
 (0)