History

perf, hw_breakpoint: Fix crash in hw_breakpoint creation

hw_breakpoint creation needs to account stuff per-task to ensure there is always sufficient hardware resources to back these things due to ptrace. With the perf per pmu context changes the event initialization no longer has access to the event context, for the simple reason that we need to first find the pmu (result of initialization) before we can find the context. This makes hw_breakpoints unhappy, because it can no longer do per task accounting, cure this by frobbing a task pointer in the event::hw bits for now...

Peter Zijlstra committed 16 years ago

Commit d580ff81 parent c6be5a53 files · +29 −9Browse files

Showing the changes to include (1 of 3 files). Show all

Unified · Split

include/linux/perf_event.h+7−0
@@ -536,6 +536,12 @@ struct hw_perf_event { · 535 unmodified lines
536 struct { /* breakpoint */536 struct { /* breakpoint */
537 struct arch_hw_breakpoint info;537 struct arch_hw_breakpoint info;
538 struct list_head bp_list;538 struct list_head bp_list;
539 /*
540 * Crufty hack to avoid the chicken and egg
541 * problem hw_breakpoint has with context
542 * creation and event initalization.
543 */
544 struct task_struct *bp_target;
539 };545 };
540#endif546#endif
541 };547 };
@@ -693,6 +699,7 @@ struct swevent_hlist { · 151 unmodified lines
693 699
694#define PERF_ATTACH_CONTEXT 0x01700#define PERF_ATTACH_CONTEXT 0x01
695#define PERF_ATTACH_GROUP 0x02701#define PERF_ATTACH_GROUP 0x02
702#define PERF_ATTACH_TASK 0x04
696 703
697/**704/**
698 * struct perf_event - performance event kernel representation:705 * struct perf_event - performance event kernel representation:

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t