perf: core, remove hw_perf_event_init
RFC PATCH 2/9 perf: core, remove hw_perf_event_init
A new field "pmu_id" is added to struct perf_event_attr.
2 new functions: perf_event_register_pmu, perf_event_lookup_pmuperf_event_register_pmu: the pmu registration facilityperf_event_lookup_pmu: lookup the pmu via the passed in event->attr.pmu_id.
A new api pmu->init_event to replace hw_perf_event_init
--- include/linux/perf_event.h | 9 +++++++++ kernel/perf_event.c | 39 +++++++++++++++++++++++++++++++-------- 2 files changed, 40 insertions(+), 8 deletions(-)
include/linux/perf_event.h +9 -0
@@ -225,6 +225,8 @@ struct perf_event_attr {__u32 bp_type;__u64 bp_addr;__u64 bp_len; + +int pmu_id; };/*
@@ -553,6 +555,9 @@ struct perf_event;* struct pmu - generic performance monitoring unit */ struct pmu { +int id; +struct list_head entry; +int (*enable) (struct perf_event *event);void (*disable) (struct perf_event *event);int (*start) (struct perf_event *event);
@@ -569,6 +574,8 @@ struct pmu {void (*start_txn) (struct pmu *pmu);void (*cancel_txn) (struct pmu *pmu);int (*commit_txn) (struct pmu *pmu); + +int (*init_event) (struct perf_event *event); };/**
@@ -1014,6 +1021,8 @@ extern int perf_swevent_get_recursion_context(void);extern void perf_swevent_put_recursion_context (int rctx);extern void perf_event_enable (struct perf_event *event);extern void perf_event_disable (struct perf_event *event); + +extern void perf_event_register_pmu (struct pmu *pmu);#else static inline void perf_event_task_sched_in (struct task_struct *task) { }
kernel/perf_event.c +31 -8
@@ -40,6 +40,12 @@*/ static DEFINE_PER_CPU(struct perf_cpu_context, perf_cpu_context); +/* +* The list of multiple hw pmus +*/ +static struct list_head pmus; +static int pmu_id_curr; +int perf_max_events__read_mostly =1 ;static int perf_reserved_percpu__read_mostly ;static int perf_overcommit__read_mostly =1 ;
@@ -75,11 +81,6 @@ static DEFINE_SPINLOCK(perf_resource_lock);/* * Architecture provided APIs - weak aliases: */ -extern __weak struct pmu *hw_perf_event_init (struct perf_event *event) -{ -return NULL ; -} -void __weak hw_perf_disable (void ) {barrier (); }void __weak hw_perf_enable (void ) {barrier (); }
@@ -4670,6 +4671,19 @@ static struct pmu *sw_perf_event_init(struct perf_event *event)return pmu; } +static struct pmu *perf_event_lookup_pmu (struct perf_event *event) +{ +struct pmu *pmu; +int pmu_id = event->attr.pmu_id; + +list_for_each_entry (pmu, &pmus, entry) { +if (pmu->id == pmu_id) +return pmu; + } + +return NULL ; +} +/* * Allocate and initialize a event structure */
@@ -4685,7 +4699,7 @@ perf_event_alloc(struct perf_event_attr *attr,struct pmu *pmu;struct perf_event *event;struct hw_perf_event *hwc; -long err; +long err =0 ; event =kzalloc (sizeof (*event), gfpflags);if (!event)
@@ -4750,7 +4764,9 @@ perf_event_alloc(struct perf_event_attr *attr,case PERF_TYPE_RAW :case PERF_TYPE_HARDWARE :case PERF_TYPE_HW_CACHE : - pmu =hw_perf_event_init (event); + pmu =perf_event_lookup_pmu (event); +if (pmu && pmu->init_event) + err = pmu->init_event (event);break ;case PERF_TYPE_SOFTWARE :
@@ -4770,7 +4786,6 @@ perf_event_alloc(struct perf_event_attr *attr,break ; } done: - err =0 ;if (!pmu) err = -EINVAL ;else if (IS_ERR (pmu))
@@ -5627,6 +5642,8 @@ void __init perf_event_init(void)perf_cpu_notify (&perf_cpu_nb, (unsigned long )CPU_ONLINE , (void *)(long )smp_processor_id ());register_cpu_notifier (&perf_cpu_nb); + +INIT_LIST_HEAD (&pmus); } static ssize_t perf_show_reserve_percpu(struct sysdev_class *class,
@@ -5726,3 +5743,9 @@ static int __init perf_event_sysfs_init(void) &perfclass_attr_group); }device_initcall (perf_event_sysfs_init); + +void perf_event_register_pmu (struct pmu *pmu) +{ + pmu->id = pmu_id_curr++; +list_add_tail (&pmu->entry, &pmus); +}
Peter Zijlstra
maintainerQuoted 8 lines · Lin Ming
kernel/perf_event.c +8
-0+static struct pmu *perf_event_lookup_pmu (struct perf_event *event) +{ +struct pmu *pmu; +int pmu_id = event->attr.pmu_id; + +list_for_each_entry (pmu, &pmus, entry) { +if (pmu->id == pmu_id) +return pmu;
kernel/perf_event.c static struct pmu *sw_perf_event_init(struct perf_event *event)
Quoted 10 lines
kernel/perf_event.c +9
-0+ } + +return NULL ; +} +void perf_event_register_pmu (struct pmu *pmu) +{ + pmu->id = pmu_id_curr++; +list_add_tail (&pmu->entry, &pmus); +}
That will be wanting some sort of synchronization
Quoted 14 lines · Peter Zijlstra
Quoted 12 lines · Lin Ming
kernel/perf_event.c +12
-0+static struct pmu *perf_event_lookup_pmu (struct perf_event *event) +{ +struct pmu *pmu; +int pmu_id = event->attr.pmu_id; + +list_for_each_entry (pmu, &pmus, entry) { +if (pmu->id == pmu_id) +return pmu; + } + +return NULL ; +}
Quoted 7 lines
kernel/perf_event.c static int __init perf_event_sysfs_init(void) · line 5751
Quoted 5 lines
kernel/perf_event.c +5
-0+void perf_event_register_pmu (struct pmu *pmu) +{ + pmu->id = pmu_id_curr++; +list_add_tail (&pmu->entry, &pmus); +}That will be wanting some sort of synchronization
Will add a mutex to protect the list of pmus.
Peter Zijlstra
maintainerQuoted 23 lines · Lin Ming
Quoted 14 lines · Peter Zijlstra
Quoted 12 lines · Lin Ming
kernel/perf_event.c +12
-0+static struct pmu *perf_event_lookup_pmu (struct perf_event *event) +{ +struct pmu *pmu; +int pmu_id = event->attr.pmu_id; + +list_for_each_entry (pmu, &pmus, entry) { +if (pmu->id == pmu_id) +return pmu; + } + +return NULL ; +}Quoted 7 lines
kernel/perf_event.c static int __init perf_event_sysfs_init(void) · line 5751
Quoted 5 lines
kernel/perf_event.c +5
-0+void perf_event_register_pmu (struct pmu *pmu) +{ + pmu->id = pmu_id_curr++; +list_add_tail (&pmu->entry, &pmus); +}That will be wanting some sort of synchronization
Quoted 1 line
Will add a mutex to protect the list of pmus.
I'm thinking RCU might be better suited, a mutex for lookup doesn't sound ideal.
Quoted 24 lines · Peter Zijlstra
Quoted 23 lines · Lin Ming
Quoted 21 lines · Peter Zijlstra
Quoted 8 lines · Lin Ming
kernel/perf_event.c +8
-0+static struct pmu *perf_event_lookup_pmu (struct perf_event *event) +{ +struct pmu *pmu; +int pmu_id = event->attr.pmu_id; + +list_for_each_entry (pmu, &pmus, entry) { +if (pmu->id == pmu_id) +return pmu;kernel/perf_event.c static struct pmu *sw_perf_event_init(struct perf_event *event)
Quoted 10 lines
kernel/perf_event.c +9
-0+ } + +return NULL ; +} +void perf_event_register_pmu (struct pmu *pmu) +{ + pmu->id = pmu_id_curr++; +list_add_tail (&pmu->entry, &pmus); +}That will be wanting some sort of synchronization
Quoted 4 lines
Quoted 1 line
Will add a mutex to protect the list of pmus.
I'm thinking RCU might be better suited, a mutex for lookup doesn't sound ideal.
Thanks for the idea, I'll do that.
Quoted 24 lines · Peter Zijlstra
Quoted 23 lines · Lin Ming
Quoted 21 lines · Peter Zijlstra
Quoted 8 lines · Lin Ming
kernel/perf_event.c +8
-0+static struct pmu *perf_event_lookup_pmu (struct perf_event *event) +{ +struct pmu *pmu; +int pmu_id = event->attr.pmu_id; + +list_for_each_entry (pmu, &pmus, entry) { +if (pmu->id == pmu_id) +return pmu;kernel/perf_event.c static struct pmu *sw_perf_event_init(struct perf_event *event)
Quoted 10 lines
kernel/perf_event.c +9
-0+ } + +return NULL ; +} +void perf_event_register_pmu (struct pmu *pmu) +{ + pmu->id = pmu_id_curr++; +list_add_tail (&pmu->entry, &pmus); +}That will be wanting some sort of synchronization
Quoted 4 lines
Quoted 1 line
Will add a mutex to protect the list of pmus.
I'm thinking RCU might be better suited, a mutex for lookup doesn't sound ideal.
Is it really needed? I expect this function to be called on boot only.
In fact I would even suggest to tag it as __init.
Peter Zijlstra
maintainerQuoted 27 lines · Frederic Weisbecker
Quoted 26 lines · Peter Zijlstra
Quoted 24 lines · Lin Ming
Quoted 14 lines · Peter Zijlstra
Quoted 12 lines · Lin Ming
kernel/perf_event.c +12
-0+static struct pmu *perf_event_lookup_pmu (struct perf_event *event) +{ +struct pmu *pmu; +int pmu_id = event->attr.pmu_id; + +list_for_each_entry (pmu, &pmus, entry) { +if (pmu->id == pmu_id) +return pmu; + } + +return NULL ; +}Quoted 7 lines
kernel/perf_event.c static int __init perf_event_sysfs_init(void) · line 5751
Quoted 5 lines
kernel/perf_event.c +5
-0+void perf_event_register_pmu (struct pmu *pmu) +{ + pmu->id = pmu_id_curr++; +list_add_tail (&pmu->entry, &pmus); +}That will be wanting some sort of synchronization
Will add a mutex to protect the list of pmus.
Quoted 8 lines
Quoted 2 lines
I'm thinking RCU might be better suited, a mutex for lookup doesn't sound ideal.
Is it really needed? I expect this function to be called on boot only.
In fact I would even suggest to tag it as
__init.
Loadable modules as well as PCI-Hotplug need supporting.
Quoted 32 lines · Peter Zijlstra
Quoted 31 lines · Frederic Weisbecker
Quoted 28 lines · Peter Zijlstra
Quoted 23 lines · Lin Ming
Quoted 14 lines · Peter Zijlstra
Quoted 12 lines · Lin Ming
kernel/perf_event.c +12
-0+static struct pmu *perf_event_lookup_pmu (struct perf_event *event) +{ +struct pmu *pmu; +int pmu_id = event->attr.pmu_id; + +list_for_each_entry (pmu, &pmus, entry) { +if (pmu->id == pmu_id) +return pmu; + } + +return NULL ; +}Quoted 7 lines
kernel/perf_event.c static int __init perf_event_sysfs_init(void) · line 5751
Quoted 5 lines
kernel/perf_event.c +5
-0+void perf_event_register_pmu (struct pmu *pmu) +{ + pmu->id = pmu_id_curr++; +list_add_tail (&pmu->entry, &pmus); +}That will be wanting some sort of synchronization
Quoted 1 line
Will add a mutex to protect the list of pmus.
I'm thinking RCU might be better suited, a mutex for lookup doesn't sound ideal.
Quoted 6 lines
Quoted 4 lines
Is it really needed? I expect this function to be called on boot only.
In fact I would even suggest to tag it as
__init.Loadable modules as well as PCI-Hotplug need supporting.
Which module do you have in mind that could register a pmu? And I don't understand the problem with pci-hotplug.
Thanks.
Peter Zijlstra
maintainerQuoted 2 lines · Frederic Weisbecker
Which module do you have in mind that could register a pmu? And I don't understand the problem with pci-hotplug.
Well, the DRM drivers for one, but basically the trend is for every aspect of the machine to include PMUs of some form, this includes bus bridges and fancy devices.
The point about PCI-hotplug is that GPUs live on the PCI bus and once they start adding their PMU drivers we need to be able to unplug them.
Same for when the PCI bridge devices start featuring PMU implementations.
Quoted 8 lines · Peter Zijlstra
Quoted 2 lines · Frederic Weisbecker
Which module do you have in mind that could register a pmu? And I don't understand the problem with pci-hotplug.
Well, the DRM drivers for one, but basically the trend is for every aspect of the machine to include PMUs of some form, this includes bus bridges and fancy devices.
So the concept of "PMU" is really broadened here? Not just only the performance monitoring hardware in CPU?
Quoted 6 lines
The point about PCI-hotplug is that GPUs live on the PCI bus and once they start adding their PMU drivers we need to be able to unplug them.
Same for when the PCI bridge devices start featuring PMU implementations.
Quoted 6 lines · Lin Ming
Quoted 5 lines · Peter Zijlstra
Quoted 2 lines · Frederic Weisbecker
Which module do you have in mind that could register a pmu? And I don't understand the problem with pci-hotplug.
Quoted 6 lines
Quoted 3 lines
Well, the DRM drivers for one, but basically the trend is for every aspect of the machine to include PMUs of some form, this includes bus bridges and fancy devices.
So the concept of "PMU" is really broadened here? Not just only the performance monitoring hardware in CPU?
We _really_ dont want to call it a 'PMU' but 'events coming from an event source'.
The reason is that a PMU is an existing term that is quite attached to a CPU - while many hardware events come not from a PMU. Interrupts, error conditions, hotplug events, etc. etc.
Furthermore, the name 'PMU' is even less correct for software events.
So lets stick with 'events' and with some container that originates them. (event_source) Ok?
Ingo
Quoted 18 lines · Ingo Molnar
Quoted 6 lines · Lin Ming
Quoted 5 lines · Peter Zijlstra
Quoted 2 lines · Frederic Weisbecker
Which module do you have in mind that could register a pmu? And I don't understand the problem with pci-hotplug.
Quoted 6 lines
Quoted 3 lines
Well, the DRM drivers for one, but basically the trend is for every aspect of the machine to include PMUs of some form, this includes bus bridges and fancy devices.
So the concept of "PMU" is really broadened here? Not just only the performance monitoring hardware in CPU?
We _really_ dont want to call it a 'PMU' but 'events coming from an event source'.
Quoted 8 lines
The reason is that a PMU is an existing term that is quite attached to a CPU - while many hardware events come not from a PMU. Interrupts, error conditions, hotplug events, etc. etc.
Furthermore, the name 'PMU' is even less correct for software events.
So lets stick with 'events' and with some container that originates them. (
event_source) Ok?
Yeah, understand.
"events coming from an event source" is a good clarification.
Thanks.
Peter Zijlstra
maintainerQuoted 6 lines · Lin Ming
Quoted 5 lines · Peter Zijlstra
Quoted 2 lines · Frederic Weisbecker
Which module do you have in mind that could register a pmu? And I don't understand the problem with pci-hotplug.
Quoted 6 lines
Quoted 3 lines
Well, the DRM drivers for one, but basically the trend is for every aspect of the machine to include PMUs of some form, this includes bus bridges and fancy devices.
So the concept of "PMU" is really broadened here? Not just only the performance monitoring hardware in CPU?
Arguably the uncore unit is already outside of what we traditionally call a CPU ;-)
But yeah, PMUs are found in lots of things these days.
Quoted 9 lines · Peter Zijlstra
Quoted 2 lines · Frederic Weisbecker
Which module do you have in mind that could register a pmu? And I don't understand the problem with pci-hotplug.
Well, the DRM drivers for one, but basically the trend is for every aspect of the machine to include PMUs of some form, this includes bus bridges and fancy devices.
Quoted 5 lines
The point about PCI-hotplug is that GPUs live on the PCI bus and once they start adding their PMU drivers we need to be able to unplug them.
Same for when the PCI bridge devices start featuring PMU implementations.
Ah ok.
Thanks.
Peter Zijlstra
maintainerQuoted 7 lines · Lin Ming
A new field "
pmu_id" is added to structperf_event_attr.2 new functions:
perf_event_register_pmu,perf_event_lookup_pmuperf_event_register_pmu: the pmu registration facilityperf_event_lookup_pmu: lookup the pmu via the passed inevent->attr.pmu_id.A new api
pmu->init_eventto replacehw_perf_event_init
Another problem, this patch breaks all of perf by removing the weak call before there is a replacement.
Please rework such that there is a smooth transition.
Also, for compatibilities sake, the cpu pmu will be required to get pmu_id==0, this doesn't provide that.
Quoted 7 lines · Peter Zijlstra
Quoted 6 lines · Lin Ming
A new field "
pmu_id" is added to structperf_event_attr.2 new functions:
perf_event_register_pmu,perf_event_lookup_pmuperf_event_register_pmu: the pmu registration facilityperf_event_lookup_pmu: lookup the pmu via the passed inevent->attr.pmu_id.
Quoted 6 lines
Quoted 1 line
A new api
pmu->init_eventto replacehw_perf_event_initAnother problem, this patch breaks all of perf by removing the weak call before there is a replacement.
Please rework such that there is a smooth transition.
OK, I'll rework
Quoted 4 lines
Also, for compatibilities sake, the cpu pmu will be required to get pmu_id==0, this doesn't provide that.
Will provide that.
Thanks,
Lin Ming
Quoted 114 lines · Lin Ming
A new field "
pmu_id" is added to structperf_event_attr.2 new functions:
perf_event_register_pmu,perf_event_lookup_pmuperf_event_register_pmu: the pmu registration facilityperf_event_lookup_pmu: lookup the pmu via the passed inevent->attr.pmu_id.A new api
pmu->init_eventto replacehw_perf_event_initSigned-off-by Lin Ming <[email protected]>--- include/linux/perf_event.h | 9 +++++++++ kernel/perf_event.c | 39 +++++++++++++++++++++++++++++++-------- 2 files changed, 40 insertions(+), 8 deletions(-)include/linux/perf_event.h +9
-0@@ -225,6 +225,8 @@ struct perf_event_attr {__u32 bp_type;__u64 bp_addr;__u64 bp_len; + +int pmu_id; };/* @@ -553,6 +555,9 @@ struct perf_event;* struct pmu - generic performance monitoring unit */ struct pmu { +int id; +struct list_head entry; +int (*enable) (struct perf_event *event);void (*disable) (struct perf_event *event);int (*start) (struct perf_event *event);@@ -569,6 +574,8 @@ struct pmu {void (*start_txn) (struct pmu *pmu);void (*cancel_txn) (struct pmu *pmu);int (*commit_txn) (struct pmu *pmu); + +int (*init_event) (struct perf_event *event); };/** @@ -1014,6 +1021,8 @@ extern int perf_swevent_get_recursion_context(void);extern void perf_swevent_put_recursion_context (int rctx);extern void perf_event_enable (struct perf_event *event);extern void perf_event_disable (struct perf_event *event); + +extern void perf_event_register_pmu (struct pmu *pmu);#else static inline void perf_event_task_sched_in (struct task_struct *task) { }kernel/perf_event.c +20
-6@@ -40,6 +40,12 @@*/ static DEFINE_PER_CPU(struct perf_cpu_context, perf_cpu_context); +/* +* The list of multiple hw pmus +*/ +static struct list_head pmus; +static int pmu_id_curr; +int perf_max_events__read_mostly =1 ;static int perf_reserved_percpu__read_mostly ;static int perf_overcommit__read_mostly =1 ;@@ -75,11 +81,6 @@ static DEFINE_SPINLOCK(perf_resource_lock);/* * Architecture provided APIs - weak aliases: */ -extern __weak struct pmu *hw_perf_event_init (struct perf_event *event) -{ -return NULL ; -} -void __weak hw_perf_disable (void ) {barrier (); }void __weak hw_perf_enable (void ) {barrier (); }@@ -4670,6 +4671,19 @@ static struct pmu *sw_perf_event_init(struct perf_event *event)return pmu; } +static struct pmu *perf_event_lookup_pmu (struct perf_event *event) +{ +struct pmu *pmu; +int pmu_id = event->attr.pmu_id; + +list_for_each_entry (pmu, &pmus, entry) { +if (pmu->id == pmu_id) +return pmu; + } + +return NULL ; +} +/* * Allocate and initialize a event structure */ @@ -4685,7 +4699,7 @@ perf_event_alloc(struct perf_event_attr *attr,struct pmu *pmu;struct perf_event *event;struct hw_perf_event *hwc; -long err; +long err =0 ; event =kzalloc (sizeof (*event), gfpflags);if (!event)
kernel/perf_event.c perf_event_alloc(struct perf_event_attr *attr, · line 4769
Quoted 7 lines
kernel/perf_event.c +3
-1@@ -4750,7 +4764,9 @@ perf_event_alloc(struct perf_event_attr *attr,case PERF_TYPE_RAW :case PERF_TYPE_HARDWARE :case PERF_TYPE_HW_CACHE : - pmu =hw_perf_event_init (event); + pmu =perf_event_lookup_pmu (event); +if (pmu && pmu->init_event) + err = pmu->init_event (event);
Having the same for software, tracepoints and breakpoints events would be nice, so that we have a single simple path in perf_event_alloc to initialize the event.
Thanks.
Quoted 112 lines · Frederic Weisbecker
Quoted 111 lines · Lin Ming
A new field "
pmu_id" is added to structperf_event_attr.2 new functions:
perf_event_register_pmu,perf_event_lookup_pmuperf_event_register_pmu: the pmu registration facilityperf_event_lookup_pmu: lookup the pmu via the passed inevent->attr.pmu_id.A new api
pmu->init_eventto replacehw_perf_event_initSigned-off-by Lin Ming <[email protected]>--- include/linux/perf_event.h | 9 +++++++++ kernel/perf_event.c | 39 +++++++++++++++++++++++++++++++-------- 2 files changed, 40 insertions(+), 8 deletions(-)include/linux/perf_event.h +9
-0@@ -225,6 +225,8 @@ struct perf_event_attr {__u32 bp_type;__u64 bp_addr;__u64 bp_len; + +int pmu_id; };/* @@ -553,6 +555,9 @@ struct perf_event;* struct pmu - generic performance monitoring unit */ struct pmu { +int id; +struct list_head entry; +int (*enable) (struct perf_event *event);void (*disable) (struct perf_event *event);int (*start) (struct perf_event *event);@@ -569,6 +574,8 @@ struct pmu {void (*start_txn) (struct pmu *pmu);void (*cancel_txn) (struct pmu *pmu);int (*commit_txn) (struct pmu *pmu); + +int (*init_event) (struct perf_event *event); };/** @@ -1014,6 +1021,8 @@ extern int perf_swevent_get_recursion_context(void);extern void perf_swevent_put_recursion_context (int rctx);extern void perf_event_enable (struct perf_event *event);extern void perf_event_disable (struct perf_event *event); + +extern void perf_event_register_pmu (struct pmu *pmu);#else static inline void perf_event_task_sched_in (struct task_struct *task) { }kernel/perf_event.c +20
-6@@ -40,6 +40,12 @@*/ static DEFINE_PER_CPU(struct perf_cpu_context, perf_cpu_context); +/* +* The list of multiple hw pmus +*/ +static struct list_head pmus; +static int pmu_id_curr; +int perf_max_events__read_mostly =1 ;static int perf_reserved_percpu__read_mostly ;static int perf_overcommit__read_mostly =1 ;@@ -75,11 +81,6 @@ static DEFINE_SPINLOCK(perf_resource_lock);/* * Architecture provided APIs - weak aliases: */ -extern __weak struct pmu *hw_perf_event_init (struct perf_event *event) -{ -return NULL ; -} -void __weak hw_perf_disable (void ) {barrier (); }void __weak hw_perf_enable (void ) {barrier (); }@@ -4670,6 +4671,19 @@ static struct pmu *sw_perf_event_init(struct perf_event *event)return pmu; } +static struct pmu *perf_event_lookup_pmu (struct perf_event *event) +{ +struct pmu *pmu; +int pmu_id = event->attr.pmu_id; + +list_for_each_entry (pmu, &pmus, entry) { +if (pmu->id == pmu_id) +return pmu; + } + +return NULL ; +} +/* * Allocate and initialize a event structure */ @@ -4685,7 +4699,7 @@ perf_event_alloc(struct perf_event_attr *attr,struct pmu *pmu;struct perf_event *event;struct hw_perf_event *hwc; -long err; +long err =0 ;
Quoted 16 lines
kernel/perf_event.c perf_event_alloc(struct perf_event_attr *attr, · line 4769
Quoted 10 lines
kernel/perf_event.c +3
-1event =kzalloc (sizeof (*event), gfpflags);if (!event)@@ -4750,7 +4764,9 @@ perf_event_alloc(struct perf_event_attr *attr,case PERF_TYPE_RAW :case PERF_TYPE_HARDWARE :case PERF_TYPE_HW_CACHE : - pmu =hw_perf_event_init (event); + pmu =perf_event_lookup_pmu (event); +if (pmu && pmu->init_event) + err = pmu->init_event (event);Having the same for software, tracepoints and breakpoints events would be nice, so that we have a single simple path in
perf_event_allocto initialize the event.
Will add this later.
For now, let's first work on the hw pmus.
Quoted 3 lines
Thanks.