[linux-nvidia-6.17] Backport perf: Fix 0 count issue of cpu-clock#309
Open
nvmochs wants to merge 1 commit intoNVIDIA:24.04_linux-nvidia-6.17-nextfrom
Open
[linux-nvidia-6.17] Backport perf: Fix 0 count issue of cpu-clock#309nvmochs wants to merge 1 commit intoNVIDIA:24.04_linux-nvidia-6.17-nextfrom
nvmochs wants to merge 1 commit intoNVIDIA:24.04_linux-nvidia-6.17-nextfrom
Conversation
Currently cpu-clock event always returns 0 count, e.g.,
perf stat -e cpu-clock -- sleep 1
Performance counter stats for 'sleep 1':
0 cpu-clock # 0.000 CPUs utilized
1.002308394 seconds time elapsed
The root cause is the commit 'bc4394e5e79c ("perf: Fix the throttle
error of some clock events")' adds PERF_EF_UPDATE flag check before
calling cpu_clock_event_update() to update the count, however the
PERF_EF_UPDATE flag is never set when the cpu-clock event is stopped in
counting mode (pmu->dev() -> cpu_clock_event_del() ->
cpu_clock_event_stop()). This leads to the cpu-clock event count is
never updated.
To fix this issue, force to set PERF_EF_UPDATE flag for cpu-clock event
just like what task-clock does.
Fixes: bc4394e ("perf: Fix the throttle error of some clock events")
Signed-off-by: Dapeng Mi <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Reviewed-by: Ian Rogers <[email protected]>
Acked-by: Namhyung Kim <[email protected]>
Link: https://patch.msgid.link/[email protected]
(cherry picked from commit f1f9651)
Signed-off-by: Matthew R. Ochs <[email protected]>
Collaborator
|
|
clsotog
approved these changes
Feb 3, 2026
Collaborator
clsotog
left a comment
There was a problem hiding this comment.
Acked-by: Carol L Soto <[email protected]>
Collaborator
|
|
Collaborator
Author
|
Sent to Canonical. |
jamieNguyenNVIDIA
approved these changes
Feb 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently cpu-clock event always returns 0 count, e.g.,
perf stat -e cpu-clock -- sleep 1
Performance counter stats for 'sleep 1':
0 cpu-clock # 0.000 CPUs utilized
1.002308394 seconds time elapsed
The root cause is the commit 'bc4394e5e79c ("perf: Fix the throttle
error of some clock events")' adds PERF_EF_UPDATE flag check before
calling cpu_clock_event_update() to update the count, however the PERF_EF_UPDATE flag is never set when the cpu-clock event is stopped in counting mode (pmu->dev() -> cpu_clock_event_del() -> cpu_clock_event_stop()). This leads to the cpu-clock event count is never updated.
To fix this issue, force to set PERF_EF_UPDATE flag for cpu-clock event just like what task-clock does.
Fixes: bc4394e ("perf: Fix the throttle error of some clock events")
Reviewed-by: Ian Rogers [email protected]
Acked-by: Namhyung Kim [email protected]
Link: https://patch.msgid.link/[email protected] (cherry picked from commit f1f9651)
LP: https://bugs.launchpad.net/ubuntu/+source/linux-nvidia/+bug/2139648