2015-04-23 22:03:25

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: [GIT PULL 0/4] perf/urgent fixes

Hi Ingo,

Please consider pulling,

- Arnaldo

The following changes since commit 0140e6141e4f1d4b15fb469e6912b0e71b7d1cc2:

perf/x86/intel/uncore: Move PCI IDs for IMC to uncore driver (2015-04-22 08:29:19 +0200)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-urgent-for-mingo

for you to fetch changes up to de28c15daf60e9625bece22f13a091fac8d05f1d:

tools lib api: Undefine _FORTIFY_SOURCE before setting it (2015-04-23 17:08:23 -0300)

----------------------------------------------------------------
perf/urgent fixes:

User visible:

- Enable events when doing system wide 'trace' and starting a
workload, e.g:

# trace -a sleep 1

now it matches the pattern in 'record' and will show envents
instead of sitting doing nothing while waiting for the started
workload to finish (Arnaldo Carvalho de Melo)

- Disable and drain events when forked 'trace' workload ends
making sure we notice the end of the workload instead of
trying to keep up with the seemingly neverending flux of
system wide events (Arnaldo Carvalho de Melo)

Infrastructure:

- Fix the build on 32-bit ARM by consistently use PRIu64 for printing u64
values in 'perf kmem' (Will Deacon)

- Undefine _FORTIFY_SOURCE before setting it in tools/perf/api, fixing the build on
Hardened Gentoo systems (Bobby Powers)

Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>

----------------------------------------------------------------
Arnaldo Carvalho de Melo (2):
perf trace: Enable events when doing system wide tracing and starting a workload
perf trace: Disable events and drain events when forked workload ends

Bobby Powers (1):
tools lib api: Undefine _FORTIFY_SOURCE before setting it

Will Deacon (1):
perf kmem: Consistently use PRIu64 for printing u64 values

tools/lib/api/Makefile | 2 +-
tools/perf/builtin-kmem.c | 4 ++--
tools/perf/builtin-trace.c | 10 ++++++++--
3 files changed, 11 insertions(+), 5 deletions(-)


2015-04-23 22:03:34

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: [PATCH 1/4] perf trace: Enable events when doing system wide tracing and starting a workload

From: Arnaldo Carvalho de Melo <[email protected]>

commit f7aa222ff397
Author: Arnaldo Carvalho de Melo <[email protected]>
Date: Tue Feb 3 13:25:39 2015 -0300

perf trace: No need to enable evsels for workload started from perf

The assumption was that whenever a workload is specified, the
attr.enable_on_exec evsel flag would be set, but that is not happening
when perf_record_opts.system_wide is set, for instance

That resulted in both perf_evlist__enable() and attr.enable_on_exec
being not called/set, which made the events to remain disabled while the
workload runs, producing no output.

Fix it, by calling perf_evlist__enable() in the 'trace' tool
when forking and not targetting a workload started from trace

v2: Test against !target__none(), as suggested by Namhyung Kim, that is
what is used in perf_evsel__config() when deciding if the
attr.enable_on_exec flag to be set. More work is needed to cover other
cases such as opts->initial_delay.

Acked-by: Jiri Olsa <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Don Zickus <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Stephane Eranian <[email protected]>
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/builtin-trace.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index e124741be187..8842218e1856 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -2241,10 +2241,11 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
if (err < 0)
goto out_error_mmap;

+ if (!target__none(&trace->opts.target))
+ perf_evlist__enable(evlist);
+
if (forks)
perf_evlist__start_workload(evlist);
- else
- perf_evlist__enable(evlist);

trace->multiple_threads = evlist->threads->map[0] == -1 ||
evlist->threads->nr > 1 ||
--
1.9.3

2015-04-23 22:03:36

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: [PATCH 2/4] perf trace: Disable events and drain events when forked workload ends

From: Arnaldo Carvalho de Melo <[email protected]>

We were not checking in the inner event processing loop if the forked workload
had finished, which, on a busy system, may make it take a long time trying to
drain events, entering a seemingly neverending loop, waiting for the system to
get idle enough to make it drain the buffers.

Fix it by disabling the events when 'done' is true, in the inner loop, to start
draining what is in the buffers.

Now:

[root@ssdandy ~]# time trace --filter-pids 14003 -a sleep 1 | tail
996.748 ( 0.002 ms): sh/30296 rt_sigprocmask(how: SETMASK, nset: 0x7ffc83418160, sigsetsize: 8) = 0
996.751 ( 0.002 ms): sh/30296 rt_sigprocmask(how: BLOCK, nset: 0x7ffc834181f0, oset: 0x7ffc83418270, sigsetsize: 8) = 0
996.755 ( 0.002 ms): sh/30296 rt_sigaction(sig: INT, act: 0x7ffc83417f50, oact: 0x7ffc83417ff0, sigsetsize: 8) = 0
1004.543 ( 0.362 ms): tail/30198 ... [continued]: read()) = 4096
1004.548 ( 7.791 ms): sh/30296 wait4(upid: -1, stat_addr: 0x7ffc834181a0) ...
1004.975 ( 0.427 ms): tail/30198 read(buf: 0x7633f0, count: 8192) = 4096
1005.390 ( 0.410 ms): tail/30198 read(buf: 0x765410, count: 8192) = 4096
1005.743 ( 0.348 ms): tail/30198 read(buf: 0x7633f0, count: 8192) = 4096
1006.197 ( 0.449 ms): tail/30198 read(buf: 0x765410, count: 8192) = 4096
1006.492 ( 0.290 ms): tail/30198 read(buf: 0x7633f0, count: 8192) = 4096

real 0m1.219s
user 0m0.704s
sys 0m0.331s
[root@ssdandy ~]#

Reported-by: Michael Petlan <[email protected]>
Suggested-by: Jiri Olsa <[email protected]>
Acked-by: Jiri Olsa <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Don Zickus <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Stephane Eranian <[email protected]>
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/builtin-trace.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 8842218e1856..e122970361f2 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -2273,6 +2273,11 @@ next_event:

if (interrupted)
goto out_disable;
+
+ if (done && !draining) {
+ perf_evlist__disable(evlist);
+ draining = true;
+ }
}
}

--
1.9.3

2015-04-23 22:04:02

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: [PATCH 3/4] perf kmem: Consistently use PRIu64 for printing u64 values

From: Will Deacon <[email protected]>

Building the perf tool for 32-bit ARM results in the following build
error due to a combination of an incorrect conversion specifier and
compiling with -Werror:

builtin-kmem.c: In function ‘print_page_summary’:
builtin-kmem.c:644:9: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘u64’ [-Werror=format=]
nr_alloc_freed, (total_alloc_freed_bytes) / 1024);
^
builtin-kmem.c:647:9: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘u64’ [-Werror=format=]
(total_page_alloc_bytes - total_alloc_freed_bytes) / 1024);
^
cc1: all warnings being treated as errors

This patch fixes the problem by consistently using PRIu64 for printing
out u64 values.

Signed-off-by: Will Deacon <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Joonsoo Kim <[email protected]>
Cc: Minchan Kim <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/builtin-kmem.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index 63ea01349b6e..a1915b430044 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -640,9 +640,9 @@ static void print_page_summary(void)
nr_page_frees, total_page_free_bytes / 1024);
printf("\n");

- printf("%-30s: %'16lu [ %'16"PRIu64" KB ]\n", "Total alloc+freed requests",
+ printf("%-30s: %'16"PRIu64" [ %'16"PRIu64" KB ]\n", "Total alloc+freed requests",
nr_alloc_freed, (total_alloc_freed_bytes) / 1024);
- printf("%-30s: %'16lu [ %'16"PRIu64" KB ]\n", "Total alloc-only requests",
+ printf("%-30s: %'16"PRIu64" [ %'16"PRIu64" KB ]\n", "Total alloc-only requests",
nr_page_allocs - nr_alloc_freed,
(total_page_alloc_bytes - total_alloc_freed_bytes) / 1024);
printf("%-30s: %'16lu [ %'16"PRIu64" KB ]\n", "Total free-only requests",
--
1.9.3

2015-04-23 22:03:45

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: [PATCH 4/4] tools lib api: Undefine _FORTIFY_SOURCE before setting it

From: Bobby Powers <[email protected]>

Some toolchains (like Hardened Gentoo) define _FORTIFY_SOURCE in the
built-in, default args. This causes perf builds to fail with:

<command-line>:0:0: error: "_FORTIFY_SOURCE" redefined [-Werror]
<built-in>: note: this is the location of the previous definition cc1:
all warnings being treated as errors

To avoid this, undefine _FORTIFY_SOURCE before (possibly re-)defining it
in tools/lib/api.

v2 applies cleanly on top of already pulled kbuild changes for 4.1-rc1.

Signed-off-by: Bobby Powers <[email protected]>
Acked-by: Jiri Olsa <[email protected]>
Cc: Dirk Gouders <[email protected]>
Cc: Michal Marek <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/lib/api/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/lib/api/Makefile b/tools/lib/api/Makefile
index d8fe29fc19a4..8bd960658463 100644
--- a/tools/lib/api/Makefile
+++ b/tools/lib/api/Makefile
@@ -16,7 +16,7 @@ MAKEFLAGS += --no-print-directory
LIBFILE = $(OUTPUT)libapi.a

CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)
-CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 -fPIC
+CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC
CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64

RM = rm -f
--
1.9.3

2015-04-24 02:07:23

by Namhyung Kim

[permalink] [raw]
Subject: Re: [GIT PULL 0/4] perf/urgent fixes

Hi Arnaldo,

I've set up some docker containers for build test, and found a couple
of failures.. It seems David's kmem build fix ("perf kmem: Fix
compiles on RHEL6/OL6") which is in your perf/core branch also needs
to be in perf/urgent. Sorry about the kmem breakages..

And I also found this..


>From 581ae7f48c89377755391c3f95637a1d48eefc73 Mon Sep 17 00:00:00 2001
From: Namhyung Kim <[email protected]>
Date: Fri, 24 Apr 2015 10:45:16 +0900
Subject: [PATCH] tools lib traceevent: Fix build failure on 32-bit arch

In my i386 build, it failed like this:

CC event-parse.o
event-parse.c: In function 'print_str_arg':
event-parse.c:3868:5: warning: format '%lu' expects argument of type 'long unsigned int',
but argument 3 has type 'uint64_t' [-Wformat]

Cc: Javi Merino <[email protected]>
Signed-off-by: Namhyung Kim <[email protected]>
---
tools/lib/traceevent/event-parse.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 12a7e2a40c89..aa21bd55bd8a 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -3865,7 +3865,7 @@ static void print_str_arg(struct trace_seq *s, void *data, int size,
} else if (el_size == 4) {
trace_seq_printf(s, "%u", *(uint32_t *)num);
} else if (el_size == 8) {
- trace_seq_printf(s, "%lu", *(uint64_t *)num);
+ trace_seq_printf(s, "%"PRIu64, *(uint64_t *)num);
} else {
trace_seq_printf(s, "BAD SIZE:%d 0x%x",
el_size, *(uint8_t *)num);
--
2.3.4


Thanks,
Namhyung


On Thu, Apr 23, 2015 at 07:03:06PM -0300, Arnaldo Carvalho de Melo wrote:
> Hi Ingo,
>
> Please consider pulling,
>
> - Arnaldo
>
> The following changes since commit 0140e6141e4f1d4b15fb469e6912b0e71b7d1cc2:
>
> perf/x86/intel/uncore: Move PCI IDs for IMC to uncore driver (2015-04-22 08:29:19 +0200)
>
> are available in the git repository at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-urgent-for-mingo
>
> for you to fetch changes up to de28c15daf60e9625bece22f13a091fac8d05f1d:
>
> tools lib api: Undefine _FORTIFY_SOURCE before setting it (2015-04-23 17:08:23 -0300)
>
> ----------------------------------------------------------------
> perf/urgent fixes:
>
> User visible:
>
> - Enable events when doing system wide 'trace' and starting a
> workload, e.g:
>
> # trace -a sleep 1
>
> now it matches the pattern in 'record' and will show envents
> instead of sitting doing nothing while waiting for the started
> workload to finish (Arnaldo Carvalho de Melo)
>
> - Disable and drain events when forked 'trace' workload ends
> making sure we notice the end of the workload instead of
> trying to keep up with the seemingly neverending flux of
> system wide events (Arnaldo Carvalho de Melo)
>
> Infrastructure:
>
> - Fix the build on 32-bit ARM by consistently use PRIu64 for printing u64
> values in 'perf kmem' (Will Deacon)
>
> - Undefine _FORTIFY_SOURCE before setting it in tools/perf/api, fixing the build on
> Hardened Gentoo systems (Bobby Powers)
>
> Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
>
> ----------------------------------------------------------------
> Arnaldo Carvalho de Melo (2):
> perf trace: Enable events when doing system wide tracing and starting a workload
> perf trace: Disable events and drain events when forked workload ends
>
> Bobby Powers (1):
> tools lib api: Undefine _FORTIFY_SOURCE before setting it
>
> Will Deacon (1):
> perf kmem: Consistently use PRIu64 for printing u64 values
>
> tools/lib/api/Makefile | 2 +-
> tools/perf/builtin-kmem.c | 4 ++--
> tools/perf/builtin-trace.c | 10 ++++++++--
> 3 files changed, 11 insertions(+), 5 deletions(-)
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

2015-04-24 02:09:37

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [GIT PULL 0/4] perf/urgent fixes

Em Fri, Apr 24, 2015 at 11:02:18AM +0900, Namhyung Kim escreveu:
> Hi Arnaldo,
>
> I've set up some docker containers for build test, and found a couple
> of failures.. It seems David's kmem build fix ("perf kmem: Fix
> compiles on RHEL6/OL6") which is in your perf/core branch also needs
> to be in perf/urgent. Sorry about the kmem breakages..
>
> And I also found this..

I can send those tomorrow, in another pull request to Ingo. I noticed a
few on a RHEL5 machine I tested today, in libtraceevent even, I guess
you was on the CC list for that bug report.

- Arnaldo

>
> >From 581ae7f48c89377755391c3f95637a1d48eefc73 Mon Sep 17 00:00:00 2001
> From: Namhyung Kim <[email protected]>
> Date: Fri, 24 Apr 2015 10:45:16 +0900
> Subject: [PATCH] tools lib traceevent: Fix build failure on 32-bit arch
>
> In my i386 build, it failed like this:
>
> CC event-parse.o
> event-parse.c: In function 'print_str_arg':
> event-parse.c:3868:5: warning: format '%lu' expects argument of type 'long unsigned int',
> but argument 3 has type 'uint64_t' [-Wformat]
>
> Cc: Javi Merino <[email protected]>
> Signed-off-by: Namhyung Kim <[email protected]>
> ---
> tools/lib/traceevent/event-parse.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
> index 12a7e2a40c89..aa21bd55bd8a 100644
> --- a/tools/lib/traceevent/event-parse.c
> +++ b/tools/lib/traceevent/event-parse.c
> @@ -3865,7 +3865,7 @@ static void print_str_arg(struct trace_seq *s, void *data, int size,
> } else if (el_size == 4) {
> trace_seq_printf(s, "%u", *(uint32_t *)num);
> } else if (el_size == 8) {
> - trace_seq_printf(s, "%lu", *(uint64_t *)num);
> + trace_seq_printf(s, "%"PRIu64, *(uint64_t *)num);
> } else {
> trace_seq_printf(s, "BAD SIZE:%d 0x%x",
> el_size, *(uint8_t *)num);
> --
> 2.3.4
>
>
> Thanks,
> Namhyung
>
>
> On Thu, Apr 23, 2015 at 07:03:06PM -0300, Arnaldo Carvalho de Melo wrote:
> > Hi Ingo,
> >
> > Please consider pulling,
> >
> > - Arnaldo
> >
> > The following changes since commit 0140e6141e4f1d4b15fb469e6912b0e71b7d1cc2:
> >
> > perf/x86/intel/uncore: Move PCI IDs for IMC to uncore driver (2015-04-22 08:29:19 +0200)
> >
> > are available in the git repository at:
> >
> > git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-urgent-for-mingo
> >
> > for you to fetch changes up to de28c15daf60e9625bece22f13a091fac8d05f1d:
> >
> > tools lib api: Undefine _FORTIFY_SOURCE before setting it (2015-04-23 17:08:23 -0300)
> >
> > ----------------------------------------------------------------
> > perf/urgent fixes:
> >
> > User visible:
> >
> > - Enable events when doing system wide 'trace' and starting a
> > workload, e.g:
> >
> > # trace -a sleep 1
> >
> > now it matches the pattern in 'record' and will show envents
> > instead of sitting doing nothing while waiting for the started
> > workload to finish (Arnaldo Carvalho de Melo)
> >
> > - Disable and drain events when forked 'trace' workload ends
> > making sure we notice the end of the workload instead of
> > trying to keep up with the seemingly neverending flux of
> > system wide events (Arnaldo Carvalho de Melo)
> >
> > Infrastructure:
> >
> > - Fix the build on 32-bit ARM by consistently use PRIu64 for printing u64
> > values in 'perf kmem' (Will Deacon)
> >
> > - Undefine _FORTIFY_SOURCE before setting it in tools/perf/api, fixing the build on
> > Hardened Gentoo systems (Bobby Powers)
> >
> > Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
> >
> > ----------------------------------------------------------------
> > Arnaldo Carvalho de Melo (2):
> > perf trace: Enable events when doing system wide tracing and starting a workload
> > perf trace: Disable events and drain events when forked workload ends
> >
> > Bobby Powers (1):
> > tools lib api: Undefine _FORTIFY_SOURCE before setting it
> >
> > Will Deacon (1):
> > perf kmem: Consistently use PRIu64 for printing u64 values
> >
> > tools/lib/api/Makefile | 2 +-
> > tools/perf/builtin-kmem.c | 4 ++--
> > tools/perf/builtin-trace.c | 10 ++++++++--
> > 3 files changed, 11 insertions(+), 5 deletions(-)
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > the body of a message to [email protected]
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at http://www.tux.org/lkml/

2015-04-24 08:59:40

by Javi Merino

[permalink] [raw]
Subject: Re: [GIT PULL 0/4] perf/urgent fixes

On Fri, Apr 24, 2015 at 03:02:18AM +0100, Namhyung Kim wrote:
> Hi Arnaldo,
>
> I've set up some docker containers for build test, and found a couple
> of failures.. It seems David's kmem build fix ("perf kmem: Fix
> compiles on RHEL6/OL6") which is in your perf/core branch also needs
> to be in perf/urgent. Sorry about the kmem breakages..
>
> And I also found this..
>
>
> From 581ae7f48c89377755391c3f95637a1d48eefc73 Mon Sep 17 00:00:00 2001
> From: Namhyung Kim <[email protected]>
> Date: Fri, 24 Apr 2015 10:45:16 +0900
> Subject: [PATCH] tools lib traceevent: Fix build failure on 32-bit arch
>
> In my i386 build, it failed like this:
>
> CC event-parse.o
> event-parse.c: In function 'print_str_arg':
> event-parse.c:3868:5: warning: format '%lu' expects argument of type 'long unsigned int',
> but argument 3 has type 'uint64_t' [-Wformat]
>
> Cc: Javi Merino <[email protected]>
> Signed-off-by: Namhyung Kim <[email protected]>
> ---
> tools/lib/traceevent/event-parse.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
> index 12a7e2a40c89..aa21bd55bd8a 100644
> --- a/tools/lib/traceevent/event-parse.c
> +++ b/tools/lib/traceevent/event-parse.c
> @@ -3865,7 +3865,7 @@ static void print_str_arg(struct trace_seq *s, void *data, int size,
> } else if (el_size == 4) {
> trace_seq_printf(s, "%u", *(uint32_t *)num);
> } else if (el_size == 8) {
> - trace_seq_printf(s, "%lu", *(uint64_t *)num);
> + trace_seq_printf(s, "%"PRIu64, *(uint64_t *)num);

Didn't know about PRIu64 and friends. FWIW,

Acked-by: Javi Merino <[email protected]>

While you are at it, you could also fix the previous "%u" to "%"PRIu32

> } else {
> trace_seq_printf(s, "BAD SIZE:%d 0x%x",
> el_size, *(uint8_t *)num);
> --
> 2.3.4
>
>
> Thanks,
> Namhyung
>
>
> On Thu, Apr 23, 2015 at 07:03:06PM -0300, Arnaldo Carvalho de Melo wrote:
> > Hi Ingo,
> >
> > Please consider pulling,
> >
> > - Arnaldo
> >
> > The following changes since commit 0140e6141e4f1d4b15fb469e6912b0e71b7d1cc2:
> >
> > perf/x86/intel/uncore: Move PCI IDs for IMC to uncore driver (2015-04-22 08:29:19 +0200)
> >
> > are available in the git repository at:
> >
> > git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-urgent-for-mingo
> >
> > for you to fetch changes up to de28c15daf60e9625bece22f13a091fac8d05f1d:
> >
> > tools lib api: Undefine _FORTIFY_SOURCE before setting it (2015-04-23 17:08:23 -0300)
> >
> > ----------------------------------------------------------------
> > perf/urgent fixes:
> >
> > User visible:
> >
> > - Enable events when doing system wide 'trace' and starting a
> > workload, e.g:
> >
> > # trace -a sleep 1
> >
> > now it matches the pattern in 'record' and will show envents
> > instead of sitting doing nothing while waiting for the started
> > workload to finish (Arnaldo Carvalho de Melo)
> >
> > - Disable and drain events when forked 'trace' workload ends
> > making sure we notice the end of the workload instead of
> > trying to keep up with the seemingly neverending flux of
> > system wide events (Arnaldo Carvalho de Melo)
> >
> > Infrastructure:
> >
> > - Fix the build on 32-bit ARM by consistently use PRIu64 for printing u64
> > values in 'perf kmem' (Will Deacon)
> >
> > - Undefine _FORTIFY_SOURCE before setting it in tools/perf/api, fixing the build on
> > Hardened Gentoo systems (Bobby Powers)
> >
> > Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
> >
> > ----------------------------------------------------------------
> > Arnaldo Carvalho de Melo (2):
> > perf trace: Enable events when doing system wide tracing and starting a workload
> > perf trace: Disable events and drain events when forked workload ends
> >
> > Bobby Powers (1):
> > tools lib api: Undefine _FORTIFY_SOURCE before setting it
> >
> > Will Deacon (1):
> > perf kmem: Consistently use PRIu64 for printing u64 values
> >
> > tools/lib/api/Makefile | 2 +-
> > tools/perf/builtin-kmem.c | 4 ++--
> > tools/perf/builtin-trace.c | 10 ++++++++--
> > 3 files changed, 11 insertions(+), 5 deletions(-)
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > the body of a message to [email protected]
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at http://www.tux.org/lkml/
>

2015-04-24 16:02:27

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [GIT PULL 0/4] perf/urgent fixes

Em Fri, Apr 24, 2015 at 09:59:18AM +0100, Javi Merino escreveu:
> On Fri, Apr 24, 2015 at 03:02:18AM +0100, Namhyung Kim wrote:
> > Hi Arnaldo,
> >
> > I've set up some docker containers for build test, and found a couple
> > of failures.. It seems David's kmem build fix ("perf kmem: Fix
> > compiles on RHEL6/OL6") which is in your perf/core branch also needs
> > to be in perf/urgent. Sorry about the kmem breakages..
> >
> > And I also found this..

Applied both, some more?

- Arnaldo

> >
> > From 581ae7f48c89377755391c3f95637a1d48eefc73 Mon Sep 17 00:00:00 2001
> > From: Namhyung Kim <[email protected]>
> > Date: Fri, 24 Apr 2015 10:45:16 +0900
> > Subject: [PATCH] tools lib traceevent: Fix build failure on 32-bit arch
> >
> > In my i386 build, it failed like this:
> >
> > CC event-parse.o
> > event-parse.c: In function 'print_str_arg':
> > event-parse.c:3868:5: warning: format '%lu' expects argument of type 'long unsigned int',
> > but argument 3 has type 'uint64_t' [-Wformat]
> >
> > Cc: Javi Merino <[email protected]>
> > Signed-off-by: Namhyung Kim <[email protected]>
> > ---
> > tools/lib/traceevent/event-parse.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
> > index 12a7e2a40c89..aa21bd55bd8a 100644
> > --- a/tools/lib/traceevent/event-parse.c
> > +++ b/tools/lib/traceevent/event-parse.c
> > @@ -3865,7 +3865,7 @@ static void print_str_arg(struct trace_seq *s, void *data, int size,
> > } else if (el_size == 4) {
> > trace_seq_printf(s, "%u", *(uint32_t *)num);
> > } else if (el_size == 8) {
> > - trace_seq_printf(s, "%lu", *(uint64_t *)num);
> > + trace_seq_printf(s, "%"PRIu64, *(uint64_t *)num);
>
> Didn't know about PRIu64 and friends. FWIW,
>
> Acked-by: Javi Merino <[email protected]>
>
> While you are at it, you could also fix the previous "%u" to "%"PRIu32
>
> > } else {
> > trace_seq_printf(s, "BAD SIZE:%d 0x%x",
> > el_size, *(uint8_t *)num);
> > --
> > 2.3.4
> >
> >
> > Thanks,
> > Namhyung
> >
> >
> > On Thu, Apr 23, 2015 at 07:03:06PM -0300, Arnaldo Carvalho de Melo wrote:
> > > Hi Ingo,
> > >
> > > Please consider pulling,
> > >
> > > - Arnaldo
> > >
> > > The following changes since commit 0140e6141e4f1d4b15fb469e6912b0e71b7d1cc2:
> > >
> > > perf/x86/intel/uncore: Move PCI IDs for IMC to uncore driver (2015-04-22 08:29:19 +0200)
> > >
> > > are available in the git repository at:
> > >
> > > git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-urgent-for-mingo
> > >
> > > for you to fetch changes up to de28c15daf60e9625bece22f13a091fac8d05f1d:
> > >
> > > tools lib api: Undefine _FORTIFY_SOURCE before setting it (2015-04-23 17:08:23 -0300)
> > >
> > > ----------------------------------------------------------------
> > > perf/urgent fixes:
> > >
> > > User visible:
> > >
> > > - Enable events when doing system wide 'trace' and starting a
> > > workload, e.g:
> > >
> > > # trace -a sleep 1
> > >
> > > now it matches the pattern in 'record' and will show envents
> > > instead of sitting doing nothing while waiting for the started
> > > workload to finish (Arnaldo Carvalho de Melo)
> > >
> > > - Disable and drain events when forked 'trace' workload ends
> > > making sure we notice the end of the workload instead of
> > > trying to keep up with the seemingly neverending flux of
> > > system wide events (Arnaldo Carvalho de Melo)
> > >
> > > Infrastructure:
> > >
> > > - Fix the build on 32-bit ARM by consistently use PRIu64 for printing u64
> > > values in 'perf kmem' (Will Deacon)
> > >
> > > - Undefine _FORTIFY_SOURCE before setting it in tools/perf/api, fixing the build on
> > > Hardened Gentoo systems (Bobby Powers)
> > >
> > > Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
> > >
> > > ----------------------------------------------------------------
> > > Arnaldo Carvalho de Melo (2):
> > > perf trace: Enable events when doing system wide tracing and starting a workload
> > > perf trace: Disable events and drain events when forked workload ends
> > >
> > > Bobby Powers (1):
> > > tools lib api: Undefine _FORTIFY_SOURCE before setting it
> > >
> > > Will Deacon (1):
> > > perf kmem: Consistently use PRIu64 for printing u64 values
> > >
> > > tools/lib/api/Makefile | 2 +-
> > > tools/perf/builtin-kmem.c | 4 ++--
> > > tools/perf/builtin-trace.c | 10 ++++++++--
> > > 3 files changed, 11 insertions(+), 5 deletions(-)
> > > --
> > > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > > the body of a message to [email protected]
> > > More majordomo info at http://vger.kernel.org/majordomo-info.html
> > > Please read the FAQ at http://www.tux.org/lkml/
> >

2015-04-24 16:05:52

by Will Deacon

[permalink] [raw]
Subject: Re: [GIT PULL 0/4] perf/urgent fixes

On Fri, Apr 24, 2015 at 05:02:17PM +0100, Arnaldo Carvalho de Melo wrote:
> Em Fri, Apr 24, 2015 at 09:59:18AM +0100, Javi Merino escreveu:
> > On Fri, Apr 24, 2015 at 03:02:18AM +0100, Namhyung Kim wrote:
> > > Hi Arnaldo,
> > >
> > > I've set up some docker containers for build test, and found a couple
> > > of failures.. It seems David's kmem build fix ("perf kmem: Fix
> > > compiles on RHEL6/OL6") which is in your perf/core branch also needs
> > > to be in perf/urgent. Sorry about the kmem breakages..
> > >
> > > And I also found this..
>
> Applied both, some more?

The only issue remaining for arm/arm64 is the /proc/cpuinfo parsing, which
ends up with us passing -jN to Make, where N is 5 or 6 times the number of
CPUs in the system.

http://permalink.gmane.org/gmane.linux.kernel/1936575

Will

Subject: [tip:perf/urgent] tools lib traceevent: Fix build failure on 32-bit arch

Commit-ID: 410ceb8f2f1d4edeb02d229ef192e76602005b8b
Gitweb: http://git.kernel.org/tip/410ceb8f2f1d4edeb02d229ef192e76602005b8b
Author: Namhyung Kim <[email protected]>
AuthorDate: Fri, 24 Apr 2015 10:45:16 +0900
Committer: Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 24 Apr 2015 12:47:10 -0300

tools lib traceevent: Fix build failure on 32-bit arch

In my i386 build, it failed like this:

CC event-parse.o
event-parse.c: In function 'print_str_arg':
event-parse.c:3868:5: warning: format '%lu' expects argument of type 'long unsigned int',
but argument 3 has type 'uint64_t' [-Wformat]

Signed-off-by: Namhyung Kim <[email protected]>
Acked-by: Javi Merino <[email protected]>
Link: http://lkml.kernel.org/r/20150424020218.GF1905@sejong
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/lib/traceevent/event-parse.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 12a7e2a..aa21bd5 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -3865,7 +3865,7 @@ static void print_str_arg(struct trace_seq *s, void *data, int size,
} else if (el_size == 4) {
trace_seq_printf(s, "%u", *(uint32_t *)num);
} else if (el_size == 8) {
- trace_seq_printf(s, "%lu", *(uint64_t *)num);
+ trace_seq_printf(s, "%"PRIu64, *(uint64_t *)num);
} else {
trace_seq_printf(s, "BAD SIZE:%d 0x%x",
el_size, *(uint8_t *)num);