Skip to content

Commit

Permalink
perf: Fix the missing event initialization when pmu is found in idr
Browse files Browse the repository at this point in the history
Currently, the event is not initialized if pmu is found in idr. This
never causes bug just because now no pmu is associated with the idr
id.

Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <1298812411.2699.9.camel@localhost>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Lin Ming authored and Ingo Molnar committed Mar 4, 2011
1 parent 888a8a3 commit 940c5b2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions kernel/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -6098,17 +6098,22 @@ struct pmu *perf_init_event(struct perf_event *event)
{
struct pmu *pmu = NULL;
int idx;
int ret;

idx = srcu_read_lock(&pmus_srcu);

rcu_read_lock();
pmu = idr_find(&pmu_idr, event->attr.type);
rcu_read_unlock();
if (pmu)
if (pmu) {
ret = pmu->event_init(event);
if (ret)
pmu = ERR_PTR(ret);
goto unlock;
}

list_for_each_entry_rcu(pmu, &pmus, entry) {
int ret = pmu->event_init(event);
ret = pmu->event_init(event);
if (!ret)
goto unlock;

Expand Down

0 comments on commit 940c5b2

Please sign in to comment.