public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Deng-Cheng Zhu <dczhu@mips.com>
Cc: "Barzilay, Eyal" <eyal@mips.com>,
	"Fortuna, Zenon" <zenon@mips.com>,
	Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@elte.hu>,
	Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
	"ralf@linux-mips.org" <ralf@linux-mips.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 5/5] perf: Enable applicable siblings when group leader is enable-on-exec
Date: Wed, 23 Nov 2011 12:39:42 +0100	[thread overview]
Message-ID: <1322048382.14799.41.camel@twins> (raw)
In-Reply-To: <4ECC6AAC.4010504@mips.com>

On Wed, 2011-11-23 at 11:38 +0800, Deng-Cheng Zhu wrote:

> +	list_for_each_entry_rcu(event, &ctx->event_list, event_entry) {
> +		ret = event_enable_on_exec(event, ctx);
> +		if (ret)
> +			enabled = 1;
> +	}
> +
>   	list_for_each_entry(event, &ctx->pinned_groups, group_entry) {
>   		ret = event_enable_on_exec(event, ctx);
>   		if (ret)

This isn't correct either, in this case you should then remove the other
two iterations of pinned/flexible group lists.

Also your use of list_for_each_entry_rcu() is incorrect, either you then
should also use rcu_read_lock(), or its not needed and not use the _rcu
list primitive at all.

Now since event_list is modified under ctx->lock, and we hold that lock
no fancy stuff is needed and we can do without.

---
Subject: perf: Fix enable_on_exec for sibling events
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
Date: Tue Nov 22 11:25:43 CET 2011

Deng-Cheng Zhu reported that sibling events that were created disabled
with enable_on_exec would never get enabled. Iterate all events instead
of the group lists.

Reported-by: Deng-Cheng Zhu <dczhu@mips.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/n/tip-299rxrpmmle8hp3spyxfo202@git.kernel.org
---
 kernel/events/core.c |    8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

Index: linux-2.6/kernel/events/core.c
===================================================================
--- linux-2.6.orig/kernel/events/core.c
+++ linux-2.6/kernel/events/core.c
@@ -2494,13 +2494,7 @@ static void perf_event_enable_on_exec(st
 	raw_spin_lock(&ctx->lock);
 	task_ctx_sched_out(ctx);
 
-	list_for_each_entry(event, &ctx->pinned_groups, group_entry) {
-		ret = event_enable_on_exec(event, ctx);
-		if (ret)
-			enabled = 1;
-	}
-
-	list_for_each_entry(event, &ctx->flexible_groups, group_entry) {
+	list_for_each_entry(event, &ctx->event_list, group_entry) {
 		ret = event_enable_on_exec(event, ctx);
 		if (ret)
 			enabled = 1;


  reply	other threads:[~2011-11-23 11:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-22  3:30 [PATCH v2 5/5] perf: Enable applicable siblings when group leader is enable-on-exec Deng-Cheng Zhu
2011-11-22 10:51 ` Peter Zijlstra
2011-11-22 13:24   ` Zhu, DengCheng
2011-11-22 13:45     ` Peter Zijlstra
2011-11-22 14:20       ` Zhu, DengCheng
2011-11-22 14:23         ` Peter Zijlstra
2011-11-23  3:38           ` Deng-Cheng Zhu
2011-11-23 11:39             ` Peter Zijlstra [this message]
2011-11-23 12:40               ` Zhu, DengCheng
2011-11-23 12:48                 ` Peter Zijlstra
2011-11-24  3:06                   ` Deng-Cheng Zhu
2011-12-06  9:47               ` [tip:perf/core] perf: Fix enable_on_exec for sibling events tip-bot for Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1322048382.14799.41.camel@twins \
    --to=a.p.zijlstra@chello.nl \
    --cc=acme@ghostprotocols.net \
    --cc=dczhu@mips.com \
    --cc=eyal@mips.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=ralf@linux-mips.org \
    --cc=zenon@mips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox