Skip to content

Commit 88ec7ee

Browse files
Kan LiangIngo Molnar
authored andcommitted
perf/x86: Fix low freqency setting issue
Perf doesn't work at low frequencies: $ perf record -e cpu_core/instructions/ppp -F 120 Error: The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (cpu_core/instructions/ppp). "dmesg | grep -i perf" may provide additional information. The limit_period() check avoids a low sampling period on a counter. It doesn't intend to limit the frequency. The check in the x86_pmu_hw_config() should be limited to non-freq mode. The attr.sample_period and attr.sample_freq are union. The attr.sample_period should not be used to indicate the frequency mode. Fixes: c46e665 ("perf/x86: Add INST_RETIRED.ALL workarounds") Signed-off-by: Kan Liang <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Reviewed-by: Ravi Bangoria <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Closes: https://lore.kernel.org/lkml/[email protected]/
1 parent bddf10d commit 88ec7ee

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/events/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ int x86_pmu_hw_config(struct perf_event *event)
628628
if (event->attr.type == event->pmu->type)
629629
event->hw.config |= x86_pmu_get_event_config(event);
630630

631-
if (event->attr.sample_period && x86_pmu.limit_period) {
631+
if (!event->attr.freq && x86_pmu.limit_period) {
632632
s64 left = event->attr.sample_period;
633633
x86_pmu.limit_period(event, &left);
634634
if (left > event->attr.sample_period)

0 commit comments

Comments
 (0)