All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] perf: Remove duplicate invocation on perf_event_for_each
@ 2012-05-31  5:51 Namhyung Kim
  2012-05-31  5:51 ` [PATCH 2/3] perf tools: Update ioctl documentation for PERF_IOC_FLAG_GROUP Namhyung Kim
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Namhyung Kim @ 2012-05-31  5:51 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, Namhyung Kim, LKML

The @func callback was invoked twice for group leader
when perf_event_for_each() called. It seems the commit
75f937f24bd9 ("perf_counter: Fix ctx->mutex vs counter
->mutex inversion") made the mistake during the change.

Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
---
 kernel/events/core.c |    1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 5b06cbbf6931..f85c0154b333 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -3181,7 +3181,6 @@ static void perf_event_for_each(struct perf_event *event,
 	event = event->group_leader;
 
 	perf_event_for_each_child(event, func);
-	func(event);
 	list_for_each_entry(sibling, &event->sibling_list, group_entry)
 		perf_event_for_each_child(sibling, func);
 	mutex_unlock(&ctx->mutex);
-- 
1.7.10.2


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

* [PATCH 2/3] perf tools: Update ioctl documentation for PERF_IOC_FLAG_GROUP
  2012-05-31  5:51 [PATCH 1/3] perf: Remove duplicate invocation on perf_event_for_each Namhyung Kim
@ 2012-05-31  5:51 ` Namhyung Kim
  2012-05-31 14:35   ` Arnaldo Carvalho de Melo
  2012-06-06  7:03   ` [tip:perf/urgent] " tip-bot for Namhyung Kim
  2012-05-31  5:51 ` [PATCH 3/3] perf evlist: Pass third argument to ioctl explicitly Namhyung Kim
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 9+ messages in thread
From: Namhyung Kim @ 2012-05-31  5:51 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, Namhyung Kim, LKML

The ioctl interface of perf event fd receives 3 arguments
to control event group behavior but it lacked documentation.

Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
---
 tools/perf/design.txt |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/perf/design.txt b/tools/perf/design.txt
index bd0bb1b1279b..67e5d0cace85 100644
--- a/tools/perf/design.txt
+++ b/tools/perf/design.txt
@@ -409,14 +409,15 @@ Counters can be enabled and disabled in two ways: via ioctl and via
 prctl.  When a counter is disabled, it doesn't count or generate
 events but does continue to exist and maintain its count value.
 
-An individual counter or counter group can be enabled with
+An individual counter can be enabled with
 
-	ioctl(fd, PERF_EVENT_IOC_ENABLE);
+	ioctl(fd, PERF_EVENT_IOC_ENABLE, 0);
 
 or disabled with
 
-	ioctl(fd, PERF_EVENT_IOC_DISABLE);
+	ioctl(fd, PERF_EVENT_IOC_DISABLE, 0);
 
+For a counter group, pass PERF_IOC_FLAG_GROUP as the third argument.
 Enabling or disabling the leader of a group enables or disables the
 whole group; that is, while the group leader is disabled, none of the
 counters in the group will count.  Enabling or disabling a member of a
-- 
1.7.10.2


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

* [PATCH 3/3] perf evlist: Pass third argument to ioctl explicitly
  2012-05-31  5:51 [PATCH 1/3] perf: Remove duplicate invocation on perf_event_for_each Namhyung Kim
  2012-05-31  5:51 ` [PATCH 2/3] perf tools: Update ioctl documentation for PERF_IOC_FLAG_GROUP Namhyung Kim
@ 2012-05-31  5:51 ` Namhyung Kim
  2012-06-06  7:04   ` [tip:perf/urgent] " tip-bot for Namhyung Kim
  2012-05-31 17:00 ` [PATCH 1/3] perf: Remove duplicate invocation on perf_event_for_each Peter Zijlstra
  2012-06-06  7:09 ` [tip:perf/urgent] " tip-bot for Namhyung Kim
  3 siblings, 1 reply; 9+ messages in thread
From: Namhyung Kim @ 2012-05-31  5:51 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, Namhyung Kim, LKML

The ioctl on perf event fd wants 3 arguments but we only
passed 2. As the only user of the functions is perf record
and it calls them for every events (regardless of group
setting), just pass 0 for now.

Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
---
 tools/perf/util/evlist.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 4ac5f5ae4ce9..244211070264 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -263,7 +263,8 @@ void perf_evlist__disable(struct perf_evlist *evlist)
 	for (cpu = 0; cpu < evlist->cpus->nr; cpu++) {
 		list_for_each_entry(pos, &evlist->entries, node) {
 			for (thread = 0; thread < evlist->threads->nr; thread++)
-				ioctl(FD(pos, cpu, thread), PERF_EVENT_IOC_DISABLE);
+				ioctl(FD(pos, cpu, thread),
+				      PERF_EVENT_IOC_DISABLE, 0);
 		}
 	}
 }
@@ -276,7 +277,8 @@ void perf_evlist__enable(struct perf_evlist *evlist)
 	for (cpu = 0; cpu < evlist->cpus->nr; cpu++) {
 		list_for_each_entry(pos, &evlist->entries, node) {
 			for (thread = 0; thread < evlist->threads->nr; thread++)
-				ioctl(FD(pos, cpu, thread), PERF_EVENT_IOC_ENABLE);
+				ioctl(FD(pos, cpu, thread),
+				      PERF_EVENT_IOC_ENABLE, 0);
 		}
 	}
 }
-- 
1.7.10.2


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

* Re: [PATCH 2/3] perf tools: Update ioctl documentation for PERF_IOC_FLAG_GROUP
  2012-05-31  5:51 ` [PATCH 2/3] perf tools: Update ioctl documentation for PERF_IOC_FLAG_GROUP Namhyung Kim
@ 2012-05-31 14:35   ` Arnaldo Carvalho de Melo
  2012-05-31 14:37     ` Arnaldo Carvalho de Melo
  2012-06-06  7:03   ` [tip:perf/urgent] " tip-bot for Namhyung Kim
  1 sibling, 1 reply; 9+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-05-31 14:35 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, Namhyung Kim, LKML

Em Thu, May 31, 2012 at 02:51:45PM +0900, Namhyung Kim escreveu:
> The ioctl interface of perf event fd receives 3 arguments
> to control event group behavior but it lacked documentation.

But the argument is not used for ENABLE or DISABLE, so why require it?

- Arnaldo
 
> Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
> ---
>  tools/perf/design.txt |    7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/perf/design.txt b/tools/perf/design.txt
> index bd0bb1b1279b..67e5d0cace85 100644
> --- a/tools/perf/design.txt
> +++ b/tools/perf/design.txt
> @@ -409,14 +409,15 @@ Counters can be enabled and disabled in two ways: via ioctl and via
>  prctl.  When a counter is disabled, it doesn't count or generate
>  events but does continue to exist and maintain its count value.
>  
> -An individual counter or counter group can be enabled with
> +An individual counter can be enabled with
>  
> -	ioctl(fd, PERF_EVENT_IOC_ENABLE);
> +	ioctl(fd, PERF_EVENT_IOC_ENABLE, 0);
>  
>  or disabled with
>  
> -	ioctl(fd, PERF_EVENT_IOC_DISABLE);
> +	ioctl(fd, PERF_EVENT_IOC_DISABLE, 0);
>  
> +For a counter group, pass PERF_IOC_FLAG_GROUP as the third argument.
>  Enabling or disabling the leader of a group enables or disables the
>  whole group; that is, while the group leader is disabled, none of the
>  counters in the group will count.  Enabling or disabling a member of a
> -- 
> 1.7.10.2

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

* Re: [PATCH 2/3] perf tools: Update ioctl documentation for PERF_IOC_FLAG_GROUP
  2012-05-31 14:35   ` Arnaldo Carvalho de Melo
@ 2012-05-31 14:37     ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 9+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-05-31 14:37 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, Namhyung Kim, LKML

Em Thu, May 31, 2012 at 11:35:54AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Thu, May 31, 2012 at 02:51:45PM +0900, Namhyung Kim escreveu:
> > The ioctl interface of perf event fd receives 3 arguments
> > to control event group behavior but it lacked documentation.
> 
> But the argument is not used for ENABLE or DISABLE, so why require it?

Nevermind, colour me blind, applying.

- Arnaldo

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

* Re: [PATCH 1/3] perf: Remove duplicate invocation on perf_event_for_each
  2012-05-31  5:51 [PATCH 1/3] perf: Remove duplicate invocation on perf_event_for_each Namhyung Kim
  2012-05-31  5:51 ` [PATCH 2/3] perf tools: Update ioctl documentation for PERF_IOC_FLAG_GROUP Namhyung Kim
  2012-05-31  5:51 ` [PATCH 3/3] perf evlist: Pass third argument to ioctl explicitly Namhyung Kim
@ 2012-05-31 17:00 ` Peter Zijlstra
  2012-06-06  7:09 ` [tip:perf/urgent] " tip-bot for Namhyung Kim
  3 siblings, 0 replies; 9+ messages in thread
From: Peter Zijlstra @ 2012-05-31 17:00 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Arnaldo Carvalho de Melo, Paul Mackerras, Ingo Molnar,
	Namhyung Kim, LKML

On Thu, 2012-05-31 at 14:51 +0900, Namhyung Kim wrote:
> The @func callback was invoked twice for group leader
> when perf_event_for_each() called. It seems the commit
> 75f937f24bd9 ("perf_counter: Fix ctx->mutex vs counter
> ->mutex inversion") made the mistake during the change.
> 
> Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>

Good spotting, thanks!

> ---
>  kernel/events/core.c |    1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 5b06cbbf6931..f85c0154b333 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -3181,7 +3181,6 @@ static void perf_event_for_each(struct perf_event *event,
>  	event = event->group_leader;
>  
>  	perf_event_for_each_child(event, func);
> -	func(event);
>  	list_for_each_entry(sibling, &event->sibling_list, group_entry)
>  		perf_event_for_each_child(sibling, func);
>  	mutex_unlock(&ctx->mutex);


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

* [tip:perf/urgent] perf tools: Update ioctl documentation for PERF_IOC_FLAG_GROUP
  2012-05-31  5:51 ` [PATCH 2/3] perf tools: Update ioctl documentation for PERF_IOC_FLAG_GROUP Namhyung Kim
  2012-05-31 14:35   ` Arnaldo Carvalho de Melo
@ 2012-06-06  7:03   ` tip-bot for Namhyung Kim
  1 sibling, 0 replies; 9+ messages in thread
From: tip-bot for Namhyung Kim @ 2012-06-06  7:03 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, paulus, hpa, mingo, a.p.zijlstra,
	namhyung.kim, namhyung, tglx

Commit-ID:  a59e64a13a927fb7530bef39e9f5e7de8268137e
Gitweb:     http://git.kernel.org/tip/a59e64a13a927fb7530bef39e9f5e7de8268137e
Author:     Namhyung Kim <namhyung.kim@lge.com>
AuthorDate: Thu, 31 May 2012 14:51:45 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 31 May 2012 11:38:42 -0300

perf tools: Update ioctl documentation for PERF_IOC_FLAG_GROUP

The ioctl interface of perf event fd receives 3 arguments to control
event group behavior but it lacked documentation.

Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1338443506-25009-2-git-send-email-namhyung.kim@lge.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/design.txt |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/perf/design.txt b/tools/perf/design.txt
index bd0bb1b..67e5d0c 100644
--- a/tools/perf/design.txt
+++ b/tools/perf/design.txt
@@ -409,14 +409,15 @@ Counters can be enabled and disabled in two ways: via ioctl and via
 prctl.  When a counter is disabled, it doesn't count or generate
 events but does continue to exist and maintain its count value.
 
-An individual counter or counter group can be enabled with
+An individual counter can be enabled with
 
-	ioctl(fd, PERF_EVENT_IOC_ENABLE);
+	ioctl(fd, PERF_EVENT_IOC_ENABLE, 0);
 
 or disabled with
 
-	ioctl(fd, PERF_EVENT_IOC_DISABLE);
+	ioctl(fd, PERF_EVENT_IOC_DISABLE, 0);
 
+For a counter group, pass PERF_IOC_FLAG_GROUP as the third argument.
 Enabling or disabling the leader of a group enables or disables the
 whole group; that is, while the group leader is disabled, none of the
 counters in the group will count.  Enabling or disabling a member of a

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

* [tip:perf/urgent] perf evlist: Pass third argument to ioctl explicitly
  2012-05-31  5:51 ` [PATCH 3/3] perf evlist: Pass third argument to ioctl explicitly Namhyung Kim
@ 2012-06-06  7:04   ` tip-bot for Namhyung Kim
  0 siblings, 0 replies; 9+ messages in thread
From: tip-bot for Namhyung Kim @ 2012-06-06  7:04 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, paulus, hpa, mingo, a.p.zijlstra,
	namhyung.kim, namhyung, tglx

Commit-ID:  55da80059de6c7533724fcd95f16c5d5618ecf4d
Gitweb:     http://git.kernel.org/tip/55da80059de6c7533724fcd95f16c5d5618ecf4d
Author:     Namhyung Kim <namhyung.kim@lge.com>
AuthorDate: Thu, 31 May 2012 14:51:46 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 31 May 2012 11:39:16 -0300

perf evlist: Pass third argument to ioctl explicitly

The ioctl on perf event fd wants 3 arguments but we only passed 2. As
the only user of the functions is perf record and it calls them for
every event (regardless of group setting), just pass 0 for now.

Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1338443506-25009-3-git-send-email-namhyung.kim@lge.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/evlist.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index ed277e5..7400fb3 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -274,7 +274,8 @@ void perf_evlist__disable(struct perf_evlist *evlist)
 	for (cpu = 0; cpu < evlist->cpus->nr; cpu++) {
 		list_for_each_entry(pos, &evlist->entries, node) {
 			for (thread = 0; thread < evlist->threads->nr; thread++)
-				ioctl(FD(pos, cpu, thread), PERF_EVENT_IOC_DISABLE);
+				ioctl(FD(pos, cpu, thread),
+				      PERF_EVENT_IOC_DISABLE, 0);
 		}
 	}
 }
@@ -287,7 +288,8 @@ void perf_evlist__enable(struct perf_evlist *evlist)
 	for (cpu = 0; cpu < evlist->cpus->nr; cpu++) {
 		list_for_each_entry(pos, &evlist->entries, node) {
 			for (thread = 0; thread < evlist->threads->nr; thread++)
-				ioctl(FD(pos, cpu, thread), PERF_EVENT_IOC_ENABLE);
+				ioctl(FD(pos, cpu, thread),
+				      PERF_EVENT_IOC_ENABLE, 0);
 		}
 	}
 }

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

* [tip:perf/urgent] perf: Remove duplicate invocation on perf_event_for_each
  2012-05-31  5:51 [PATCH 1/3] perf: Remove duplicate invocation on perf_event_for_each Namhyung Kim
                   ` (2 preceding siblings ...)
  2012-05-31 17:00 ` [PATCH 1/3] perf: Remove duplicate invocation on perf_event_for_each Peter Zijlstra
@ 2012-06-06  7:09 ` tip-bot for Namhyung Kim
  3 siblings, 0 replies; 9+ messages in thread
From: tip-bot for Namhyung Kim @ 2012-06-06  7:09 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, paulus, hpa, mingo, a.p.zijlstra,
	namhyung.kim, namhyung, tglx

Commit-ID:  cb7225feec627e91d598198996429e9ee6804f8d
Gitweb:     http://git.kernel.org/tip/cb7225feec627e91d598198996429e9ee6804f8d
Author:     Namhyung Kim <namhyung.kim@lge.com>
AuthorDate: Thu, 31 May 2012 14:51:44 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 31 May 2012 14:01:00 -0300

perf: Remove duplicate invocation on perf_event_for_each

The @func callback was invoked twice for group leader when
perf_event_for_each() called. It seems the commit 75f937f24bd9
("perf_counter: Fix ctx->mutex vs counter ->mutex inversion") made the
mistake during the change.

Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1338443506-25009-1-git-send-email-namhyung.kim@lge.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 kernel/events/core.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 5b06cbb..f85c015 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -3181,7 +3181,6 @@ static void perf_event_for_each(struct perf_event *event,
 	event = event->group_leader;
 
 	perf_event_for_each_child(event, func);
-	func(event);
 	list_for_each_entry(sibling, &event->sibling_list, group_entry)
 		perf_event_for_each_child(sibling, func);
 	mutex_unlock(&ctx->mutex);

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

end of thread, other threads:[~2012-06-06  7:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-31  5:51 [PATCH 1/3] perf: Remove duplicate invocation on perf_event_for_each Namhyung Kim
2012-05-31  5:51 ` [PATCH 2/3] perf tools: Update ioctl documentation for PERF_IOC_FLAG_GROUP Namhyung Kim
2012-05-31 14:35   ` Arnaldo Carvalho de Melo
2012-05-31 14:37     ` Arnaldo Carvalho de Melo
2012-06-06  7:03   ` [tip:perf/urgent] " tip-bot for Namhyung Kim
2012-05-31  5:51 ` [PATCH 3/3] perf evlist: Pass third argument to ioctl explicitly Namhyung Kim
2012-06-06  7:04   ` [tip:perf/urgent] " tip-bot for Namhyung Kim
2012-05-31 17:00 ` [PATCH 1/3] perf: Remove duplicate invocation on perf_event_for_each Peter Zijlstra
2012-06-06  7:09 ` [tip:perf/urgent] " tip-bot for Namhyung Kim

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.