Skip to contentSkip to conversation

perf/x86: Remove redundant calls to perf_pmu_{dis|en}able

PATCH In review David Ahern 3 participants 4 messages Feb 18, 2015 – Mar 27, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf/x86: Remove redundant calls to perf_pmu_{dis|en}able

perf_pmu_disable is called before pmu->add and perf_pmu_enable is called afterwards. No need to call these inside of x86_pmu_add as well.

Cc Peter Zijlstra <[email protected]>
---
 arch/x86/kernel/cpu/perf_event.c | 2 --
 1 file changed, 2 deletions(-)
arch/x86/kernel/cpu/perf_event.c +0 -2
index b71a7f86d68a..2d1675816bef 100644
@@ -1033,7 +1033,6 @@ static int x86_pmu_add(struct perf_event *event, int flags)
 
 	hwc = &event->hw;
 
-	perf_pmu_disable(event->pmu);
 	n0 = cpuc->n_events;
 	ret = n = collect_events(cpuc, event, false);
 	if (ret < 0)
@@ -1071,7 +1070,6 @@ static int x86_pmu_add(struct perf_event *event, int flags)
 
 	ret = 0;
 out:
-	perf_pmu_enable(event->pmu);
 	return ret;
 }
 
Signature · 1 line
1.9.3 (Apple Git-50)
#1 lore raw

Hi Peter:

Quoted 2 lines · David Ahern

perf_pmu_disable is called before pmu->add and perf_pmu_enable is called afterwards. No need to call these inside of x86_pmu_add as well.

Does this make sense or did I miss something about the pmu_enable/disable functions?

David

Quoted 28 lines
Cc Peter Zijlstra <[email protected]>
---
  arch/x86/kernel/cpu/perf_event.c | 2 --
  1 file changed, 2 deletions(-)
arch/x86/kernel/cpu/perf_event.c +0 -2
index b71a7f86d68a..2d1675816bef 100644
@@ -1033,7 +1033,6 @@ static int x86_pmu_add(struct perf_event *event, int flags)
 
  	hwc = &event->hw;
 
-	perf_pmu_disable(event->pmu);
  	n0 = cpuc->n_events;
  	ret = n = collect_events(cpuc, event, false);
  	if (ret < 0)
@@ -1071,7 +1070,6 @@ static int x86_pmu_add(struct perf_event *event, int flags)
 
  	ret = 0;
  out:
-	perf_pmu_enable(event->pmu);
  	return ret;
  }
 
maintainer
#2 lore raw
Quoted 8 lines · David Ahern

Hi Peter:

Quoted 2 lines · David Ahern

perf_pmu_disable is called before pmu->add and perf_pmu_enable is called afterwards. No need to call these inside of x86_pmu_add as well.

Does this make sense or did I miss something about the pmu_enable/disable functions?

No, I think you're right. Applied, thanks!

#3 lore raw

[tip:perf/core] perf/x86: Remove redundant calls to perf_pmu_{dis|en}able()

In reply to David Ahern
perf/x86: Remove redundant calls to perf_pmu_{dis|en}able()
Commit-ID:  9332d250b4b4f67c633894b311e022e3cf943bd5
Gitweb:     http://git.kernel.org/tip/9332d250b4b4f67c633894b311e022e3cf943bd5
Author:     David Ahern <[email protected]>
AuthorDate: Wed, 18 Feb 2015 10:45:43 -0700
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 27 Mar 2015 09:49:44 +0100

perf/x86: Remove redundant calls to perf_pmu_{dis|en}able()

perf_pmu_disable() is called before pmu->add() and perf_pmu_enable() is called afterwards. No need to call these inside of x86_pmu_add() as well.

---
 arch/x86/kernel/cpu/perf_event.c | 2 --
 1 file changed, 2 deletions(-)
arch/x86/kernel/cpu/perf_event.c +0 -2
index ec6e982..ac41b3a 100644
@@ -1044,7 +1044,6 @@ static int x86_pmu_add(struct perf_event *event, int flags)
 
 	hwc = &event->hw;
 
-	perf_pmu_disable(event->pmu);
 	n0 = cpuc->n_events;
 	ret = n = collect_events(cpuc, event, false);
 	if (ret < 0)
@@ -1082,7 +1081,6 @@ done_collect:
 
 	ret = 0;
 out:
-	perf_pmu_enable(event->pmu);
 	return ret;
 }