diff options
author | Ravi Bangoria <ravi.bangoria@amd.com> | 2023-05-04 14:00:00 +0300 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2023-05-08 11:58:30 +0300 |
commit | 0d6d062ca27ec7ef547712d34dcfcfb952bcef53 (patch) | |
tree | 4dd7299fe36002612a9b9b00f9f64e03e71b926e /include/linux/perf_event.h | |
parent | ac9a78681b921877518763ba0e89202254349d1b (diff) | |
download | linux-0d6d062ca27ec7ef547712d34dcfcfb952bcef53.tar.xz |
perf/core: Rework forwarding of {task|cpu}-clock events
Currently, PERF_TYPE_SOFTWARE is treated specially since task-clock and
cpu-clock events are interfaced through it but internally gets forwarded
to their own pmus.
Rework this by overwriting event->attr.type in perf_swevent_init() which
will cause perf_init_event() to retry with updated type and event will
automatically get forwarded to right pmu. With the change, SW pmu no
longer needs to be treated specially and can be included in 'pmu_idr'
list.
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Ravi Bangoria <ravi.bangoria@amd.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20230504110003.2548-2-ravi.bangoria@amd.com
Diffstat (limited to 'include/linux/perf_event.h')
-rw-r--r-- | include/linux/perf_event.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index d5628a7b5eaa..bf4f346d6d70 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -295,6 +295,8 @@ struct perf_event_pmu_context; struct perf_output_handle; +#define PMU_NULL_DEV ((void *)(~0UL)) + /** * struct pmu - generic performance monitoring unit */ @@ -827,6 +829,14 @@ struct perf_event { void *security; #endif struct list_head sb_list; + + /* + * Certain events gets forwarded to another pmu internally by over- + * writing kernel copy of event->attr.type without user being aware + * of it. event->orig_type contains original 'type' requested by + * user. + */ + __u32 orig_type; #endif /* CONFIG_PERF_EVENTS */ }; |