public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [GIT PULL 0/5] perf/core fixes and cleanups
@ 2011-01-05 17:04 Arnaldo Carvalho de Melo
  2011-01-05 17:04 ` [PATCH 1/5] perf test: Clarify some error reports in the open syscall test Arnaldo Carvalho de Melo
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-01-05 17:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, David S . Miller,
	Frederic Weisbecker, Ingo Molnar, Mike Galbraith, Paul Mackerras,
	Peter Zijlstra, Robert Richter, Stephane Eranian,
	Stephane Eranian, Tom Zanussi, Arnaldo Carvalho de Melo

Hi Ingo,

        Please consider pulling from:

git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 perf/core

	I removed the patch that introduced map__empty and caused those
aliasing problems on f12 i386, I tried but couldn't reproduce it on a f14
i386 machine, will investigate more later.

	The synch of master.k.o to g.k.o these days is taking a long time, so
beware.

Regards,

- Arnaldo

Arnaldo Carvalho de Melo (4):
  perf test: Clarify some error reports in the open syscall test
  perf session: Warn about errors when processing pipe events too
  perf script: Use the default lost event handler
  perf script: Make some lists static

Stephane Eranian (1):
  perf tools: Fix perf_event.h header usage

 tools/perf/builtin-script.c    |   19 ++-----------
 tools/perf/builtin-test.c      |   18 +++++++-----
 tools/perf/util/evsel.h        |    2 +-
 tools/perf/util/parse-events.h |    2 +-
 tools/perf/util/session.c      |   57 +++++++++++++++++++++------------------
 5 files changed, 47 insertions(+), 51 deletions(-)


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

* [PATCH 1/5] perf test: Clarify some error reports in the open syscall test
  2011-01-05 17:04 [GIT PULL 0/5] perf/core fixes and cleanups Arnaldo Carvalho de Melo
@ 2011-01-05 17:04 ` Arnaldo Carvalho de Melo
  2011-01-05 17:04 ` [PATCH 2/5] perf tools: Fix perf_event.h header usage Arnaldo Carvalho de Melo
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-01-05 17:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Frederic Weisbecker,
	Ingo Molnar, Mike Galbraith, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian, Tom Zanussi

From: Arnaldo Carvalho de Melo <acme@redhat.com>

Rebooted my devel machine, first thing I ran was perf test, that expects
debugfs to be mounted, test fails. Be more clear about it.

Also add missing newlines and add more informative message when
sys_perf_event_open fails.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-test.c |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c
index 6c99152..1c98434 100644
--- a/tools/perf/builtin-test.c
+++ b/tools/perf/builtin-test.c
@@ -268,24 +268,26 @@ static int test__open_syscall_event(void)
 	int id = trace_event__id("sys_enter_open");
 
 	if (id < 0) {
-		pr_debug("trace_event__id(\"sys_enter_open\") ");
+		pr_debug("is debugfs mounted on /sys/kernel/debug?\n");
 		return -1;
 	}
 
 	threads = thread_map__new(-1, getpid());
 	if (threads == NULL) {
-		pr_debug("thread_map__new ");
+		pr_debug("thread_map__new\n");
 		return -1;
 	}
 
 	evsel = perf_evsel__new(PERF_TYPE_TRACEPOINT, id, 0);
 	if (evsel == NULL) {
-		pr_debug("perf_evsel__new ");
+		pr_debug("perf_evsel__new\n");
 		goto out_thread_map_delete;
 	}
 
 	if (perf_evsel__open_per_thread(evsel, threads) < 0) {
-		pr_debug("perf_evsel__open_per_thread ");
+		pr_debug("failed to open counter: %s, "
+			 "tweak /proc/sys/kernel/perf_event_paranoid?\n",
+			 strerror(errno));
 		goto out_evsel_delete;
 	}
 
@@ -295,13 +297,15 @@ static int test__open_syscall_event(void)
 	}
 
 	if (perf_evsel__read_on_cpu(evsel, 0, 0) < 0) {
-		pr_debug("perf_evsel__open_read_on_cpu ");
+		pr_debug("perf_evsel__open_read_on_cpu\n");
 		goto out_close_fd;
 	}
 
-	if (evsel->counts->cpu[0].val != nr_open_calls)
-		pr_debug("perf_evsel__read_on_cpu: expected to intercept %d calls, got %Ld ",
+	if (evsel->counts->cpu[0].val != nr_open_calls) {
+		pr_debug("perf_evsel__read_on_cpu: expected to intercept %d calls, got %Ld\n",
 			 nr_open_calls, evsel->counts->cpu[0].val);
+		goto out_close_fd;
+	}
 	
 	err = 0;
 out_close_fd:
-- 
1.6.2.5


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

* [PATCH 2/5] perf tools: Fix perf_event.h header usage
  2011-01-05 17:04 [GIT PULL 0/5] perf/core fixes and cleanups Arnaldo Carvalho de Melo
  2011-01-05 17:04 ` [PATCH 1/5] perf test: Clarify some error reports in the open syscall test Arnaldo Carvalho de Melo
@ 2011-01-05 17:04 ` Arnaldo Carvalho de Melo
  2011-01-05 17:04 ` [PATCH 3/5] perf session: Warn about errors when processing pipe events too Arnaldo Carvalho de Melo
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-01-05 17:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Stephane Eranian, David S. Miller,
	Frederic Weisbecker, Ingo Molnar, Paul Mackerras, Peter Zijlstra,
	Robert Richter, Stephane Eranian, Arnaldo Carvalho de Melo

From: Stephane Eranian <eranian@google.com>

This patch fixes the usage of the perf_event.h header file
between command modules and the supporting code in util.

It is necessary to ensure that ALL files use the SAME
perf_event.h header from the kernel source tree.

There were a couple of #include <linux/perf_event.h> mixed
with #include "../../perf_event.h".

This caused issues on some distros because of mismatch
in the layout of struct perf_event_attr. That eventually
led perf stat to segfault.

Cc: David S. Miller <davem@davemloft.net>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Stephane Eranian <eranian@gmail.com>
LKML-Reference: <4d233cf0.2308e30a.7b00.ffffc187@mx.google.com>
Signed-off-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/evsel.h        |    2 +-
 tools/perf/util/parse-events.h |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 863d78d..a0ccd69 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -3,7 +3,7 @@
 
 #include <linux/list.h>
 #include <stdbool.h>
-#include <linux/perf_event.h>
+#include "../../../include/linux/perf_event.h"
 #include "types.h"
 #include "xyarray.h"
  
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
index 1c9043c..b82cafb 100644
--- a/tools/perf/util/parse-events.h
+++ b/tools/perf/util/parse-events.h
@@ -4,7 +4,7 @@
  * Parse symbolic events/counts passed in as options:
  */
 
-#include <linux/perf_event.h>
+#include "../../../include/linux/perf_event.h"
 
 struct list_head;
 struct perf_evsel;
-- 
1.6.2.5


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

* [PATCH 3/5] perf session: Warn about errors when processing pipe events too
  2011-01-05 17:04 [GIT PULL 0/5] perf/core fixes and cleanups Arnaldo Carvalho de Melo
  2011-01-05 17:04 ` [PATCH 1/5] perf test: Clarify some error reports in the open syscall test Arnaldo Carvalho de Melo
  2011-01-05 17:04 ` [PATCH 2/5] perf tools: Fix perf_event.h header usage Arnaldo Carvalho de Melo
@ 2011-01-05 17:04 ` Arnaldo Carvalho de Melo
  2011-01-05 17:04 ` [PATCH 4/5] perf script: Use the default lost event handler Arnaldo Carvalho de Melo
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-01-05 17:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Frederic Weisbecker,
	Ingo Molnar, Mike Galbraith, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian, Tom Zanussi

From: Arnaldo Carvalho de Melo <acme@redhat.com>

Just like we do at __perf_session__process_events

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/session.c |   57 ++++++++++++++++++++++++--------------------
 1 files changed, 31 insertions(+), 26 deletions(-)

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index b163dfd..6fb4694 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -838,6 +838,35 @@ static struct thread *perf_session__register_idle_thread(struct perf_session *se
 	return thread;
 }
 
+static void perf_session__warn_about_errors(const struct perf_session *session,
+					    const struct perf_event_ops *ops)
+{
+	if (ops->lost == event__process_lost &&
+	    session->hists.stats.total_lost != 0) {
+		ui__warning("Processed %Lu events and LOST %Lu!\n\n"
+			    "Check IO/CPU overload!\n\n",
+			    session->hists.stats.total_period,
+			    session->hists.stats.total_lost);
+	}
+
+	if (session->hists.stats.nr_unknown_events != 0) {
+		ui__warning("Found %u unknown events!\n\n"
+			    "Is this an older tool processing a perf.data "
+			    "file generated by a more recent tool?\n\n"
+			    "If that is not the case, consider "
+			    "reporting to linux-kernel@vger.kernel.org.\n\n",
+			    session->hists.stats.nr_unknown_events);
+	}
+
+ 	if (session->hists.stats.nr_invalid_chains != 0) {
+ 		ui__warning("Found invalid callchains!\n\n"
+ 			    "%u out of %u events were discarded for this reason.\n\n"
+ 			    "Consider reporting to linux-kernel@vger.kernel.org.\n\n",
+ 			    session->hists.stats.nr_invalid_chains,
+ 			    session->hists.stats.nr_events[PERF_RECORD_SAMPLE]);
+ 	}
+}
+
 #define session_done()	(*(volatile int *)(&session_done))
 volatile int session_done;
 
@@ -911,6 +940,7 @@ more:
 done:
 	err = 0;
 out_err:
+	perf_session__warn_about_errors(self, ops);
 	perf_session_free_sample_buffers(self);
 	return err;
 }
@@ -1023,32 +1053,7 @@ more:
 	flush_sample_queue(session, ops);
 out_err:
 	ui_progress__delete(progress);
-
-	if (ops->lost == event__process_lost &&
-	    session->hists.stats.total_lost != 0) {
-		ui__warning("Processed %Lu events and LOST %Lu!\n\n"
-			    "Check IO/CPU overload!\n\n",
-			    session->hists.stats.total_period,
-			    session->hists.stats.total_lost);
-	}
-
-	if (session->hists.stats.nr_unknown_events != 0) {
-		ui__warning("Found %u unknown events!\n\n"
-			    "Is this an older tool processing a perf.data "
-			    "file generated by a more recent tool?\n\n"
-			    "If that is not the case, consider "
-			    "reporting to linux-kernel@vger.kernel.org.\n\n",
-			    session->hists.stats.nr_unknown_events);
-	}
-
- 	if (session->hists.stats.nr_invalid_chains != 0) {
- 		ui__warning("Found invalid callchains!\n\n"
- 			    "%u out of %u events were discarded for this reason.\n\n"
- 			    "Consider reporting to linux-kernel@vger.kernel.org.\n\n",
- 			    session->hists.stats.nr_invalid_chains,
- 			    session->hists.stats.nr_events[PERF_RECORD_SAMPLE]);
- 	}
-
+	perf_session__warn_about_errors(session, ops);
 	perf_session_free_sample_buffers(session);
 	return err;
 }
-- 
1.6.2.5


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

* [PATCH 4/5] perf script: Use the default lost event handler
  2011-01-05 17:04 [GIT PULL 0/5] perf/core fixes and cleanups Arnaldo Carvalho de Melo
                   ` (2 preceding siblings ...)
  2011-01-05 17:04 ` [PATCH 3/5] perf session: Warn about errors when processing pipe events too Arnaldo Carvalho de Melo
@ 2011-01-05 17:04 ` Arnaldo Carvalho de Melo
  2011-01-05 17:04 ` [PATCH 5/5] perf script: Make some lists static Arnaldo Carvalho de Melo
  2011-01-05 17:31 ` [GIT PULL 0/5] perf/core fixes and cleanups Ingo Molnar
  5 siblings, 0 replies; 7+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-01-05 17:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Frederic Weisbecker,
	Ingo Molnar, Mike Galbraith, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian, Tom Zanussi

From: Arnaldo Carvalho de Melo <acme@redhat.com>

That already does what was being done here. The warning is now unconditionally
given by __perf_session__process_pipe_events, just like for non pipe processing.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-script.c |   15 +--------------
 1 files changed, 1 insertions(+), 14 deletions(-)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 43480fd..27d568d 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -99,16 +99,6 @@ static int process_sample_event(event_t *event, struct sample_data *sample,
 	return 0;
 }
 
-static u64 nr_lost;
-
-static int process_lost_event(event_t *event, struct sample_data *sample __used,
-			      struct perf_session *session __used)
-{
-	nr_lost += event->lost.lost;
-
-	return 0;
-}
-
 static struct perf_event_ops event_ops = {
 	.sample	= process_sample_event,
 	.comm	= event__process_comm,
@@ -116,7 +106,6 @@ static struct perf_event_ops event_ops = {
 	.event_type = event__process_event_type,
 	.tracing_data = event__process_tracing_data,
 	.build_id = event__process_build_id,
-	.lost = process_lost_event,
 	.ordering_requires_timestamps = true,
 	.ordered_samples = true,
 };
@@ -136,10 +125,8 @@ static int __cmd_script(struct perf_session *session)
 
 	ret = perf_session__process_events(session, &event_ops);
 
-	if (debug_mode) {
+	if (debug_mode)
 		pr_err("Misordered timestamps: %llu\n", nr_unordered);
-		pr_err("Lost events: %llu\n", nr_lost);
-	}
 
 	return ret;
 }
-- 
1.6.2.5


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

* [PATCH 5/5] perf script: Make some lists static
  2011-01-05 17:04 [GIT PULL 0/5] perf/core fixes and cleanups Arnaldo Carvalho de Melo
                   ` (3 preceding siblings ...)
  2011-01-05 17:04 ` [PATCH 4/5] perf script: Use the default lost event handler Arnaldo Carvalho de Melo
@ 2011-01-05 17:04 ` Arnaldo Carvalho de Melo
  2011-01-05 17:31 ` [GIT PULL 0/5] perf/core fixes and cleanups Ingo Molnar
  5 siblings, 0 replies; 7+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-01-05 17:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Frederic Weisbecker,
	Ingo Molnar, Mike Galbraith, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian, Tom Zanussi

From: Arnaldo Carvalho de Melo <acme@redhat.com>

Not accessed outside builtin-script, so make them static.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-script.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 27d568d..150a606 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -137,7 +137,7 @@ struct script_spec {
 	char			spec[0];
 };
 
-LIST_HEAD(script_specs);
+static LIST_HEAD(script_specs);
 
 static struct script_spec *script_spec__new(const char *spec,
 					    struct scripting_ops *ops)
@@ -319,7 +319,7 @@ struct script_desc {
 	char			*args;
 };
 
-LIST_HEAD(script_descs);
+static LIST_HEAD(script_descs);
 
 static struct script_desc *script_desc__new(const char *name)
 {
-- 
1.6.2.5


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

* Re: [GIT PULL 0/5] perf/core fixes and cleanups
  2011-01-05 17:04 [GIT PULL 0/5] perf/core fixes and cleanups Arnaldo Carvalho de Melo
                   ` (4 preceding siblings ...)
  2011-01-05 17:04 ` [PATCH 5/5] perf script: Make some lists static Arnaldo Carvalho de Melo
@ 2011-01-05 17:31 ` Ingo Molnar
  5 siblings, 0 replies; 7+ messages in thread
From: Ingo Molnar @ 2011-01-05 17:31 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, David S . Miller, Frederic Weisbecker,
	Mike Galbraith, Paul Mackerras, Peter Zijlstra, Robert Richter,
	Stephane Eranian, Stephane Eranian, Tom Zanussi,
	Arnaldo Carvalho de Melo


* Arnaldo Carvalho de Melo <acme@infradead.org> wrote:

> Hi Ingo,
> 
>         Please consider pulling from:
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 perf/core
> 
> 	I removed the patch that introduced map__empty and caused those
> aliasing problems on f12 i386, I tried but couldn't reproduce it on a f14
> i386 machine, will investigate more later.
> 
> 	The synch of master.k.o to g.k.o these days is taking a long time, so
> beware.
> 
> Regards,
> 
> - Arnaldo
> 
> Arnaldo Carvalho de Melo (4):
>   perf test: Clarify some error reports in the open syscall test
>   perf session: Warn about errors when processing pipe events too
>   perf script: Use the default lost event handler
>   perf script: Make some lists static
> 
> Stephane Eranian (1):
>   perf tools: Fix perf_event.h header usage
> 
>  tools/perf/builtin-script.c    |   19 ++-----------
>  tools/perf/builtin-test.c      |   18 +++++++-----
>  tools/perf/util/evsel.h        |    2 +-
>  tools/perf/util/parse-events.h |    2 +-
>  tools/perf/util/session.c      |   57 +++++++++++++++++++++------------------
>  5 files changed, 47 insertions(+), 51 deletions(-)

Pulled, thanks a lot Arnaldo!

	Ingo

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

end of thread, other threads:[~2011-01-05 17:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-05 17:04 [GIT PULL 0/5] perf/core fixes and cleanups Arnaldo Carvalho de Melo
2011-01-05 17:04 ` [PATCH 1/5] perf test: Clarify some error reports in the open syscall test Arnaldo Carvalho de Melo
2011-01-05 17:04 ` [PATCH 2/5] perf tools: Fix perf_event.h header usage Arnaldo Carvalho de Melo
2011-01-05 17:04 ` [PATCH 3/5] perf session: Warn about errors when processing pipe events too Arnaldo Carvalho de Melo
2011-01-05 17:04 ` [PATCH 4/5] perf script: Use the default lost event handler Arnaldo Carvalho de Melo
2011-01-05 17:04 ` [PATCH 5/5] perf script: Make some lists static Arnaldo Carvalho de Melo
2011-01-05 17:31 ` [GIT PULL 0/5] perf/core fixes and cleanups Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox