LKML Archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf_event: Make software events work again
@ 2010-05-08 10:58 Paul Mackerras
  2010-05-08 11:18 ` [tip:perf/core] " tip-bot for Paul Mackerras
  2010-05-10  8:04 ` [PATCH] " Peter Zijlstra
  0 siblings, 2 replies; 3+ messages in thread
From: Paul Mackerras @ 2010-05-08 10:58 UTC (permalink / raw
  To: Ingo Molnar, Peter Zijlstra, Lin Ming, Frederic Weisbecker,
	eranian
  Cc: linux-kernel

Commit 6bde9b6ce0127e2a56228a2071536d422be31336 ("perf: Add group
scheduling transactional APIs") added code to allow a group to be
scheduled in a single transaction.  However, it introduced a bug in
handling events whose pmu does not implement transactions -- at the
end of scheduling in the events in the group, in the non-transactional
case the code now falls through to the group_error label, and proceeds
to unschedule all the events in the group and return failure.

This fixes it by returning 0 (success) in the non-transactional case.

Signed-off-by: Paul Mackerras <paulus@samba.org>
---
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index bb06382..180151f 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -664,13 +664,13 @@ group_sched_in(struct perf_event *group_event,
 		}
 	}
 
-	if (txn) {
-		ret = pmu->commit_txn(pmu);
-		if (!ret) {
-			pmu->cancel_txn(pmu);
+	if (!txn)
+		return 0;
 
-			return 0;
-		}
+	ret = pmu->commit_txn(pmu);
+	if (!ret) {
+		pmu->cancel_txn(pmu);
+		return 0;
 	}
 
 group_error:

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [tip:perf/core] perf_event: Make software events work again
  2010-05-08 10:58 [PATCH] perf_event: Make software events work again Paul Mackerras
@ 2010-05-08 11:18 ` tip-bot for Paul Mackerras
  2010-05-10  8:04 ` [PATCH] " Peter Zijlstra
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Paul Mackerras @ 2010-05-08 11:18 UTC (permalink / raw
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, peterz, fweisbec, ming.m.lin,
	tglx, mingo

Commit-ID:  6e85158cf5a2385264316870256fb6ad681156a0
Gitweb:     http://git.kernel.org/tip/6e85158cf5a2385264316870256fb6ad681156a0
Author:     Paul Mackerras <paulus@samba.org>
AuthorDate: Sat, 8 May 2010 20:58:00 +1000
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 8 May 2010 13:16:55 +0200

perf_event: Make software events work again

Commit 6bde9b6ce0127e2a56228a2071536d422be31336 ("perf: Add
group scheduling transactional APIs") added code to allow a
group to be scheduled in a single transaction.  However, it
introduced a bug in handling events whose pmu does not implement
transactions -- at the end of scheduling in the events in the
group, in the non-transactional case the code now falls through
to the group_error label, and proceeds to unschedule all the
events in the group and return failure.

This fixes it by returning 0 (success) in the non-transactional
case.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Lin Ming <ming.m.lin@intel.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: eranian@gmail.com
LKML-Reference: <20100508105800.GB10650@brick.ozlabs.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/perf_event.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index bb06382..180151f 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -664,13 +664,13 @@ group_sched_in(struct perf_event *group_event,
 		}
 	}
 
-	if (txn) {
-		ret = pmu->commit_txn(pmu);
-		if (!ret) {
-			pmu->cancel_txn(pmu);
+	if (!txn)
+		return 0;
 
-			return 0;
-		}
+	ret = pmu->commit_txn(pmu);
+	if (!ret) {
+		pmu->cancel_txn(pmu);
+		return 0;
 	}
 
 group_error:

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] perf_event: Make software events work again
  2010-05-08 10:58 [PATCH] perf_event: Make software events work again Paul Mackerras
  2010-05-08 11:18 ` [tip:perf/core] " tip-bot for Paul Mackerras
@ 2010-05-10  8:04 ` Peter Zijlstra
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Zijlstra @ 2010-05-10  8:04 UTC (permalink / raw
  To: Paul Mackerras
  Cc: Ingo Molnar, Lin Ming, Frederic Weisbecker, eranian, linux-kernel

On Sat, 2010-05-08 at 20:58 +1000, Paul Mackerras wrote:
> Commit 6bde9b6ce0127e2a56228a2071536d422be31336 ("perf: Add group
> scheduling transactional APIs") added code to allow a group to be
> scheduled in a single transaction.  However, it introduced a bug in
> handling events whose pmu does not implement transactions -- at the
> end of scheduling in the events in the group, in the non-transactional
> case the code now falls through to the group_error label, and proceeds
> to unschedule all the events in the group and return failure.
> 
> This fixes it by returning 0 (success) in the non-transactional case.

D'0h I should have spotted that :/

Thanks Paul!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-05-10  8:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-08 10:58 [PATCH] perf_event: Make software events work again Paul Mackerras
2010-05-08 11:18 ` [tip:perf/core] " tip-bot for Paul Mackerras
2010-05-10  8:04 ` [PATCH] " Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).