Skip to content

Commit

Permalink
perf/x86: Remove temporary pmu assignment in event_init
Browse files Browse the repository at this point in the history
The temporary pmu assignment in event_init is unnecessary.

The assignment was introduced by commit 8113070 ("perf_events:
Add fast-path to the rescheduling code"). At that time, event->pmu is
not assigned yet when initializing an event. The assignment is required.
However, from commit 7e5b2a0 ("perf: provide PMU when initing
events"), the event->pmu is provided before event_init is invoked.
The temporary pmu assignment in event_init should be removed.

Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Andi Kleen <ak@linux.intel.com>
Link: https://lkml.kernel.org/r/1618237865-33448-15-git-send-email-kan.liang@linux.intel.com
  • Loading branch information
Kan Liang authored and Peter Zijlstra committed Apr 19, 2021
1 parent 34d5b61 commit b985672
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions arch/x86/events/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2291,7 +2291,6 @@ static int validate_group(struct perf_event *event)

static int x86_pmu_event_init(struct perf_event *event)
{
struct pmu *tmp;
int err;

switch (event->attr.type) {
Expand All @@ -2306,20 +2305,10 @@ static int x86_pmu_event_init(struct perf_event *event)

err = __x86_pmu_event_init(event);
if (!err) {
/*
* we temporarily connect event to its pmu
* such that validate_group() can classify
* it as an x86 event using is_x86_event()
*/
tmp = event->pmu;
event->pmu = &pmu;

if (event->group_leader != event)
err = validate_group(event);
else
err = validate_event(event);

event->pmu = tmp;
}
if (err) {
if (event->destroy)
Expand Down

0 comments on commit b985672

Please sign in to comment.