From: "tip-bot2 for Kan Liang" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Kan Liang <kan.liang@linux.intel.com>,
Ingo Molnar <mingo@kernel.org>,
Ravi Bangoria <ravi.bangoria@amd.com>,
Peter Zijlstra <peterz@infradead.org>,
stable@vger.kernel.org, x86@kernel.org,
linux-kernel@vger.kernel.org
Subject: [tip: perf/urgent] perf/x86: Fix low freqency setting issue
Date: Tue, 25 Feb 2025 14:14:57 -0000 [thread overview]
Message-ID: <174049289790.10177.11456494248824677937.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20250117151913.3043942-1-kan.liang@linux.intel.com>
The following commit has been merged into the perf/urgent branch of tip:
Commit-ID: 88ec7eedbbd21cad38707620ad6c48a4e9a87c18
Gitweb: https://git.kernel.org/tip/88ec7eedbbd21cad38707620ad6c48a4e9a87c18
Author: Kan Liang <kan.liang@linux.intel.com>
AuthorDate: Fri, 17 Jan 2025 07:19:11 -08:00
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Tue, 25 Feb 2025 14:54:14 +01:00
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: c46e665f0377 ("perf/x86: Add INST_RETIRED.ALL workarounds")
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20250117151913.3043942-1-kan.liang@linux.intel.com
Closes: https://lore.kernel.org/lkml/20250115154949.3147-1-ravi.bangoria@amd.com/
---
arch/x86/events/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
index 8f218ac..2092d61 100644
--- a/arch/x86/events/core.c
+++ b/arch/x86/events/core.c
@@ -628,7 +628,7 @@ int x86_pmu_hw_config(struct perf_event *event)
if (event->attr.type == event->pmu->type)
event->hw.config |= x86_pmu_get_event_config(event);
- if (event->attr.sample_period && x86_pmu.limit_period) {
+ if (!event->attr.freq && x86_pmu.limit_period) {
s64 left = event->attr.sample_period;
x86_pmu.limit_period(event, &left);
if (left > event->attr.sample_period)
prev parent reply other threads:[~2025-02-25 14:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-17 15:19 [PATCH 1/3] perf/x86: Fix low freq " kan.liang
2025-01-17 15:19 ` [PATCH 2/3] perf: Fix low freq setting via IOC_PERIOD kan.liang
2025-01-20 4:59 ` Ravi Bangoria
2025-02-25 14:14 ` [tip: perf/urgent] perf/core: " tip-bot2 for Kan Liang
2025-01-17 15:19 ` [RESEND PATCH 3/3] perf/x86/intel: New start period for the freq mode kan.liang
2025-02-25 14:14 ` [tip: perf/urgent] " tip-bot2 for Kan Liang
2025-02-25 19:48 ` [tip: perf/urgent] perf/x86/intel: Use better start period for frequency mode tip-bot2 for Kan Liang
2025-01-20 5:00 ` [PATCH 1/3] perf/x86: Fix low freq setting issue Ravi Bangoria
2025-02-25 14:14 ` tip-bot2 for Kan Liang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=174049289790.10177.11456494248824677937.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=ravi.bangoria@amd.com \
--cc=stable@vger.kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®