-
Notifications
You must be signed in to change notification settings - Fork 122
[Deepin-Kernel-SIG] [linux 6.6-y] [Upstream] [Intel] Backport bugfixes for SRF LBR branch counter #838
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Deepin-Kernel-SIG] [linux 6.6-y] [Upstream] [Intel] Backport bugfixes for SRF LBR branch counter #838
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4002,8 +4002,12 @@ static int intel_pmu_hw_config(struct perf_event *event) | |||||||||||
| x86_pmu.pebs_aliases(event); | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| if (needs_branch_stack(event) && is_sampling_event(event)) | ||||||||||||
| event->hw.flags |= PERF_X86_EVENT_NEEDS_BRANCH_STACK; | ||||||||||||
| if (needs_branch_stack(event)) { | ||||||||||||
| /* Avoid branch stack setup for counting events in SAMPLE READ */ | ||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: Clarify SAMPLE_READ logic in comment Consider updating the comment to clarify that branch stack setup is skipped only when the event is not a sampling event and PERF_SAMPLE_READ is set.
Suggested change
|
||||||||||||
| if (is_sampling_event(event) || | ||||||||||||
| !(event->attr.sample_type & PERF_SAMPLE_READ)) | ||||||||||||
| event->hw.flags |= PERF_X86_EVENT_NEEDS_BRANCH_STACK; | ||||||||||||
|
Comment on lines
+4008
to
+4009
|
||||||||||||
| !(event->attr.sample_type & PERF_SAMPLE_READ)) | |
| event->hw.flags |= PERF_X86_EVENT_NEEDS_BRANCH_STACK; | |
| !(event->attr.sample_type & PERF_SAMPLE_READ)) { | |
| event->hw.flags |= PERF_X86_EVENT_NEEDS_BRANCH_STACK; | |
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -110,9 +110,16 @@ static inline bool is_topdown_event(struct perf_event *event) | |
| return is_metric_event(event) || is_slots_event(event); | ||
| } | ||
|
|
||
| int is_x86_event(struct perf_event *event); | ||
|
||
|
|
||
| static inline bool check_leader_group(struct perf_event *leader, int flags) | ||
| { | ||
| return is_x86_event(leader) ? !!(leader->hw.flags & flags) : false; | ||
| } | ||
|
|
||
| static inline bool is_branch_counters_group(struct perf_event *event) | ||
| { | ||
| return event->group_leader->hw.flags & PERF_X86_EVENT_BRANCH_COUNTERS; | ||
| return check_leader_group(event->group_leader, PERF_X86_EVENT_BRANCH_COUNTERS); | ||
| } | ||
|
|
||
| struct amd_nb { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Since
is_x86_eventreturns a boolean-like result, consider changing its return type toboolfor clarity and consistency with other predicate functions.