[tip:perf/urgent] perf tests: Fix memory leak by expr__find_other() in test__expr()

2019-03-22 Thread tip-bot for Changbin Du
Commit-ID:  f97a8991d3b998e518f56794d879f645964de649
Gitweb: https://git.kernel.org/tip/f97a8991d3b998e518f56794d879f645964de649
Author: Changbin Du 
AuthorDate: Sat, 16 Mar 2019 16:05:55 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 19 Mar 2019 16:52:05 -0300

perf tests: Fix memory leak by expr__find_other() in test__expr()

  =
  ==7506==ERROR: LeakSanitizer: detected memory leaks

  Direct leak of 13 byte(s) in 3 object(s) allocated from:
  #0 0x7f03339d6070 in __interceptor_strdup 
(/usr/lib/x86_64-linux-gnu/libasan.so.5+0x3b070)
  #1 0x5625e53aaef0 in expr__find_other util/expr.y:221
  #2 0x5625e51bcd3f in test__expr tests/expr.c:52
  #3 0x5625e51528e6 in run_test tests/builtin-test.c:358
  #4 0x5625e5152baf in test_and_print tests/builtin-test.c:388
  #5 0x5625e51543fe in __cmd_test tests/builtin-test.c:583
  #6 0x5625e515572f in cmd_test tests/builtin-test.c:722
  #7 0x5625e51c3fb8 in run_builtin 
/home/changbin/work/linux/tools/perf/perf.c:302
  #8 0x5625e51c44f7 in handle_internal_command 
/home/changbin/work/linux/tools/perf/perf.c:354
  #9 0x5625e51c48fb in run_argv 
/home/changbin/work/linux/tools/perf/perf.c:398
  #10 0x5625e51c5069 in main /home/changbin/work/linux/tools/perf/perf.c:520
  #11 0x7f033214d09a in __libc_start_main 
(/lib/x86_64-linux-gnu/libc.so.6+0x2409a)

Signed-off-by: Changbin Du 
Cc: Alexei Starovoitov 
Cc: Andi Kleen 
Cc: Daniel Borkmann 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Cc: Steven Rostedt (VMware) 
Fixes: 075167363f8b ("perf tools: Add a simple expression parser for JSON")
Link: http://lkml.kernel.org/r/20190316080556.3075-16-changbin...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/tests/expr.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/perf/tests/expr.c b/tools/perf/tests/expr.c
index 01f0706995a9..9acc1e80b936 100644
--- a/tools/perf/tests/expr.c
+++ b/tools/perf/tests/expr.c
@@ -19,7 +19,7 @@ int test__expr(struct test *t __maybe_unused, int subtest 
__maybe_unused)
const char *p;
const char **other;
double val;
-   int ret;
+   int i, ret;
struct parse_ctx ctx;
int num_other;
 
@@ -56,6 +56,9 @@ int test__expr(struct test *t __maybe_unused, int subtest 
__maybe_unused)
TEST_ASSERT_VAL("find other", !strcmp(other[1], "BAZ"));
TEST_ASSERT_VAL("find other", !strcmp(other[2], "BOZO"));
TEST_ASSERT_VAL("find other", other[3] == NULL);
+
+   for (i = 0; i < num_other; i++)
+   free((void *)other[i]);
free((void *)other);
 
return 0;


[tip:perf/urgent] perf top: Fix global-buffer-overflow issue

2019-03-22 Thread tip-bot for Changbin Du
Commit-ID:  1e5b0cf8672e622257df024074e6e09bfbcb7750
Gitweb: https://git.kernel.org/tip/1e5b0cf8672e622257df024074e6e09bfbcb7750
Author: Changbin Du 
AuthorDate: Sat, 16 Mar 2019 16:05:52 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 19 Mar 2019 16:52:05 -0300

perf top: Fix global-buffer-overflow issue

The array str[] should have six elements.

  =
  ==4322==ERROR: AddressSanitizer: global-buffer-overflow on address 
0x56463844e300 at pc 0x564637e7ad0d bp 0x7f30c8c89d10 sp 0x7f30c8c89d00
  READ of size 8 at 0x56463844e300 thread T9
  #0 0x564637e7ad0c in __ordered_events__flush util/ordered-events.c:316
  #1 0x564637e7b0e4 in ordered_events__flush util/ordered-events.c:338
  #2 0x564637c6a57d in process_thread 
/home/changbin/work/linux/tools/perf/builtin-top.c:1073
  #3 0x7f30d173a163 in start_thread 
(/lib/x86_64-linux-gnu/libpthread.so.0+0x8163)
  #4 0x7f30cfffbdee in __clone (/lib/x86_64-linux-gnu/libc.so.6+0x11adee)

  0x56463844e300 is located 32 bytes to the left of global variable 'flags' 
defined in 'util/trace-event-parse.c:229:26' (0x56463844e320) of size 192
  0x56463844e300 is located 0 bytes to the right of global variable 'str' 
defined in 'util/ordered-events.c:268:28' (0x56463844e2e0) of size 32
  SUMMARY: AddressSanitizer: global-buffer-overflow util/ordered-events.c:316 
in __ordered_events__flush
  Shadow bytes around the buggy address:
0x0ac947081c10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ac947081c20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ac947081c30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ac947081c40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ac947081c50: 00 00 00 00 00 00 00 00 f9 f9 f9 f9 00 00 00 00
  =>0x0ac947081c60:[f9]f9 f9 f9 00 00 00 00 00 00 00 00 00 00 00 00
0x0ac947081c70: 00 00 00 00 00 00 00 00 00 00 00 00 f9 f9 f9 f9
0x0ac947081c80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ac947081c90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ac947081ca0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ac947081cb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable:   00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone:   fa
Freed heap region:   fd
Stack left redzone:  f1
Stack mid redzone:   f2
Stack right redzone: f3
Stack after return:  f5
Stack use after scope:   f8
Global redzone:  f9
Global init order:   f6
Poisoned by user:f7
Container overflow:  fc
Array cookie:ac
Intra object redzone:bb
ASan internal:   fe
Left alloca redzone: ca
Right alloca redzone:cb
  Thread T9 created by T0 here:
  #0 0x7f30d179de5f in __interceptor_pthread_create 
(/usr/lib/x86_64-linux-gnu/libasan.so.5+0x4ae5f)
  #1 0x564637c6b954 in __cmd_top 
/home/changbin/work/linux/tools/perf/builtin-top.c:1253
  #2 0x564637c7173c in cmd_top 
/home/changbin/work/linux/tools/perf/builtin-top.c:1642
  #3 0x564637d85038 in run_builtin 
/home/changbin/work/linux/tools/perf/perf.c:302
  #4 0x564637d85577 in handle_internal_command 
/home/changbin/work/linux/tools/perf/perf.c:354
  #5 0x564637d8597b in run_argv 
/home/changbin/work/linux/tools/perf/perf.c:398
  #6 0x564637d860e9 in main /home/changbin/work/linux/tools/perf/perf.c:520
  #7 0x7f30cff0509a in __libc_start_main 
(/lib/x86_64-linux-gnu/libc.so.6+0x2409a)

Signed-off-by: Changbin Du 
Reviewed-by: Jiri Olsa 
Cc: Alexei Starovoitov 
Cc: Daniel Borkmann 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Cc: Steven Rostedt (VMware) 
Cc: Jiri Olsa 
Fixes: 16c66bc167cc ("perf top: Add processing thread")
Fixes: 68ca5d07de20 ("perf ordered_events: Add ordered_events__flush_time 
interface")
Link: http://lkml.kernel.org/r/20190316080556.3075-13-changbin...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/ordered-events.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/perf/util/ordered-events.c b/tools/perf/util/ordered-events.c
index ea523d3b248f..989fed6f43b5 100644
--- a/tools/perf/util/ordered-events.c
+++ b/tools/perf/util/ordered-events.c
@@ -270,6 +270,8 @@ static int __ordered_events__flush(struct ordered_events 
*oe, enum oe_flush how,
"FINAL",
"ROUND",
"HALF ",
+   "TOP  ",
+   "TIME ",
};
int err;
bool show_progress = false;


[tip:perf/urgent] perf tests: Fix a memory leak in test__perf_evsel__tp_sched_test()

2019-03-22 Thread tip-bot for Changbin Du
Commit-ID:  d982b33133284fa7efa0e52ae06b88f9be3ea764
Gitweb: https://git.kernel.org/tip/d982b33133284fa7efa0e52ae06b88f9be3ea764
Author: Changbin Du 
AuthorDate: Sat, 16 Mar 2019 16:05:56 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 19 Mar 2019 16:52:06 -0300

perf tests: Fix a memory leak in test__perf_evsel__tp_sched_test()

  =
  ==20875==ERROR: LeakSanitizer: detected memory leaks

  Direct leak of 1160 byte(s) in 1 object(s) allocated from:
  #0 0x7f1b6fc84138 in calloc 
(/usr/lib/x86_64-linux-gnu/libasan.so.5+0xee138)
  #1 0x55bd50005599 in zalloc util/util.h:23
  #2 0x55bd500068f5 in perf_evsel__newtp_idx util/evsel.c:327
  #3 0x55bd4ff810fc in perf_evsel__newtp 
/home/work/linux/tools/perf/util/evsel.h:216
  #4 0x55bd4ff81608 in test__perf_evsel__tp_sched_test 
tests/evsel-tp-sched.c:69
  #5 0x55bd4ff528e6 in run_test tests/builtin-test.c:358
  #6 0x55bd4ff52baf in test_and_print tests/builtin-test.c:388
  #7 0x55bd4ff543fe in __cmd_test tests/builtin-test.c:583
  #8 0x55bd4ff5572f in cmd_test tests/builtin-test.c:722
  #9 0x55bd4ffc4087 in run_builtin 
/home/changbin/work/linux/tools/perf/perf.c:302
  #10 0x55bd4ffc45c6 in handle_internal_command 
/home/changbin/work/linux/tools/perf/perf.c:354
  #11 0x55bd4ffc49ca in run_argv 
/home/changbin/work/linux/tools/perf/perf.c:398
  #12 0x55bd4ffc5138 in main /home/changbin/work/linux/tools/perf/perf.c:520
  #13 0x7f1b6e34809a in __libc_start_main 
(/lib/x86_64-linux-gnu/libc.so.6+0x2409a)

  Indirect leak of 19 byte(s) in 1 object(s) allocated from:
  #0 0x7f1b6fc83f30 in __interceptor_malloc 
(/usr/lib/x86_64-linux-gnu/libasan.so.5+0xedf30)
  #1 0x7f1b6e3ac30f in vasprintf (/lib/x86_64-linux-gnu/libc.so.6+0x8830f)

Signed-off-by: Changbin Du 
Reviewed-by: Jiri Olsa 
Cc: Alexei Starovoitov 
Cc: Daniel Borkmann 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Cc: Steven Rostedt (VMware) 
Fixes: 6a6cd11d4e57 ("perf test: Add test for the sched tracepoint format 
fields")
Link: http://lkml.kernel.org/r/20190316080556.3075-17-changbin...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/tests/evsel-tp-sched.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/tests/evsel-tp-sched.c 
b/tools/perf/tests/evsel-tp-sched.c
index ea7acf403727..71f60c0f9faa 100644
--- a/tools/perf/tests/evsel-tp-sched.c
+++ b/tools/perf/tests/evsel-tp-sched.c
@@ -85,5 +85,6 @@ int test__perf_evsel__tp_sched_test(struct test *test 
__maybe_unused, int subtes
if (perf_evsel__test_field(evsel, "target_cpu", 4, true))
ret = -1;
 
+   perf_evsel__delete(evsel);
return ret;
 }


[tip:perf/urgent] perf maps: Purge all maps from the 'names' tree

2019-03-22 Thread tip-bot for Changbin Du
Commit-ID:  da3a53a7390a89391bd63bead0c2e9af4c5ef3d6
Gitweb: https://git.kernel.org/tip/da3a53a7390a89391bd63bead0c2e9af4c5ef3d6
Author: Changbin Du 
AuthorDate: Sat, 16 Mar 2019 16:05:51 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 19 Mar 2019 16:52:05 -0300

perf maps: Purge all maps from the 'names' tree

Add function __maps__purge_names() to purge all maps from the names
tree.  We need to cleanup the names tree in maps__exit().

Detected with gcc's ASan.

Signed-off-by: Changbin Du 
Reviewed-by: Jiri Olsa 
Cc: Alexei Starovoitov 
Cc: Daniel Borkmann 
Cc: Eric Saint-Etienne 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Cc: Steven Rostedt (VMware) 
Fixes: 1e6285699b30 ("perf symbols: Fix slowness due to -ffunction-section")
Link: http://lkml.kernel.org/r/20190316080556.3075-12-changbin...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/map.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index 64bea5eb8bf6..e32628cd20a7 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -577,10 +577,25 @@ static void __maps__purge(struct maps *maps)
}
 }
 
+static void __maps__purge_names(struct maps *maps)
+{
+   struct rb_root *root = >names;
+   struct rb_node *next = rb_first(root);
+
+   while (next) {
+   struct map *pos = rb_entry(next, struct map, rb_node_name);
+
+   next = rb_next(>rb_node_name);
+   rb_erase_init(>rb_node_name, root);
+   map__put(pos);
+   }
+}
+
 static void maps__exit(struct maps *maps)
 {
down_write(>lock);
__maps__purge(maps);
+   __maps__purge_names(maps);
up_write(>lock);
 }
 


[tip:perf/urgent] perf tests: Fix a memory leak of cpu_map object in the openat_syscall_event_on_all_cpus test

2019-03-22 Thread tip-bot for Changbin Du
Commit-ID:  93faa52e8371f0291ee1ff4994edae2b336b6233
Gitweb: https://git.kernel.org/tip/93faa52e8371f0291ee1ff4994edae2b336b6233
Author: Changbin Du 
AuthorDate: Sat, 16 Mar 2019 16:05:54 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 19 Mar 2019 16:52:05 -0300

perf tests: Fix a memory leak of cpu_map object in the 
openat_syscall_event_on_all_cpus test

  =
  ==7497==ERROR: LeakSanitizer: detected memory leaks

  Direct leak of 40 byte(s) in 1 object(s) allocated from:
  #0 0x7f0333a88f30 in __interceptor_malloc 
(/usr/lib/x86_64-linux-gnu/libasan.so.5+0xedf30)
  #1 0x5625e5326213 in cpu_map__trim_new util/cpumap.c:45
  #2 0x5625e5326703 in cpu_map__read util/cpumap.c:103
  #3 0x5625e53267ef in cpu_map__read_all_cpu_map util/cpumap.c:120
  #4 0x5625e5326915 in cpu_map__new util/cpumap.c:135
  #5 0x5625e517b355 in test__openat_syscall_event_on_all_cpus 
tests/openat-syscall-all-cpus.c:36
  #6 0x5625e51528e6 in run_test tests/builtin-test.c:358
  #7 0x5625e5152baf in test_and_print tests/builtin-test.c:388
  #8 0x5625e51543fe in __cmd_test tests/builtin-test.c:583
  #9 0x5625e515572f in cmd_test tests/builtin-test.c:722
  #10 0x5625e51c3fb8 in run_builtin 
/home/changbin/work/linux/tools/perf/perf.c:302
  #11 0x5625e51c44f7 in handle_internal_command 
/home/changbin/work/linux/tools/perf/perf.c:354
  #12 0x5625e51c48fb in run_argv 
/home/changbin/work/linux/tools/perf/perf.c:398
  #13 0x5625e51c5069 in main /home/changbin/work/linux/tools/perf/perf.c:520
  #14 0x7f033214d09a in __libc_start_main 
(/lib/x86_64-linux-gnu/libc.so.6+0x2409a)

Signed-off-by: Changbin Du 
Reviewed-by: Jiri Olsa 
Cc: Alexei Starovoitov 
Cc: Daniel Borkmann 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Cc: Steven Rostedt (VMware) 
Fixes: f30a79b012e5 ("perf tools: Add reference counting for cpu_map object")
Link: http://lkml.kernel.org/r/20190316080556.3075-15-changbin...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/tests/openat-syscall-all-cpus.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/perf/tests/openat-syscall-all-cpus.c 
b/tools/perf/tests/openat-syscall-all-cpus.c
index c531e6deb104..493ecb611540 100644
--- a/tools/perf/tests/openat-syscall-all-cpus.c
+++ b/tools/perf/tests/openat-syscall-all-cpus.c
@@ -45,7 +45,7 @@ int test__openat_syscall_event_on_all_cpus(struct test *test 
__maybe_unused, int
if (IS_ERR(evsel)) {
tracing_path__strerror_open_tp(errno, errbuf, sizeof(errbuf), 
"syscalls", "sys_enter_openat");
pr_debug("%s\n", errbuf);
-   goto out_thread_map_delete;
+   goto out_cpu_map_delete;
}
 
if (perf_evsel__open(evsel, cpus, threads) < 0) {
@@ -119,6 +119,8 @@ out_close_fd:
perf_evsel__close_fd(evsel);
 out_evsel_delete:
perf_evsel__delete(evsel);
+out_cpu_map_delete:
+   cpu_map__put(cpus);
 out_thread_map_delete:
thread_map__put(threads);
return err;


[tip:perf/urgent] perf hist: Add missing map__put() in error case

2019-03-22 Thread tip-bot for Changbin Du
Commit-ID:  cb6186aeffda4d27e56066c79e9579e7831541d3
Gitweb: https://git.kernel.org/tip/cb6186aeffda4d27e56066c79e9579e7831541d3
Author: Changbin Du 
AuthorDate: Sat, 16 Mar 2019 16:05:49 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 19 Mar 2019 16:52:04 -0300

perf hist: Add missing map__put() in error case

We need to map__put() before returning from failure of
sample__resolve_callchain().

Detected with gcc's ASan.

Signed-off-by: Changbin Du 
Reviewed-by: Jiri Olsa 
Cc: Alexei Starovoitov 
Cc: Daniel Borkmann 
Cc: Krister Johansen 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Cc: Steven Rostedt (VMware) 
Fixes: 9c68ae98c6f7 ("perf callchain: Reference count maps")
Link: http://lkml.kernel.org/r/20190316080556.3075-10-changbin...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/hist.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 1f230285d78a..7ace7a10054d 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -,8 +,10 @@ int hist_entry_iter__add(struct hist_entry_iter *iter, 
struct addr_location *al,
 
err = sample__resolve_callchain(iter->sample, _cursor, 
>parent,
iter->evsel, al, max_stack_depth);
-   if (err)
+   if (err) {
+   map__put(alm);
return err;
+   }
 
err = iter->ops->prepare_entry(iter, al);
if (err)


[tip:perf/urgent] perf top: Delete the evlist before perf_session, fixing heap-use-after-free issue

2019-03-22 Thread tip-bot for Changbin Du
Commit-ID:  0dba9e4be95b59e77060645ca8e37ca3231061f5
Gitweb: https://git.kernel.org/tip/0dba9e4be95b59e77060645ca8e37ca3231061f5
Author: Changbin Du 
AuthorDate: Sat, 16 Mar 2019 16:05:47 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 19 Mar 2019 16:52:04 -0300

perf top: Delete the evlist before perf_session, fixing heap-use-after-free 
issue

The evlist should be destroyed before the perf session.

Detected with gcc's ASan:

  =
  ==27350==ERROR: AddressSanitizer: heap-use-after-free on address 
0x62b02e38 at pc 0x5611da276999 bp 0x7ffce8f1d1a0 sp 0x7ffce8f1d190
  WRITE of size 8 at 0x62b02e38 thread T0
  #0 0x5611da276998 in __list_del 
/home/work/linux/tools/include/linux/list.h:89
  #1 0x5611da276d4a in __list_del_entry 
/home/work/linux/tools/include/linux/list.h:102
  #2 0x5611da276e77 in list_del_init 
/home/work/linux/tools/include/linux/list.h:145
  #3 0x5611da2781cd in thread__put util/thread.c:130
  #4 0x5611da2cc0a8 in __thread__zput util/thread.h:68
  #5 0x5611da2d2dcb in hist_entry__delete util/hist.c:1148
  #6 0x5611da2cdf91 in hists__delete_entry util/hist.c:337
  #7 0x5611da2ce19e in hists__delete_entries util/hist.c:365
  #8 0x5611da2db2ab in hists__delete_all_entries util/hist.c:2639
  #9 0x5611da2db325 in hists_evsel__exit util/hist.c:2651
  #10 0x5611da1c5352 in perf_evsel__exit util/evsel.c:1304
  #11 0x5611da1c5390 in perf_evsel__delete util/evsel.c:1309
  #12 0x5611da1b35f0 in perf_evlist__purge util/evlist.c:124
  #13 0x5611da1b38e2 in perf_evlist__delete util/evlist.c:148
  #14 0x5611da069781 in cmd_top 
/home/changbin/work/linux/tools/perf/builtin-top.c:1645
  #15 0x5611da17d038 in run_builtin 
/home/changbin/work/linux/tools/perf/perf.c:302
  #16 0x5611da17d577 in handle_internal_command 
/home/changbin/work/linux/tools/perf/perf.c:354
  #17 0x5611da17d97b in run_argv 
/home/changbin/work/linux/tools/perf/perf.c:398
  #18 0x5611da17e0e9 in main /home/changbin/work/linux/tools/perf/perf.c:520
  #19 0x7fdcc970f09a in __libc_start_main 
(/lib/x86_64-linux-gnu/libc.so.6+0x2409a)
  #20 0x5611d9ff35c9 in _start (/home/work/linux/tools/perf/perf+0x3e95c9)

  0x62b02e38 is located 11320 bytes inside of 27448-byte region 
[0x62b00200,0x62b06d38)
  freed by thread T0 here:
  #0 0x7fdccb04ab70 in free (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xedb70)
  #1 0x5611da260df4 in perf_session__delete util/session.c:201
  #2 0x5611da063de5 in __cmd_top 
/home/changbin/work/linux/tools/perf/builtin-top.c:1300
  #3 0x5611da06973c in cmd_top 
/home/changbin/work/linux/tools/perf/builtin-top.c:1642
  #4 0x5611da17d038 in run_builtin 
/home/changbin/work/linux/tools/perf/perf.c:302
  #5 0x5611da17d577 in handle_internal_command 
/home/changbin/work/linux/tools/perf/perf.c:354
  #6 0x5611da17d97b in run_argv 
/home/changbin/work/linux/tools/perf/perf.c:398
  #7 0x5611da17e0e9 in main /home/changbin/work/linux/tools/perf/perf.c:520
  #8 0x7fdcc970f09a in __libc_start_main 
(/lib/x86_64-linux-gnu/libc.so.6+0x2409a)

  previously allocated by thread T0 here:
  #0 0x7fdccb04b138 in calloc 
(/usr/lib/x86_64-linux-gnu/libasan.so.5+0xee138)
  #1 0x5611da26010c in zalloc util/util.h:23
  #2 0x5611da260824 in perf_session__new util/session.c:118
  #3 0x5611da0633a6 in __cmd_top 
/home/changbin/work/linux/tools/perf/builtin-top.c:1192
  #4 0x5611da06973c in cmd_top 
/home/changbin/work/linux/tools/perf/builtin-top.c:1642
  #5 0x5611da17d038 in run_builtin 
/home/changbin/work/linux/tools/perf/perf.c:302
  #6 0x5611da17d577 in handle_internal_command 
/home/changbin/work/linux/tools/perf/perf.c:354
  #7 0x5611da17d97b in run_argv 
/home/changbin/work/linux/tools/perf/perf.c:398
  #8 0x5611da17e0e9 in main /home/changbin/work/linux/tools/perf/perf.c:520
  #9 0x7fdcc970f09a in __libc_start_main 
(/lib/x86_64-linux-gnu/libc.so.6+0x2409a)

  SUMMARY: AddressSanitizer: heap-use-after-free 
/home/work/linux/tools/include/linux/list.h:89 in __list_del
  Shadow bytes around the buggy address:
0x0c567fff8570: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c567fff8580: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c567fff8590: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c567fff85a0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c567fff85b0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  =>0x0c567fff85c0: fd fd fd fd fd fd fd[fd]fd fd fd fd fd fd fd fd
0x0c567fff85d0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c567fff85e0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c567fff85f0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c567fff8600: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c567fff8610: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  Shadow byte legend (one shadow 

[tip:perf/urgent] perf config: Fix a memory leak in collect_config()

2019-03-22 Thread tip-bot for Changbin Du
Commit-ID:  54569ba4b06d5baedae4614bde33a25a191473ba
Gitweb: https://git.kernel.org/tip/54569ba4b06d5baedae4614bde33a25a191473ba
Author: Changbin Du 
AuthorDate: Sat, 16 Mar 2019 16:05:45 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 19 Mar 2019 16:52:04 -0300

perf config: Fix a memory leak in collect_config()

Detected with gcc's ASan:

  Direct leak of 66 byte(s) in 5 object(s) allocated from:
  #0 0x7ff3b1f32070 in __interceptor_strdup 
(/usr/lib/x86_64-linux-gnu/libasan.so.5+0x3b070)
  #1 0x560c8761034d in collect_config util/config.c:597
  #2 0x560c8760d9cb in get_value util/config.c:169
  #3 0x560c8760dfd7 in perf_parse_file util/config.c:285
  #4 0x560c8760e0d2 in perf_config_from_file util/config.c:476
  #5 0x560c876108fd in perf_config_set__init util/config.c:661
  #6 0x560c87610c72 in perf_config_set__new util/config.c:709
  #7 0x560c87610d2f in perf_config__init util/config.c:718
  #8 0x560c87610e5d in perf_config util/config.c:730
  #9 0x560c875ddea0 in main /home/changbin/work/linux/tools/perf/perf.c:442
  #10 0x7ff3afb8609a in __libc_start_main 
(/lib/x86_64-linux-gnu/libc.so.6+0x2409a)

Signed-off-by: Changbin Du 
Reviewed-by: Jiri Olsa 
Cc: Alexei Starovoitov 
Cc: Daniel Borkmann 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Cc: Steven Rostedt (VMware) 
Cc: Taeung Song 
Fixes: 20105ca1240c ("perf config: Introduce perf_config_set class")
Link: http://lkml.kernel.org/r/20190316080556.3075-6-changbin...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/config.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
index fa092511c52b..7e3c1b60120c 100644
--- a/tools/perf/util/config.c
+++ b/tools/perf/util/config.c
@@ -633,11 +633,10 @@ static int collect_config(const char *var, const char 
*value,
}
 
ret = set_value(item, value);
-   return ret;
 
 out_free:
free(key);
-   return -1;
+   return ret;
 }
 
 int perf_config_set__collect(struct perf_config_set *set, const char 
*file_name,


[tip:perf/urgent] perf build-id: Fix memory leak in print_sdt_events()

2019-03-22 Thread tip-bot for Changbin Du
Commit-ID:  8bde8516893da5a5fdf06121f74d11b52ab92df5
Gitweb: https://git.kernel.org/tip/8bde8516893da5a5fdf06121f74d11b52ab92df5
Author: Changbin Du 
AuthorDate: Sat, 16 Mar 2019 16:05:46 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 19 Mar 2019 16:52:04 -0300

perf build-id: Fix memory leak in print_sdt_events()

Detected with gcc's ASan:

  Direct leak of 4356 byte(s) in 120 object(s) allocated from:
  #0 0x7ff1a2b5a070 in __interceptor_strdup 
(/usr/lib/x86_64-linux-gnu/libasan.so.5+0x3b070)
  #1 0x55719aef4814 in build_id_cache__origname util/build-id.c:215
  #2 0x55719af649b6 in print_sdt_events util/parse-events.c:2339
  #3 0x55719af66272 in print_events util/parse-events.c:2542
  #4 0x55719ad1ecaa in cmd_list 
/home/changbin/work/linux/tools/perf/builtin-list.c:58
  #5 0x55719aec745d in run_builtin 
/home/changbin/work/linux/tools/perf/perf.c:302
  #6 0x55719aec7d1a in handle_internal_command 
/home/changbin/work/linux/tools/perf/perf.c:354
  #7 0x55719aec8184 in run_argv 
/home/changbin/work/linux/tools/perf/perf.c:398
  #8 0x55719aeca41a in main /home/changbin/work/linux/tools/perf/perf.c:520
  #9 0x7ff1a07ae09a in __libc_start_main 
(/lib/x86_64-linux-gnu/libc.so.6+0x2409a)

Signed-off-by: Changbin Du 
Reviewed-by: Jiri Olsa 
Cc: Alexei Starovoitov 
Cc: Daniel Borkmann 
Cc: Masami Hiramatsu 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Cc: Steven Rostedt (VMware) 
Fixes: 40218daea1db ("perf list: Show SDT and pre-cached events")
Link: http://lkml.kernel.org/r/20190316080556.3075-7-changbin...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/build-id.c | 1 +
 tools/perf/util/parse-events.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
index bff0d17920ed..0c5517a8d0b7 100644
--- a/tools/perf/util/build-id.c
+++ b/tools/perf/util/build-id.c
@@ -185,6 +185,7 @@ char *build_id_cache__linkname(const char *sbuild_id, char 
*bf, size_t size)
return bf;
 }
 
+/* The caller is responsible to free the returned buffer. */
 char *build_id_cache__origname(const char *sbuild_id)
 {
char *linkname;
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 2e9035c4c252..5ef4939408f2 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -2342,6 +2342,7 @@ void print_sdt_events(const char *subsys_glob, const char 
*event_glob,
printf("  %-50s [%s]\n", buf, "SDT event");
free(buf);
}
+   free(path);
} else
printf("  %-50s [%s]\n", nd->s, "SDT event");
if (nd2) {


[tip:perf/urgent] perf map: Remove map from 'names' tree in __maps__remove()

2019-03-22 Thread tip-bot for Changbin Du
Commit-ID:  b49265e04410b97b31a5ee66ef6782c1b2d6cd2c
Gitweb: https://git.kernel.org/tip/b49265e04410b97b31a5ee66ef6782c1b2d6cd2c
Author: Changbin Du 
AuthorDate: Sat, 16 Mar 2019 16:05:50 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 19 Mar 2019 16:52:05 -0300

perf map: Remove map from 'names' tree in __maps__remove()

There are two trees for each map inserted by maps__insert(), so remove
it from the 'names' tree in __maps__remove().

Detected with gcc's ASan.

Signed-off-by: Changbin Du 
Reviewed-by: Jiri Olsa 
Cc: Alexei Starovoitov 
Cc: Daniel Borkmann 
Cc: Eric Saint-Etienne 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Cc: Steven Rostedt (VMware) 
Fixes: 1e6285699b30 ("perf symbols: Fix slowness due to -ffunction-section")
Link: http://lkml.kernel.org/r/20190316080556.3075-11-changbin...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/map.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index fbeb0c6efaa6..64bea5eb8bf6 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -917,6 +917,9 @@ static void __maps__remove(struct maps *maps, struct map 
*map)
 {
rb_erase_init(>rb_node, >entries);
map__put(map);
+
+   rb_erase_init(>rb_node_name, >names);
+   map__put(map);
 }
 
 void maps__remove(struct maps *maps, struct map *map)


[tip:perf/urgent] perf config: Fix an error in the config template documentation

2019-03-22 Thread tip-bot for Changbin Du
Commit-ID:  9b40dff7ba3caaf0d1919f98e136fa3400bd34aa
Gitweb: https://git.kernel.org/tip/9b40dff7ba3caaf0d1919f98e136fa3400bd34aa
Author: Changbin Du 
AuthorDate: Sat, 16 Mar 2019 16:05:44 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 19 Mar 2019 16:52:04 -0300

perf config: Fix an error in the config template documentation

The option 'sort-order' should be 'sort_order'.

Signed-off-by: Changbin Du 
Reviewed-by: Jiri Olsa 
Cc: Alexei Starovoitov 
Cc: Daniel Borkmann 
Cc: Milian Wolff 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Cc: Steven Rostedt (VMware) 
Fixes: 893c5c798be9 ("perf config: Show default report configuration in example 
and docs")
Link: http://lkml.kernel.org/r/20190316080556.3075-5-changbin...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/Documentation/perf-config.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/Documentation/perf-config.txt 
b/tools/perf/Documentation/perf-config.txt
index 95054a8176a2..462b3cde0675 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -114,7 +114,7 @@ Given a $HOME/.perfconfig like this:
 
[report]
# Defaults
-   sort-order = comm,dso,symbol
+   sort_order = comm,dso,symbol
percent-limit = 0
queue-size = 0
children = true


[tip:perf/urgent] perf tools: Fix errors under optimization level '-Og'

2019-03-22 Thread tip-bot for Changbin Du
Commit-ID:  11c1ea6f1a9bc97bf857fd12f72eacb6c69794e2
Gitweb: https://git.kernel.org/tip/11c1ea6f1a9bc97bf857fd12f72eacb6c69794e2
Author: Changbin Du 
AuthorDate: Sat, 16 Mar 2019 16:05:43 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 19 Mar 2019 16:52:04 -0300

perf tools: Fix errors under optimization level '-Og'

Optimization level '-Og' offers a reasonable level of optimization while
maintaining fast compilation and a good debugging experience. This patch
tries to make it work.

  $ make DEBUG=1 EXTRA_CFLAGS='-Og'
  bench/epoll-ctl.c: In function ‘do_threads’:
  bench/epoll-ctl.c:274:9: error: ‘ret’ may be used uninitialized in this 
function [-Werror=maybe-uninitialized]
return ret;
   ^~~
  ...

Signed-off-by: Changbin Du 
Reviewed-by: Jiri Olsa 
Cc: Alexei Starovoitov 
Cc: Daniel Borkmann 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Cc: Steven Rostedt (VMware) 
Link: http://lkml.kernel.org/r/20190316080556.3075-4-changbin...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/lib/bpf/libbpf.c  | 2 +-
 tools/perf/bench/epoll-ctl.c| 2 +-
 tools/perf/bench/epoll-wait.c   | 2 +-
 tools/perf/tests/backward-ring-buffer.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index f5eb60379c8d..4884557aa17f 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -622,7 +622,7 @@ bpf_object__init_maps(struct bpf_object *obj, int flags)
bool strict = !(flags & MAPS_RELAX_COMPAT);
int i, map_idx, map_def_sz, nr_maps = 0;
Elf_Scn *scn;
-   Elf_Data *data;
+   Elf_Data *data = NULL;
Elf_Data *symbols = obj->efile.symbols;
 
if (obj->efile.maps_shndx < 0)
diff --git a/tools/perf/bench/epoll-ctl.c b/tools/perf/bench/epoll-ctl.c
index 0c0a6e824934..2af067859966 100644
--- a/tools/perf/bench/epoll-ctl.c
+++ b/tools/perf/bench/epoll-ctl.c
@@ -224,7 +224,7 @@ static int do_threads(struct worker *worker, struct cpu_map 
*cpu)
pthread_attr_t thread_attr, *attrp = NULL;
cpu_set_t cpuset;
unsigned int i, j;
-   int ret;
+   int ret = 0;
 
if (!noaffinity)
pthread_attr_init(_attr);
diff --git a/tools/perf/bench/epoll-wait.c b/tools/perf/bench/epoll-wait.c
index 5a11534e96a0..fe85448abd45 100644
--- a/tools/perf/bench/epoll-wait.c
+++ b/tools/perf/bench/epoll-wait.c
@@ -293,7 +293,7 @@ static int do_threads(struct worker *worker, struct cpu_map 
*cpu)
pthread_attr_t thread_attr, *attrp = NULL;
cpu_set_t cpuset;
unsigned int i, j;
-   int ret, events = EPOLLIN;
+   int ret = 0, events = EPOLLIN;
 
if (oneshot)
events |= EPOLLONESHOT;
diff --git a/tools/perf/tests/backward-ring-buffer.c 
b/tools/perf/tests/backward-ring-buffer.c
index 6d598cc071ae..1a9c3becf5ff 100644
--- a/tools/perf/tests/backward-ring-buffer.c
+++ b/tools/perf/tests/backward-ring-buffer.c
@@ -18,7 +18,7 @@ static void testcase(void)
int i;
 
for (i = 0; i < NR_ITERS; i++) {
-   char proc_name[10];
+   char proc_name[15];
 
snprintf(proc_name, sizeof(proc_name), "p:%d\n", i);
prctl(PR_SET_NAME, proc_name);


[tip:perf/urgent] perf top: Fix error handling in cmd_top()

2019-03-22 Thread tip-bot for Changbin Du
Commit-ID:  70c819e4bf1c5f492768b399d898d458ccdad2b6
Gitweb: https://git.kernel.org/tip/70c819e4bf1c5f492768b399d898d458ccdad2b6
Author: Changbin Du 
AuthorDate: Sat, 16 Mar 2019 16:05:48 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 19 Mar 2019 16:52:04 -0300

perf top: Fix error handling in cmd_top()

We should go to the cleanup path, to avoid leaks, detected using gcc's
ASan.

Signed-off-by: Changbin Du 
Reviewed-by: Jiri Olsa 
Cc: Alexei Starovoitov 
Cc: Daniel Borkmann 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Cc: Steven Rostedt (VMware) 
Link: http://lkml.kernel.org/r/20190316080556.3075-9-changbin...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-top.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 614f278235fa..2508a7a552fa 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1617,8 +1617,9 @@ int cmd_top(int argc, const char **argv)
annotation_config__init();
 
symbol_conf.try_vmlinux_path = (symbol_conf.vmlinux_name == NULL);
-   if (symbol__init(NULL) < 0)
-   return -1;
+   status = symbol__init(NULL);
+   if (status < 0)
+   goto out_delete_evlist;
 
sort__setup_elide(stdout);
 


[tip:perf/urgent] perf tools: Add doc about how to build perf with Asan and UBSan

2019-03-22 Thread tip-bot for Changbin Du
Commit-ID:  af7a14a750b8eb3cdb26ec15344616ca170b06f2
Gitweb: https://git.kernel.org/tip/af7a14a750b8eb3cdb26ec15344616ca170b06f2
Author: Changbin Du 
AuthorDate: Sat, 16 Mar 2019 16:05:41 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 19 Mar 2019 16:52:04 -0300

perf tools: Add doc about how to build perf with Asan and UBSan

AddressSanitizer (or ASan) and UndefinedBehaviorSanitizer (or UBSan) are
very useful tools to detect program bugs:

 - AddressSanitizer (or ASan) is a GCC feature that detects memory
   corruption bugs such as buffer overflows and memory leaks.

 - UndefinedBehaviorSanitizer (or UBSan) is a fast undefined behavior
   detector supported by GCC. UBSan detects undefined behaviors of programs
   at runtime.

This patch adds a document about how to use them on perf. Later patches will fix
some of the issues disclosed by them.

Signed-off-by: Changbin Du 
Reviewed-by: Jiri Olsa 
Cc: Alexei Starovoitov 
Cc: Daniel Borkmann 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Cc: Steven Rostedt (VMware) 
Link: http://lkml.kernel.org/r/20190316080556.3075-2-changbin...@gmail.com
[ Make some changes based on comments made by Jiri Olsa ]
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/Documentation/Build.txt | 24 
 1 file changed, 24 insertions(+)

diff --git a/tools/perf/Documentation/Build.txt 
b/tools/perf/Documentation/Build.txt
index f6fc6507ba55..3766886c4bca 100644
--- a/tools/perf/Documentation/Build.txt
+++ b/tools/perf/Documentation/Build.txt
@@ -47,3 +47,27 @@ Those objects are then used in final linking:
 
 NOTE this description is omitting other libraries involved, only
  focusing on build framework outcomes
+
+3) Build with ASan or UBSan
+==
+  $ cd tools/perf
+  $ make DESTDIR=/usr
+  $ make DESTDIR=/usr install
+
+AddressSanitizer (or ASan) is a GCC feature that detects memory corruption bugs
+such as buffer overflows and memory leaks.
+
+  $ cd tools/perf
+  $ make DEBUG=1 EXTRA_CFLAGS='-fno-omit-frame-pointer -fsanitize=address'
+  $ ASAN_OPTIONS=log_path=asan.log ./perf record -a
+
+ASan outputs all detected issues into a log file named 'asan.log.'.
+
+UndefinedBehaviorSanitizer (or UBSan) is a fast undefined behavior detector
+supported by GCC. UBSan detects undefined behaviors of programs at runtime.
+
+  $ cd tools/perf
+  $ make DEBUG=1 EXTRA_CFLAGS='-fno-omit-frame-pointer -fsanitize=undefined'
+  $ UBSAN_OPTIONS=print_stacktrace=1 ./perf record -a
+
+If UBSan detects any problem at runtime, it outputs a “runtime error:” message.


[tip:perf/urgent] perf list: Don't forget to drop the reference to the allocated thread_map

2019-03-22 Thread tip-bot for Changbin Du
Commit-ID:  39df730b09774bd860e39ea208a48d15078236cb
Gitweb: https://git.kernel.org/tip/39df730b09774bd860e39ea208a48d15078236cb
Author: Changbin Du 
AuthorDate: Sat, 16 Mar 2019 16:05:42 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 19 Mar 2019 16:52:04 -0300

perf list: Don't forget to drop the reference to the allocated thread_map

Detected via gcc's ASan:

  Direct leak of 2048 byte(s) in 64 object(s) allocated from:
6 #0 0x7f606512e370 in __interceptor_realloc 
(/usr/lib/x86_64-linux-gnu/libasan.so.5+0xee370)
7 #1 0x556b0f1d7ddd in thread_map__realloc util/thread_map.c:43
8 #2 0x556b0f1d84c7 in thread_map__new_by_tid util/thread_map.c:85
9 #3 0x556b0f0e045e in is_event_supported util/parse-events.c:2250
   10 #4 0x556b0f0e1aa1 in print_hwcache_events util/parse-events.c:2382
   11 #5 0x556b0f0e3231 in print_events util/parse-events.c:2514
   12 #6 0x556b0ee0a66e in cmd_list 
/home/changbin/work/linux/tools/perf/builtin-list.c:58
   13 #7 0x556b0f01e0ae in run_builtin 
/home/changbin/work/linux/tools/perf/perf.c:302
   14 #8 0x556b0f01e859 in handle_internal_command 
/home/changbin/work/linux/tools/perf/perf.c:354
   15 #9 0x556b0f01edc8 in run_argv 
/home/changbin/work/linux/tools/perf/perf.c:398
   16 #10 0x556b0f01f71f in main 
/home/changbin/work/linux/tools/perf/perf.c:520
   17 #11 0x7f6062ccf09a in __libc_start_main 
(/lib/x86_64-linux-gnu/libc.so.6+0x2409a)

Signed-off-by: Changbin Du 
Reviewed-by: Jiri Olsa 
Cc: Alexei Starovoitov 
Cc: Daniel Borkmann 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Cc: Steven Rostedt (VMware) 
Fixes: 89896051f8da ("perf tools: Do not put a variable sized type not at the 
end of a struct")
Link: http://lkml.kernel.org/r/20190316080556.3075-3-changbin...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/parse-events.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 4dcc01b2532c..2e9035c4c252 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -2271,6 +2271,7 @@ static bool is_event_supported(u8 type, unsigned config)
perf_evsel__delete(evsel);
}
 
+   thread_map__put(tmap);
return ret;
 }
 


[tip:perf/core] perf tools: Add documentation for BPF event selection

2019-02-09 Thread tip-bot for Changbin Du
Commit-ID:  55fa8b8c0a37618c94df38d50d6871cb3e755ad2
Gitweb: https://git.kernel.org/tip/55fa8b8c0a37618c94df38d50d6871cb3e755ad2
Author: Changbin Du 
AuthorDate: Fri, 1 Feb 2019 21:46:51 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 6 Feb 2019 10:00:40 -0300

perf tools: Add documentation for BPF event selection

Add documentation for how to pass a BPF program as a perf event.

Signed-off-by: Changbin Du 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Link: http://lkml.kernel.org/r/20190201134651.12373-1-changbin...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/Documentation/perf-config.txt | 31 +++
 tools/perf/Documentation/perf-record.txt | 14 ++
 2 files changed, 45 insertions(+)

diff --git a/tools/perf/Documentation/perf-config.txt 
b/tools/perf/Documentation/perf-config.txt
index 4ac7775fbc11..86f3dcc15f83 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -120,6 +120,10 @@ Given a $HOME/.perfconfig like this:
children = true
group = true
 
+   [llvm]
+   dump-obj = true
+   clang-opt = -g
+
 You can hide source code of annotate feature setting the config to false with
 
% perf config annotate.hide_src_code=true
@@ -553,6 +557,33 @@ trace.*::
trace.show_zeros::
Do not suppress syscall arguments that are equal to zero.
 
+llvm.*::
+   llvm.clang-path::
+   Path to clang. If omit, search it from $PATH.
+
+   llvm.clang-bpf-cmd-template::
+   Cmdline template. Below lines show its default value. 
Environment
+   variable is used to pass options.
+   "$CLANG_EXEC -D__KERNEL__ $CLANG_OPTIONS $KERNEL_INC_OPTIONS \
+   -Wno-unused-value -Wno-pointer-sign -working-directory \
+   $WORKING_DIR  -c $CLANG_SOURCE -target bpf -O2 -o -"
+
+   llvm.clang-opt::
+   Options passed to clang.
+
+   llvm.kbuild-dir::
+   kbuild directory. If not set, use /lib/modules/`uname -r`/build.
+   If set to "" deliberately, skip kernel header auto-detector.
+
+   llvm.kbuild-opts::
+   Options passed to 'make' when detecting kernel header options.
+
+   llvm.dump-obj::
+   Enable perf dump BPF object files compiled by LLVM.
+
+   llvm.opts::
+   Options passed to llc.
+
 SEE ALSO
 
 linkperf:perf[1]
diff --git a/tools/perf/Documentation/perf-record.txt 
b/tools/perf/Documentation/perf-record.txt
index d232b13ea713..02b4aa2621e7 100644
--- a/tools/perf/Documentation/perf-record.txt
+++ b/tools/perf/Documentation/perf-record.txt
@@ -88,6 +88,20 @@ OPTIONS
   If you want to profile write accesses in [0x1000~1008), just set
   'mem:0x1000/8:w'.
 
+- a BPF source file (ending in .c) or a precompiled object file (ending
+  in .o) selects one or more BPF events.
+  The BPF program can attach to various perf events based on the ELF 
section
+  names.
+
+  When processing a '.c' file, perf searches an installed LLVM to 
compile it
+  into an object file first. Optional clang options can be passed via 
the
+  '--clang-opt' command line option, e.g.:
+
+perf record --clang-opt "-DLINUX_VERSION_CODE=0x5" \
+-e tests/bpf-script-example.c
+
+  Note: '--clang-opt' must be placed before '--event/-e'.
+
- a group of events surrounded by a pair of brace 
("{event1,event2,...}").
  Each event is separated by commas and the group should be quoted to
  prevent the shell interpretation.  You also need to use --group on


[tip:perf/urgent] perf trace: Remove redundant ')'

2018-04-03 Thread tip-bot for Changbin Du
Commit-ID:  51125a29a395048fdb3429b8c4ca0ada57097744
Gitweb: https://git.kernel.org/tip/51125a29a395048fdb3429b8c4ca0ada57097744
Author: Changbin Du 
AuthorDate: Tue, 13 Mar 2018 18:40:01 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 3 Apr 2018 16:16:41 -0300

perf trace: Remove redundant ')'

There is a redundant ')' at the tail of each event. So remove it.

$ sudo perf trace --no-syscalls -e 'kmem:*' -a
   899.342 kmem:kfree:(vfs_writev+0xb9) call_site=9c453979 ptr=(nil))
   899.344 kmem:kfree:(___sys_recvmsg+0x188) call_site=9c9b8b88 
ptr=(nil))

Signed-off-by: Changbin Du 
Tested-by: Arnaldo Carvalho de Melo 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Link: 
http://lkml.kernel.org/r/1520937601-24952-1-git-send-email-changbin...@intel.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-trace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 4e03f0f68241..3ad17ee89403 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -1962,7 +1962,7 @@ static int trace__event_handler(struct trace *trace, 
struct perf_evsel *evsel,
  trace->output);
}
 
-   fprintf(trace->output, ")\n");
+   fprintf(trace->output, "\n");
 
if (callchain_ret > 0)
trace__fprintf_callchain(trace, sample);


[tip:perf/urgent] perf trace: Remove redundant ')'

2018-04-03 Thread tip-bot for Changbin Du
Commit-ID:  51125a29a395048fdb3429b8c4ca0ada57097744
Gitweb: https://git.kernel.org/tip/51125a29a395048fdb3429b8c4ca0ada57097744
Author: Changbin Du 
AuthorDate: Tue, 13 Mar 2018 18:40:01 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 3 Apr 2018 16:16:41 -0300

perf trace: Remove redundant ')'

There is a redundant ')' at the tail of each event. So remove it.

$ sudo perf trace --no-syscalls -e 'kmem:*' -a
   899.342 kmem:kfree:(vfs_writev+0xb9) call_site=9c453979 ptr=(nil))
   899.344 kmem:kfree:(___sys_recvmsg+0x188) call_site=9c9b8b88 
ptr=(nil))

Signed-off-by: Changbin Du 
Tested-by: Arnaldo Carvalho de Melo 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Link: 
http://lkml.kernel.org/r/1520937601-24952-1-git-send-email-changbin...@intel.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-trace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 4e03f0f68241..3ad17ee89403 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -1962,7 +1962,7 @@ static int trace__event_handler(struct trace *trace, 
struct perf_evsel *evsel,
  trace->output);
}
 
-   fprintf(trace->output, ")\n");
+   fprintf(trace->output, "\n");
 
if (callchain_ret > 0)
trace__fprintf_callchain(trace, sample);


[tip:perf/core] perf sched map: Re-annotate shortname if thread comm changed

2018-03-09 Thread tip-bot for Changbin Du
Commit-ID:  99a3c3a91382a7e5e841a98467a8409b47b540f0
Gitweb: https://git.kernel.org/tip/99a3c3a91382a7e5e841a98467a8409b47b540f0
Author: Changbin Du 
AuthorDate: Tue, 6 Mar 2018 11:37:37 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 7 Mar 2018 10:22:26 -0300

perf sched map: Re-annotate shortname if thread comm changed

This is to show the real name of thread that created via fork-exec.  See
below example for shortname *A0*.

$ sudo ./perf sched map
  *A0   80393.050639 secs A0 => perf:22368
  *.   A0   80393.050748 secs .  => swapper:0
   .  *.80393.050887 secs
  *B0  .   .80393.052735 secs B0 => rcu_sched:8
  *.   .   .80393.052743 secs
   .  *C0  .80393.056264 secs C0 => kworker/2:1H:287
   .  *A0  .80393.056270 secs
   .  *D0  .80393.056769 secs D0 => ksoftirqd/2:22
-  .  *A0  .80393.056804 secs
+  .  *A0  .80393.056804 secs A0 => pi:22368
   .  *.   .80393.056854 secs
  *B0  .   .80393.060727 secs
  ...

Signed-off-by: Changbin Du 
Acked-by: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Link: 
http://lkml.kernel.org/r/1520307457-23668-3-git-send-email-changbin...@intel.com
[ Optimally pack struct thread_runtime when adding the new bool member ]
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-sched.c | 38 --
 1 file changed, 36 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 0a632a6b6228..4dfdee668b0c 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -256,6 +256,8 @@ struct thread_runtime {
int last_state;
 
char shortname[3];
+   bool comm_changed;
+
u64 migrations;
 };
 
@@ -1626,7 +1628,7 @@ static int map_switch_event(struct perf_sched *sched, 
struct perf_evsel *evsel,
 
timestamp__scnprintf_usec(timestamp, stimestamp, sizeof(stimestamp));
color_fprintf(stdout, color, "  %12s secs ", stimestamp);
-   if (new_shortname || (verbose > 0 && sched_in->tid)) {
+   if (new_shortname || tr->comm_changed || (verbose > 0 && 
sched_in->tid)) {
const char *pid_color = color;
 
if (thread__has_color(sched_in))
@@ -1634,6 +1636,7 @@ static int map_switch_event(struct perf_sched *sched, 
struct perf_evsel *evsel,
 
color_fprintf(stdout, pid_color, "%s => %s:%d",
   tr->shortname, thread__comm_str(sched_in), 
sched_in->tid);
+   tr->comm_changed = false;
}
 
if (sched->map.comp && new_cpu)
@@ -1737,6 +1740,37 @@ static int perf_sched__process_tracepoint_sample(struct 
perf_tool *tool __maybe_
return err;
 }
 
+static int perf_sched__process_comm(struct perf_tool *tool __maybe_unused,
+   union perf_event *event,
+   struct perf_sample *sample,
+   struct machine *machine)
+{
+   struct thread *thread;
+   struct thread_runtime *tr;
+   int err;
+
+   err = perf_event__process_comm(tool, event, sample, machine);
+   if (err)
+   return err;
+
+   thread = machine__find_thread(machine, sample->pid, sample->tid);
+   if (!thread) {
+   pr_err("Internal error: can't find thread\n");
+   return -1;
+   }
+
+   tr = thread__get_runtime(thread);
+   if (tr == NULL) {
+   thread__put(thread);
+   return -1;
+   }
+
+   tr->comm_changed = true;
+   thread__put(thread);
+
+   return 0;
+}
+
 static int perf_sched__read_events(struct perf_sched *sched)
 {
const struct perf_evsel_str_handler handlers[] = {
@@ -3306,7 +3340,7 @@ int cmd_sched(int argc, const char **argv)
struct perf_sched sched = {
.tool = {
.sample  = 
perf_sched__process_tracepoint_sample,
-   .comm= perf_event__process_comm,
+   .comm= perf_sched__process_comm,
.namespaces  = perf_event__process_namespaces,
.lost= perf_event__process_lost,
.fork= perf_sched__process_fork_event,


[tip:perf/core] perf sched map: Re-annotate shortname if thread comm changed

2018-03-09 Thread tip-bot for Changbin Du
Commit-ID:  99a3c3a91382a7e5e841a98467a8409b47b540f0
Gitweb: https://git.kernel.org/tip/99a3c3a91382a7e5e841a98467a8409b47b540f0
Author: Changbin Du 
AuthorDate: Tue, 6 Mar 2018 11:37:37 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 7 Mar 2018 10:22:26 -0300

perf sched map: Re-annotate shortname if thread comm changed

This is to show the real name of thread that created via fork-exec.  See
below example for shortname *A0*.

$ sudo ./perf sched map
  *A0   80393.050639 secs A0 => perf:22368
  *.   A0   80393.050748 secs .  => swapper:0
   .  *.80393.050887 secs
  *B0  .   .80393.052735 secs B0 => rcu_sched:8
  *.   .   .80393.052743 secs
   .  *C0  .80393.056264 secs C0 => kworker/2:1H:287
   .  *A0  .80393.056270 secs
   .  *D0  .80393.056769 secs D0 => ksoftirqd/2:22
-  .  *A0  .80393.056804 secs
+  .  *A0  .80393.056804 secs A0 => pi:22368
   .  *.   .80393.056854 secs
  *B0  .   .80393.060727 secs
  ...

Signed-off-by: Changbin Du 
Acked-by: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Link: 
http://lkml.kernel.org/r/1520307457-23668-3-git-send-email-changbin...@intel.com
[ Optimally pack struct thread_runtime when adding the new bool member ]
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-sched.c | 38 --
 1 file changed, 36 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 0a632a6b6228..4dfdee668b0c 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -256,6 +256,8 @@ struct thread_runtime {
int last_state;
 
char shortname[3];
+   bool comm_changed;
+
u64 migrations;
 };
 
@@ -1626,7 +1628,7 @@ static int map_switch_event(struct perf_sched *sched, 
struct perf_evsel *evsel,
 
timestamp__scnprintf_usec(timestamp, stimestamp, sizeof(stimestamp));
color_fprintf(stdout, color, "  %12s secs ", stimestamp);
-   if (new_shortname || (verbose > 0 && sched_in->tid)) {
+   if (new_shortname || tr->comm_changed || (verbose > 0 && 
sched_in->tid)) {
const char *pid_color = color;
 
if (thread__has_color(sched_in))
@@ -1634,6 +1636,7 @@ static int map_switch_event(struct perf_sched *sched, 
struct perf_evsel *evsel,
 
color_fprintf(stdout, pid_color, "%s => %s:%d",
   tr->shortname, thread__comm_str(sched_in), 
sched_in->tid);
+   tr->comm_changed = false;
}
 
if (sched->map.comp && new_cpu)
@@ -1737,6 +1740,37 @@ static int perf_sched__process_tracepoint_sample(struct 
perf_tool *tool __maybe_
return err;
 }
 
+static int perf_sched__process_comm(struct perf_tool *tool __maybe_unused,
+   union perf_event *event,
+   struct perf_sample *sample,
+   struct machine *machine)
+{
+   struct thread *thread;
+   struct thread_runtime *tr;
+   int err;
+
+   err = perf_event__process_comm(tool, event, sample, machine);
+   if (err)
+   return err;
+
+   thread = machine__find_thread(machine, sample->pid, sample->tid);
+   if (!thread) {
+   pr_err("Internal error: can't find thread\n");
+   return -1;
+   }
+
+   tr = thread__get_runtime(thread);
+   if (tr == NULL) {
+   thread__put(thread);
+   return -1;
+   }
+
+   tr->comm_changed = true;
+   thread__put(thread);
+
+   return 0;
+}
+
 static int perf_sched__read_events(struct perf_sched *sched)
 {
const struct perf_evsel_str_handler handlers[] = {
@@ -3306,7 +3340,7 @@ int cmd_sched(int argc, const char **argv)
struct perf_sched sched = {
.tool = {
.sample  = 
perf_sched__process_tracepoint_sample,
-   .comm= perf_event__process_comm,
+   .comm= perf_sched__process_comm,
.namespaces  = perf_event__process_namespaces,
.lost= perf_event__process_lost,
.fork= perf_sched__process_fork_event,


[tip:perf/core] perf sched: Move thread::shortname to thread_runtime

2018-03-09 Thread tip-bot for Changbin Du
Commit-ID:  8640da9f4fea88c8fbb44ff63fde4000203cb7d1
Gitweb: https://git.kernel.org/tip/8640da9f4fea88c8fbb44ff63fde4000203cb7d1
Author: Changbin Du 
AuthorDate: Tue, 6 Mar 2018 11:37:36 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 7 Mar 2018 10:22:26 -0300

perf sched: Move thread::shortname to thread_runtime

The thread::shortname only used by sched command, so move it to sched
private structure.

Signed-off-by: Changbin Du 
Acked-by: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Link: 
http://lkml.kernel.org/r/1520307457-23668-2-git-send-email-changbin...@intel.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-sched.c | 95 +++---
 tools/perf/util/thread.h   |  1 -
 2 files changed, 55 insertions(+), 41 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 83283fedb00f..0a632a6b6228 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -254,6 +254,8 @@ struct thread_runtime {
u64 total_delay_time;
 
int last_state;
+
+   char shortname[3];
u64 migrations;
 };
 
@@ -897,6 +899,37 @@ struct sort_dimension {
struct list_headlist;
 };
 
+/*
+ * handle runtime stats saved per thread
+ */
+static struct thread_runtime *thread__init_runtime(struct thread *thread)
+{
+   struct thread_runtime *r;
+
+   r = zalloc(sizeof(struct thread_runtime));
+   if (!r)
+   return NULL;
+
+   init_stats(>run_stats);
+   thread__set_priv(thread, r);
+
+   return r;
+}
+
+static struct thread_runtime *thread__get_runtime(struct thread *thread)
+{
+   struct thread_runtime *tr;
+
+   tr = thread__priv(thread);
+   if (tr == NULL) {
+   tr = thread__init_runtime(thread);
+   if (tr == NULL)
+   pr_debug("Failed to malloc memory for runtime data.\n");
+   }
+
+   return tr;
+}
+
 static int
 thread_lat_cmp(struct list_head *list, struct work_atoms *l, struct work_atoms 
*r)
 {
@@ -1480,6 +1513,7 @@ static int map_switch_event(struct perf_sched *sched, 
struct perf_evsel *evsel,
 {
const u32 next_pid = perf_evsel__intval(evsel, sample, "next_pid");
struct thread *sched_in;
+   struct thread_runtime *tr;
int new_shortname;
u64 timestamp0, timestamp = sample->time;
s64 delta;
@@ -1519,22 +1553,28 @@ static int map_switch_event(struct perf_sched *sched, 
struct perf_evsel *evsel,
if (sched_in == NULL)
return -1;
 
+   tr = thread__get_runtime(sched_in);
+   if (tr == NULL) {
+   thread__put(sched_in);
+   return -1;
+   }
+
sched->curr_thread[this_cpu] = thread__get(sched_in);
 
printf("  ");
 
new_shortname = 0;
-   if (!sched_in->shortname[0]) {
+   if (!tr->shortname[0]) {
if (!strcmp(thread__comm_str(sched_in), "swapper")) {
/*
 * Don't allocate a letter-number for swapper:0
 * as a shortname. Instead, we use '.' for it.
 */
-   sched_in->shortname[0] = '.';
-   sched_in->shortname[1] = ' ';
+   tr->shortname[0] = '.';
+   tr->shortname[1] = ' ';
} else {
-   sched_in->shortname[0] = sched->next_shortname1;
-   sched_in->shortname[1] = sched->next_shortname2;
+   tr->shortname[0] = sched->next_shortname1;
+   tr->shortname[1] = sched->next_shortname2;
 
if (sched->next_shortname1 < 'Z') {
sched->next_shortname1++;
@@ -1552,6 +1592,7 @@ static int map_switch_event(struct perf_sched *sched, 
struct perf_evsel *evsel,
for (i = 0; i < cpus_nr; i++) {
int cpu = sched->map.comp ? sched->map.comp_cpus[i] : i;
struct thread *curr_thread = sched->curr_thread[cpu];
+   struct thread_runtime *curr_tr;
const char *pid_color = color;
const char *cpu_color = color;
 
@@ -1569,9 +1610,14 @@ static int map_switch_event(struct perf_sched *sched, 
struct perf_evsel *evsel,
else
color_fprintf(stdout, cpu_color, "*");
 
-   if (sched->curr_thread[cpu])
-   color_fprintf(stdout, pid_color, "%2s ", 
sched->curr_thread[cpu]->shortname);
-   else
+   if (sched->curr_thread[cpu]) {
+   curr_tr = thread__get_runtime(sched->curr_thread[cpu]);
+   if (curr_tr == NULL) {
+   thread__put(sched_in);
+   

[tip:perf/core] perf sched: Move thread::shortname to thread_runtime

2018-03-09 Thread tip-bot for Changbin Du
Commit-ID:  8640da9f4fea88c8fbb44ff63fde4000203cb7d1
Gitweb: https://git.kernel.org/tip/8640da9f4fea88c8fbb44ff63fde4000203cb7d1
Author: Changbin Du 
AuthorDate: Tue, 6 Mar 2018 11:37:36 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 7 Mar 2018 10:22:26 -0300

perf sched: Move thread::shortname to thread_runtime

The thread::shortname only used by sched command, so move it to sched
private structure.

Signed-off-by: Changbin Du 
Acked-by: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Link: 
http://lkml.kernel.org/r/1520307457-23668-2-git-send-email-changbin...@intel.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-sched.c | 95 +++---
 tools/perf/util/thread.h   |  1 -
 2 files changed, 55 insertions(+), 41 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 83283fedb00f..0a632a6b6228 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -254,6 +254,8 @@ struct thread_runtime {
u64 total_delay_time;
 
int last_state;
+
+   char shortname[3];
u64 migrations;
 };
 
@@ -897,6 +899,37 @@ struct sort_dimension {
struct list_headlist;
 };
 
+/*
+ * handle runtime stats saved per thread
+ */
+static struct thread_runtime *thread__init_runtime(struct thread *thread)
+{
+   struct thread_runtime *r;
+
+   r = zalloc(sizeof(struct thread_runtime));
+   if (!r)
+   return NULL;
+
+   init_stats(>run_stats);
+   thread__set_priv(thread, r);
+
+   return r;
+}
+
+static struct thread_runtime *thread__get_runtime(struct thread *thread)
+{
+   struct thread_runtime *tr;
+
+   tr = thread__priv(thread);
+   if (tr == NULL) {
+   tr = thread__init_runtime(thread);
+   if (tr == NULL)
+   pr_debug("Failed to malloc memory for runtime data.\n");
+   }
+
+   return tr;
+}
+
 static int
 thread_lat_cmp(struct list_head *list, struct work_atoms *l, struct work_atoms 
*r)
 {
@@ -1480,6 +1513,7 @@ static int map_switch_event(struct perf_sched *sched, 
struct perf_evsel *evsel,
 {
const u32 next_pid = perf_evsel__intval(evsel, sample, "next_pid");
struct thread *sched_in;
+   struct thread_runtime *tr;
int new_shortname;
u64 timestamp0, timestamp = sample->time;
s64 delta;
@@ -1519,22 +1553,28 @@ static int map_switch_event(struct perf_sched *sched, 
struct perf_evsel *evsel,
if (sched_in == NULL)
return -1;
 
+   tr = thread__get_runtime(sched_in);
+   if (tr == NULL) {
+   thread__put(sched_in);
+   return -1;
+   }
+
sched->curr_thread[this_cpu] = thread__get(sched_in);
 
printf("  ");
 
new_shortname = 0;
-   if (!sched_in->shortname[0]) {
+   if (!tr->shortname[0]) {
if (!strcmp(thread__comm_str(sched_in), "swapper")) {
/*
 * Don't allocate a letter-number for swapper:0
 * as a shortname. Instead, we use '.' for it.
 */
-   sched_in->shortname[0] = '.';
-   sched_in->shortname[1] = ' ';
+   tr->shortname[0] = '.';
+   tr->shortname[1] = ' ';
} else {
-   sched_in->shortname[0] = sched->next_shortname1;
-   sched_in->shortname[1] = sched->next_shortname2;
+   tr->shortname[0] = sched->next_shortname1;
+   tr->shortname[1] = sched->next_shortname2;
 
if (sched->next_shortname1 < 'Z') {
sched->next_shortname1++;
@@ -1552,6 +1592,7 @@ static int map_switch_event(struct perf_sched *sched, 
struct perf_evsel *evsel,
for (i = 0; i < cpus_nr; i++) {
int cpu = sched->map.comp ? sched->map.comp_cpus[i] : i;
struct thread *curr_thread = sched->curr_thread[cpu];
+   struct thread_runtime *curr_tr;
const char *pid_color = color;
const char *cpu_color = color;
 
@@ -1569,9 +1610,14 @@ static int map_switch_event(struct perf_sched *sched, 
struct perf_evsel *evsel,
else
color_fprintf(stdout, cpu_color, "*");
 
-   if (sched->curr_thread[cpu])
-   color_fprintf(stdout, pid_color, "%2s ", 
sched->curr_thread[cpu]->shortname);
-   else
+   if (sched->curr_thread[cpu]) {
+   curr_tr = thread__get_runtime(sched->curr_thread[cpu]);
+   if (curr_tr == NULL) {
+   thread__put(sched_in);
+   return -1;
+   }
+   color_fprintf(stdout, pid_color, "%2s ", 
curr_tr->shortname);
+

[tip:perf/core] perf ftrace: Append an EOL when write tracing files

2018-02-21 Thread tip-bot for Changbin Du
Commit-ID:  63cd02d84be5f7b3bc4f8fbb93cc1f871f84ae1d
Gitweb: https://git.kernel.org/tip/63cd02d84be5f7b3bc4f8fbb93cc1f871f84ae1d
Author: Changbin Du 
AuthorDate: Mon, 19 Feb 2018 10:33:29 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 19 Feb 2018 09:49:12 -0300

perf ftrace: Append an EOL when write tracing files

Before this change, the '--graph-funcs', '--nograph-funcs' and
'--trace-funcs' options didn't work as expected when the  doesn't
exist. Because the kernel side hid possible errors.

  $ sudo ./perf ftrace -a --graph-depth 1 --graph-funcs abcdefg
   0)   0.140 us|  rcu_all_qs();
   3)   0.304 us|  mutex_unlock();
   0)   0.153 us|  find_vma();
   3)   0.088 us|  __fsnotify_parent();
   0)   6.145 us|  handle_mm_fault();
   3)   0.089 us|  fsnotify();
   3)   0.161 us|  __sb_end_write();
   3)   0.710 us|  SyS_close();
   3)   7.848 us|  exit_to_usermode_loop();

On the example above, I specified the function filter 'abcdefg' but all
functions are enabled. The expected result is for all functions to be
filtered, since there is no such function ('abcdefg')

The original fix is to make the kernel support '\0' as end of string:
https://lkml.org/lkml/2018/1/16/116

But above fix cannot be compatible with old kernels. Then Namhyung Kim
suggest adding a space after function name.

This patch will append an '\n' when write tracing file. After this fix,
the perf will report correct error state. Also let it print an error if
reset_tracing_files() fails.

Committer testing:

Now it prints:

  # perf ftrace -a --graph-depth 1 --graph-funcs abcdefg
  failed to set tracing filters
  #

And for an existing function:

  # perf ftrace -a --graph-depth 1 --graph-funcs SyS_open
   3)   |  SyS_open() {
   3) ! 494.899 us  |  }
   0) + 23.910 us   |  SyS_open();
   1) + 17.115 us   |  SyS_open();
   1) + 13.900 us   |  SyS_open();
   --
   3)  qemu-sy-2817  =>  pickup-1290
   --

   3) + 20.021 us   |  SyS_open();
  #

Signed-off-by: Changbin Du 
Tested-by: Arnaldo Carvalho de Melo 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Link: 
http://lkml.kernel.org/r/1519007609-14551-1-git-send-email-changbin...@intel.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-ftrace.c | 18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
index 25a42ac..f42f228 100644
--- a/tools/perf/builtin-ftrace.c
+++ b/tools/perf/builtin-ftrace.c
@@ -72,6 +72,7 @@ static int __write_tracing_file(const char *name, const char 
*val, bool append)
ssize_t size = strlen(val);
int flags = O_WRONLY;
char errbuf[512];
+   char *val_copy;
 
file = get_tracing_file(name);
if (!file) {
@@ -91,12 +92,23 @@ static int __write_tracing_file(const char *name, const 
char *val, bool append)
goto out;
}
 
-   if (write(fd, val, size) == size)
+   /*
+* Copy the original value and append a '\n'. Without this,
+* the kernel can hide possible errors.
+*/
+   val_copy = strdup(val);
+   if (!val_copy)
+   goto out_close;
+   val_copy[size] = '\n';
+
+   if (write(fd, val_copy, size + 1) == size + 1)
ret = 0;
else
pr_debug("write '%s' to tracing/%s failed: %s\n",
 val, name, str_error_r(errno, errbuf, sizeof(errbuf)));
 
+   free(val_copy);
+out_close:
close(fd);
 out:
put_tracing_file(file);
@@ -280,8 +292,10 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int 
argc, const char **argv)
signal(SIGCHLD, sig_handler);
signal(SIGPIPE, sig_handler);
 
-   if (reset_tracing_files(ftrace) < 0)
+   if (reset_tracing_files(ftrace) < 0) {
+   pr_err("failed to reset ftrace\n");
goto out;
+   }
 
/* reset ftrace buffer */
if (write_tracing_file("trace", "0") < 0)


[tip:perf/core] perf ftrace: Append an EOL when write tracing files

2018-02-21 Thread tip-bot for Changbin Du
Commit-ID:  63cd02d84be5f7b3bc4f8fbb93cc1f871f84ae1d
Gitweb: https://git.kernel.org/tip/63cd02d84be5f7b3bc4f8fbb93cc1f871f84ae1d
Author: Changbin Du 
AuthorDate: Mon, 19 Feb 2018 10:33:29 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 19 Feb 2018 09:49:12 -0300

perf ftrace: Append an EOL when write tracing files

Before this change, the '--graph-funcs', '--nograph-funcs' and
'--trace-funcs' options didn't work as expected when the  doesn't
exist. Because the kernel side hid possible errors.

  $ sudo ./perf ftrace -a --graph-depth 1 --graph-funcs abcdefg
   0)   0.140 us|  rcu_all_qs();
   3)   0.304 us|  mutex_unlock();
   0)   0.153 us|  find_vma();
   3)   0.088 us|  __fsnotify_parent();
   0)   6.145 us|  handle_mm_fault();
   3)   0.089 us|  fsnotify();
   3)   0.161 us|  __sb_end_write();
   3)   0.710 us|  SyS_close();
   3)   7.848 us|  exit_to_usermode_loop();

On the example above, I specified the function filter 'abcdefg' but all
functions are enabled. The expected result is for all functions to be
filtered, since there is no such function ('abcdefg')

The original fix is to make the kernel support '\0' as end of string:
https://lkml.org/lkml/2018/1/16/116

But above fix cannot be compatible with old kernels. Then Namhyung Kim
suggest adding a space after function name.

This patch will append an '\n' when write tracing file. After this fix,
the perf will report correct error state. Also let it print an error if
reset_tracing_files() fails.

Committer testing:

Now it prints:

  # perf ftrace -a --graph-depth 1 --graph-funcs abcdefg
  failed to set tracing filters
  #

And for an existing function:

  # perf ftrace -a --graph-depth 1 --graph-funcs SyS_open
   3)   |  SyS_open() {
   3) ! 494.899 us  |  }
   0) + 23.910 us   |  SyS_open();
   1) + 17.115 us   |  SyS_open();
   1) + 13.900 us   |  SyS_open();
   --
   3)  qemu-sy-2817  =>  pickup-1290
   --

   3) + 20.021 us   |  SyS_open();
  #

Signed-off-by: Changbin Du 
Tested-by: Arnaldo Carvalho de Melo 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Link: 
http://lkml.kernel.org/r/1519007609-14551-1-git-send-email-changbin...@intel.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-ftrace.c | 18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
index 25a42ac..f42f228 100644
--- a/tools/perf/builtin-ftrace.c
+++ b/tools/perf/builtin-ftrace.c
@@ -72,6 +72,7 @@ static int __write_tracing_file(const char *name, const char 
*val, bool append)
ssize_t size = strlen(val);
int flags = O_WRONLY;
char errbuf[512];
+   char *val_copy;
 
file = get_tracing_file(name);
if (!file) {
@@ -91,12 +92,23 @@ static int __write_tracing_file(const char *name, const 
char *val, bool append)
goto out;
}
 
-   if (write(fd, val, size) == size)
+   /*
+* Copy the original value and append a '\n'. Without this,
+* the kernel can hide possible errors.
+*/
+   val_copy = strdup(val);
+   if (!val_copy)
+   goto out_close;
+   val_copy[size] = '\n';
+
+   if (write(fd, val_copy, size + 1) == size + 1)
ret = 0;
else
pr_debug("write '%s' to tracing/%s failed: %s\n",
 val, name, str_error_r(errno, errbuf, sizeof(errbuf)));
 
+   free(val_copy);
+out_close:
close(fd);
 out:
put_tracing_file(file);
@@ -280,8 +292,10 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int 
argc, const char **argv)
signal(SIGCHLD, sig_handler);
signal(SIGPIPE, sig_handler);
 
-   if (reset_tracing_files(ftrace) < 0)
+   if (reset_tracing_files(ftrace) < 0) {
+   pr_err("failed to reset ftrace\n");
goto out;
+   }
 
/* reset ftrace buffer */
if (write_tracing_file("trace", "0") < 0)


[tip:x86/urgent] x86/build: Don't verify mtools configuration file for isoimage

2017-12-12 Thread tip-bot for Changbin Du
Commit-ID:  f79ce87fa49da778a1ad54c7d3c6755e13cf8489
Gitweb: https://git.kernel.org/tip/f79ce87fa49da778a1ad54c7d3c6755e13cf8489
Author: Changbin Du 
AuthorDate: Thu, 30 Nov 2017 22:51:20 +0800
Committer:  Ingo Molnar 
CommitDate: Mon, 11 Dec 2017 18:55:38 +0100

x86/build: Don't verify mtools configuration file for isoimage

If mtools.conf is not generated before, 'make isoimage' could complain:

  Kernel: arch/x86/boot/bzImage is ready  (#597)
GENIMAGE arch/x86/boot/image.iso
   *** Missing file: arch/x86/boot/mtools.conf
  arch/x86/boot/Makefile:144: recipe for target 'isoimage' failed

mtools.conf is not used for isoimage generation, so do not check it.

Signed-off-by: Changbin Du 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Fixes: 4366d57af1 ("x86/build: Factor out fdimage/isoimage generation commands 
to standalone script")
Link: 
http://lkml.kernel.org/r/1512053480-8083-1-git-send-email-changbin...@intel.com
Signed-off-by: Ingo Molnar 
---
 arch/x86/boot/genimage.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/boot/genimage.sh b/arch/x86/boot/genimage.sh
index 49f4970..c9e8499 100644
--- a/arch/x86/boot/genimage.sh
+++ b/arch/x86/boot/genimage.sh
@@ -44,9 +44,9 @@ FDINITRD=$6
 
 # Make sure the files actually exist
 verify "$FBZIMAGE"
-verify "$MTOOLSRC"
 
 genbzdisk() {
+   verify "$MTOOLSRC"
mformat a:
syslinux $FIMAGE
echo "$KCMDLINE" | mcopy - a:syslinux.cfg
@@ -57,6 +57,7 @@ genbzdisk() {
 }
 
 genfdimage144() {
+   verify "$MTOOLSRC"
dd if=/dev/zero of=$FIMAGE bs=1024 count=1440 2> /dev/null
mformat v:
syslinux $FIMAGE
@@ -68,6 +69,7 @@ genfdimage144() {
 }
 
 genfdimage288() {
+   verify "$MTOOLSRC"
dd if=/dev/zero of=$FIMAGE bs=1024 count=2880 2> /dev/null
mformat w:
syslinux $FIMAGE


[tip:x86/urgent] x86/build: Don't verify mtools configuration file for isoimage

2017-12-12 Thread tip-bot for Changbin Du
Commit-ID:  f79ce87fa49da778a1ad54c7d3c6755e13cf8489
Gitweb: https://git.kernel.org/tip/f79ce87fa49da778a1ad54c7d3c6755e13cf8489
Author: Changbin Du 
AuthorDate: Thu, 30 Nov 2017 22:51:20 +0800
Committer:  Ingo Molnar 
CommitDate: Mon, 11 Dec 2017 18:55:38 +0100

x86/build: Don't verify mtools configuration file for isoimage

If mtools.conf is not generated before, 'make isoimage' could complain:

  Kernel: arch/x86/boot/bzImage is ready  (#597)
GENIMAGE arch/x86/boot/image.iso
   *** Missing file: arch/x86/boot/mtools.conf
  arch/x86/boot/Makefile:144: recipe for target 'isoimage' failed

mtools.conf is not used for isoimage generation, so do not check it.

Signed-off-by: Changbin Du 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Fixes: 4366d57af1 ("x86/build: Factor out fdimage/isoimage generation commands 
to standalone script")
Link: 
http://lkml.kernel.org/r/1512053480-8083-1-git-send-email-changbin...@intel.com
Signed-off-by: Ingo Molnar 
---
 arch/x86/boot/genimage.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/boot/genimage.sh b/arch/x86/boot/genimage.sh
index 49f4970..c9e8499 100644
--- a/arch/x86/boot/genimage.sh
+++ b/arch/x86/boot/genimage.sh
@@ -44,9 +44,9 @@ FDINITRD=$6
 
 # Make sure the files actually exist
 verify "$FBZIMAGE"
-verify "$MTOOLSRC"
 
 genbzdisk() {
+   verify "$MTOOLSRC"
mformat a:
syslinux $FIMAGE
echo "$KCMDLINE" | mcopy - a:syslinux.cfg
@@ -57,6 +57,7 @@ genbzdisk() {
 }
 
 genfdimage144() {
+   verify "$MTOOLSRC"
dd if=/dev/zero of=$FIMAGE bs=1024 count=1440 2> /dev/null
mformat v:
syslinux $FIMAGE
@@ -68,6 +69,7 @@ genfdimage144() {
 }
 
 genfdimage288() {
+   verify "$MTOOLSRC"
dd if=/dev/zero of=$FIMAGE bs=1024 count=2880 2> /dev/null
mformat w:
syslinux $FIMAGE


[tip:x86/asm] x86/build: Make the boot image generation less verbose

2017-11-09 Thread tip-bot for Changbin Du
Commit-ID:  7980f029d05d8a3b4634aa6952e1ec51bce9431f
Gitweb: https://git.kernel.org/tip/7980f029d05d8a3b4634aa6952e1ec51bce9431f
Author: Changbin Du 
AuthorDate: Thu, 9 Nov 2017 14:09:11 +0800
Committer:  Ingo Molnar 
CommitDate: Thu, 9 Nov 2017 07:34:57 +0100

x86/build: Make the boot image generation less verbose

This change suppresses the 'dd' output and adds the '-quiet' parameter
to mkisofs tool. It also removes the 'Using ...' messages, as none of the
messages matter to the user normally.

"make V=1" can still be used for a more verbose build.

The new build messages are now a streamlined set of:

  $ make isoimage
  ...
  Kernel: arch/x86/boot/bzImage is ready  (#75)
GENIMAGE arch/x86/boot/image.iso
  Kernel: arch/x86/boot/image.iso is ready

Signed-off-by: Changbin Du 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Link: 
http://lkml.kernel.org/r/1510207751-22166-1-git-send-email-changbin...@intel.com
Signed-off-by: Ingo Molnar 
---
 arch/x86/boot/genimage.sh | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/arch/x86/boot/genimage.sh b/arch/x86/boot/genimage.sh
index 628e936..49f4970 100644
--- a/arch/x86/boot/genimage.sh
+++ b/arch/x86/boot/genimage.sh
@@ -19,6 +19,13 @@
 #   $6 - inird image file
 #
 
+# Use "make V=1" to debug this script
+case "${KBUILD_VERBOSE}" in
+*1*)
+set -x
+;;
+esac
+
 verify () {
if [ ! -f "$1" ]; then
echo ""   1>&2
@@ -50,7 +57,7 @@ genbzdisk() {
 }
 
 genfdimage144() {
-   dd if=/dev/zero of=$FIMAGE bs=1024 count=1440
+   dd if=/dev/zero of=$FIMAGE bs=1024 count=1440 2> /dev/null
mformat v:
syslinux $FIMAGE
echo "$KCMDLINE" | mcopy - v:syslinux.cfg
@@ -61,7 +68,7 @@ genfdimage144() {
 }
 
 genfdimage288() {
-   dd if=/dev/zero of=$FIMAGE bs=1024 count=2880
+   dd if=/dev/zero of=$FIMAGE bs=1024 count=2880 2> /dev/null
mformat w:
syslinux $FIMAGE
echo "$KCMDLINE" | mcopy - W:syslinux.cfg
@@ -79,14 +86,12 @@ genisoimage() {
for j in syslinux ISOLINUX ; do
if [ -f /usr/$i/$j/isolinux.bin ] ; then
isolinux=/usr/$i/$j/isolinux.bin
-   echo "Using $isolinux"
cp $isolinux $tmp_dir
fi
done
for j in syslinux syslinux/modules/bios ; do
if [ -f /usr/$i/$j/ldlinux.c32 ]; then
ldlinux=/usr/$i/$j/ldlinux.c32
-   echo "Using $ldlinux"
cp $ldlinux $tmp_dir
fi
done
@@ -103,7 +108,7 @@ genisoimage() {
if [ -f "$FDINITRD" ] ; then
cp "$FDINITRD" $tmp_dir/initrd.img
fi
-   mkisofs -J -r -input-charset=utf-8 -o $FIMAGE -b isolinux.bin \
+   mkisofs -J -r -input-charset=utf-8 -quiet -o $FIMAGE -b isolinux.bin \
-c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table \
$tmp_dir
isohybrid $FIMAGE 2>/dev/null || true


[tip:x86/asm] x86/build: Make the boot image generation less verbose

2017-11-09 Thread tip-bot for Changbin Du
Commit-ID:  7980f029d05d8a3b4634aa6952e1ec51bce9431f
Gitweb: https://git.kernel.org/tip/7980f029d05d8a3b4634aa6952e1ec51bce9431f
Author: Changbin Du 
AuthorDate: Thu, 9 Nov 2017 14:09:11 +0800
Committer:  Ingo Molnar 
CommitDate: Thu, 9 Nov 2017 07:34:57 +0100

x86/build: Make the boot image generation less verbose

This change suppresses the 'dd' output and adds the '-quiet' parameter
to mkisofs tool. It also removes the 'Using ...' messages, as none of the
messages matter to the user normally.

"make V=1" can still be used for a more verbose build.

The new build messages are now a streamlined set of:

  $ make isoimage
  ...
  Kernel: arch/x86/boot/bzImage is ready  (#75)
GENIMAGE arch/x86/boot/image.iso
  Kernel: arch/x86/boot/image.iso is ready

Signed-off-by: Changbin Du 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Link: 
http://lkml.kernel.org/r/1510207751-22166-1-git-send-email-changbin...@intel.com
Signed-off-by: Ingo Molnar 
---
 arch/x86/boot/genimage.sh | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/arch/x86/boot/genimage.sh b/arch/x86/boot/genimage.sh
index 628e936..49f4970 100644
--- a/arch/x86/boot/genimage.sh
+++ b/arch/x86/boot/genimage.sh
@@ -19,6 +19,13 @@
 #   $6 - inird image file
 #
 
+# Use "make V=1" to debug this script
+case "${KBUILD_VERBOSE}" in
+*1*)
+set -x
+;;
+esac
+
 verify () {
if [ ! -f "$1" ]; then
echo ""   1>&2
@@ -50,7 +57,7 @@ genbzdisk() {
 }
 
 genfdimage144() {
-   dd if=/dev/zero of=$FIMAGE bs=1024 count=1440
+   dd if=/dev/zero of=$FIMAGE bs=1024 count=1440 2> /dev/null
mformat v:
syslinux $FIMAGE
echo "$KCMDLINE" | mcopy - v:syslinux.cfg
@@ -61,7 +68,7 @@ genfdimage144() {
 }
 
 genfdimage288() {
-   dd if=/dev/zero of=$FIMAGE bs=1024 count=2880
+   dd if=/dev/zero of=$FIMAGE bs=1024 count=2880 2> /dev/null
mformat w:
syslinux $FIMAGE
echo "$KCMDLINE" | mcopy - W:syslinux.cfg
@@ -79,14 +86,12 @@ genisoimage() {
for j in syslinux ISOLINUX ; do
if [ -f /usr/$i/$j/isolinux.bin ] ; then
isolinux=/usr/$i/$j/isolinux.bin
-   echo "Using $isolinux"
cp $isolinux $tmp_dir
fi
done
for j in syslinux syslinux/modules/bios ; do
if [ -f /usr/$i/$j/ldlinux.c32 ]; then
ldlinux=/usr/$i/$j/ldlinux.c32
-   echo "Using $ldlinux"
cp $ldlinux $tmp_dir
fi
done
@@ -103,7 +108,7 @@ genisoimage() {
if [ -f "$FDINITRD" ] ; then
cp "$FDINITRD" $tmp_dir/initrd.img
fi
-   mkisofs -J -r -input-charset=utf-8 -o $FIMAGE -b isolinux.bin \
+   mkisofs -J -r -input-charset=utf-8 -quiet -o $FIMAGE -b isolinux.bin \
-c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table \
$tmp_dir
isohybrid $FIMAGE 2>/dev/null || true


[tip:x86/asm] x86/build: Factor out fdimage/isoimage generation commands to standalone script

2017-11-07 Thread tip-bot for Changbin Du
Commit-ID:  4366d57af19e89d23ef9154414b2539f1c3d18fa
Gitweb: https://git.kernel.org/tip/4366d57af19e89d23ef9154414b2539f1c3d18fa
Author: Changbin Du 
AuthorDate: Mon, 6 Nov 2017 11:32:56 +0800
Committer:  Ingo Molnar 
CommitDate: Tue, 7 Nov 2017 11:22:20 +0100

x86/build: Factor out fdimage/isoimage generation commands to standalone script

The build messages for fdimage/isoimage generation are pretty unstructured,
just the raw shell command blocks are printed.

Emit shortened messages similar to existing kbuild messages, and move
the Makefile commands into a separate shell script - which is much
easier to handle.

This patch factors out the commands used for fdimage/isoimage generation
from arch/x86/boot/Makefile to a new script arch/x86/boot/genimage.sh.
Then it adds the new kbuild command 'genimage' which invokes the new script.
All fdimages/isoimage files are now generated by a call to 'genimage' with
different parameters.

Now 'make isoimage' becomes:

...
Kernel: arch/x86/boot/bzImage is ready  (#30)
  GENIMAGE arch/x86/boot/image.iso
Size of boot image is 4 sectors -> No emulation
 15.37% done, estimate finish Sun Nov  5 23:36:57 2017
 30.68% done, estimate finish Sun Nov  5 23:36:57 2017
 46.04% done, estimate finish Sun Nov  5 23:36:57 2017
 61.35% done, estimate finish Sun Nov  5 23:36:57 2017
 76.69% done, estimate finish Sun Nov  5 23:36:57 2017
 92.00% done, estimate finish Sun Nov  5 23:36:57 2017
Total translation table size: 2048
Total rockridge attributes bytes: 659
Total directory bytes: 0
Path table size(bytes): 10
Max brk space used 0
32608 extents written (63 MB)
Kernel: arch/x86/boot/image.iso is ready

Before:

Kernel: arch/x86/boot/bzImage is ready  (#63)
rm -rf arch/x86/boot/isoimage
mkdir arch/x86/boot/isoimage
for i in lib lib64 share end ; do \
if [ -f /usr/$i/syslinux/isolinux.bin ] ; then \
cp /usr/$i/syslinux/isolinux.bin arch/x86/boot/isoimage 
; \
if [ -f /usr/$i/syslinux/ldlinux.c32 ]; then \
cp /usr/$i/syslinux/ldlinux.c32 
arch/x86/boot/isoimage ; \
fi ; \
break ; \
fi ; \
if [ $i = end ] ; then exit 1 ; fi ; \
done
...

Suggested-by: Ingo Molnar 
Signed-off-by: Changbin Du 
Cc: Linus Torvalds 
Cc: Masahiro Yamada 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Link: 
http://lkml.kernel.org/r/1509939179-7556-2-git-send-email-changbin...@intel.com
Signed-off-by: Ingo Molnar 
---
 arch/x86/boot/Makefile|  59 +-
 arch/x86/boot/genimage.sh | 105 ++
 2 files changed, 116 insertions(+), 48 deletions(-)

diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
index d88a2fd..9b5adae 100644
--- a/arch/x86/boot/Makefile
+++ b/arch/x86/boot/Makefile
@@ -123,63 +123,26 @@ image_cmdline = default linux $(FDARGS) $(if 
$(FDINITRD),initrd=initrd.img,)
 $(obj)/mtools.conf: $(src)/mtools.conf.in
sed -e 's|@OBJ@|$(obj)|g' < $< > $@
 
+quiet_cmd_genimage = GENIMAGE $3
+cmd_genimage = sh $(srctree)/$(src)/genimage.sh $2 $3 $(obj)/bzImage \
+   $(obj)/mtools.conf '$(image_cmdline)' $(FDINITRD)
+
 # This requires write access to /dev/fd0
 bzdisk: $(obj)/bzImage $(obj)/mtools.conf
-   MTOOLSRC=$(obj)/mtools.conf mformat a:  ; sync
-   syslinux /dev/fd0   ; sync
-   echo '$(image_cmdline)' | \
-   MTOOLSRC=$(src)/mtools.conf mcopy - a:syslinux.cfg
-   if [ -f '$(FDINITRD)' ] ; then \
-   MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' a:initrd.img ; \
-   fi
-   MTOOLSRC=$(obj)/mtools.conf mcopy $(obj)/bzImage a:linux; sync
+   $(call cmd,genimage,bzdisk,/dev/fd0)
 
 # These require being root or having syslinux 2.02 or higher installed
 fdimage fdimage144: $(obj)/bzImage $(obj)/mtools.conf
-   dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=1440
-   MTOOLSRC=$(obj)/mtools.conf mformat v:  ; sync
-   syslinux $(obj)/fdimage ; sync
-   echo '$(image_cmdline)' | \
-   MTOOLSRC=$(obj)/mtools.conf mcopy - v:syslinux.cfg
-   if [ -f '$(FDINITRD)' ] ; then \
-   MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' v:initrd.img ; \
-   fi
-   MTOOLSRC=$(obj)/mtools.conf mcopy $(obj)/bzImage v:linux; sync
+   $(call cmd,genimage,fdimage144,$(obj)/fdimage)
+   @$(kecho) 'Kernel: $(obj)/fdimage is ready'
 
 fdimage288: 

[tip:x86/asm] x86/build: Factor out fdimage/isoimage generation commands to standalone script

2017-11-07 Thread tip-bot for Changbin Du
Commit-ID:  4366d57af19e89d23ef9154414b2539f1c3d18fa
Gitweb: https://git.kernel.org/tip/4366d57af19e89d23ef9154414b2539f1c3d18fa
Author: Changbin Du 
AuthorDate: Mon, 6 Nov 2017 11:32:56 +0800
Committer:  Ingo Molnar 
CommitDate: Tue, 7 Nov 2017 11:22:20 +0100

x86/build: Factor out fdimage/isoimage generation commands to standalone script

The build messages for fdimage/isoimage generation are pretty unstructured,
just the raw shell command blocks are printed.

Emit shortened messages similar to existing kbuild messages, and move
the Makefile commands into a separate shell script - which is much
easier to handle.

This patch factors out the commands used for fdimage/isoimage generation
from arch/x86/boot/Makefile to a new script arch/x86/boot/genimage.sh.
Then it adds the new kbuild command 'genimage' which invokes the new script.
All fdimages/isoimage files are now generated by a call to 'genimage' with
different parameters.

Now 'make isoimage' becomes:

...
Kernel: arch/x86/boot/bzImage is ready  (#30)
  GENIMAGE arch/x86/boot/image.iso
Size of boot image is 4 sectors -> No emulation
 15.37% done, estimate finish Sun Nov  5 23:36:57 2017
 30.68% done, estimate finish Sun Nov  5 23:36:57 2017
 46.04% done, estimate finish Sun Nov  5 23:36:57 2017
 61.35% done, estimate finish Sun Nov  5 23:36:57 2017
 76.69% done, estimate finish Sun Nov  5 23:36:57 2017
 92.00% done, estimate finish Sun Nov  5 23:36:57 2017
Total translation table size: 2048
Total rockridge attributes bytes: 659
Total directory bytes: 0
Path table size(bytes): 10
Max brk space used 0
32608 extents written (63 MB)
Kernel: arch/x86/boot/image.iso is ready

Before:

Kernel: arch/x86/boot/bzImage is ready  (#63)
rm -rf arch/x86/boot/isoimage
mkdir arch/x86/boot/isoimage
for i in lib lib64 share end ; do \
if [ -f /usr/$i/syslinux/isolinux.bin ] ; then \
cp /usr/$i/syslinux/isolinux.bin arch/x86/boot/isoimage 
; \
if [ -f /usr/$i/syslinux/ldlinux.c32 ]; then \
cp /usr/$i/syslinux/ldlinux.c32 
arch/x86/boot/isoimage ; \
fi ; \
break ; \
fi ; \
if [ $i = end ] ; then exit 1 ; fi ; \
done
...

Suggested-by: Ingo Molnar 
Signed-off-by: Changbin Du 
Cc: Linus Torvalds 
Cc: Masahiro Yamada 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Link: 
http://lkml.kernel.org/r/1509939179-7556-2-git-send-email-changbin...@intel.com
Signed-off-by: Ingo Molnar 
---
 arch/x86/boot/Makefile|  59 +-
 arch/x86/boot/genimage.sh | 105 ++
 2 files changed, 116 insertions(+), 48 deletions(-)

diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
index d88a2fd..9b5adae 100644
--- a/arch/x86/boot/Makefile
+++ b/arch/x86/boot/Makefile
@@ -123,63 +123,26 @@ image_cmdline = default linux $(FDARGS) $(if 
$(FDINITRD),initrd=initrd.img,)
 $(obj)/mtools.conf: $(src)/mtools.conf.in
sed -e 's|@OBJ@|$(obj)|g' < $< > $@
 
+quiet_cmd_genimage = GENIMAGE $3
+cmd_genimage = sh $(srctree)/$(src)/genimage.sh $2 $3 $(obj)/bzImage \
+   $(obj)/mtools.conf '$(image_cmdline)' $(FDINITRD)
+
 # This requires write access to /dev/fd0
 bzdisk: $(obj)/bzImage $(obj)/mtools.conf
-   MTOOLSRC=$(obj)/mtools.conf mformat a:  ; sync
-   syslinux /dev/fd0   ; sync
-   echo '$(image_cmdline)' | \
-   MTOOLSRC=$(src)/mtools.conf mcopy - a:syslinux.cfg
-   if [ -f '$(FDINITRD)' ] ; then \
-   MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' a:initrd.img ; \
-   fi
-   MTOOLSRC=$(obj)/mtools.conf mcopy $(obj)/bzImage a:linux; sync
+   $(call cmd,genimage,bzdisk,/dev/fd0)
 
 # These require being root or having syslinux 2.02 or higher installed
 fdimage fdimage144: $(obj)/bzImage $(obj)/mtools.conf
-   dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=1440
-   MTOOLSRC=$(obj)/mtools.conf mformat v:  ; sync
-   syslinux $(obj)/fdimage ; sync
-   echo '$(image_cmdline)' | \
-   MTOOLSRC=$(obj)/mtools.conf mcopy - v:syslinux.cfg
-   if [ -f '$(FDINITRD)' ] ; then \
-   MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' v:initrd.img ; \
-   fi
-   MTOOLSRC=$(obj)/mtools.conf mcopy $(obj)/bzImage v:linux; sync
+   $(call cmd,genimage,fdimage144,$(obj)/fdimage)
+   @$(kecho) 'Kernel: $(obj)/fdimage is ready'
 
 fdimage288: $(obj)/bzImage $(obj)/mtools.conf
-   dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=2880
-   MTOOLSRC=$(obj)/mtools.conf mformat w:  ; sync
-   syslinux $(obj)/fdimage   

[tip:x86/asm] x86/build: Add more generated files to the .gitignore file

2017-11-07 Thread tip-bot for Changbin Du
Commit-ID:  d786f05175fae09cc39dfa5769c62649341caeb4
Gitweb: https://git.kernel.org/tip/d786f05175fae09cc39dfa5769c62649341caeb4
Author: Changbin Du 
AuthorDate: Mon, 6 Nov 2017 11:32:59 +0800
Committer:  Ingo Molnar 
CommitDate: Tue, 7 Nov 2017 11:22:21 +0100

x86/build: Add more generated files to the .gitignore file

Some of the files generated by the build process were not listed.

Signed-off-by: Changbin Du 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Cc: yamada.masah...@socionext.com
Link: 
http://lkml.kernel.org/r/1509939179-7556-5-git-send-email-changbin...@intel.com
Signed-off-by: Ingo Molnar 
---
 arch/x86/boot/.gitignore | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/x86/boot/.gitignore b/arch/x86/boot/.gitignore
index e3cf9f6..09d25dd 100644
--- a/arch/x86/boot/.gitignore
+++ b/arch/x86/boot/.gitignore
@@ -7,3 +7,6 @@ zoffset.h
 setup
 setup.bin
 setup.elf
+fdimage
+mtools.conf
+image.iso


[tip:x86/asm] x86/build: Add more generated files to the .gitignore file

2017-11-07 Thread tip-bot for Changbin Du
Commit-ID:  d786f05175fae09cc39dfa5769c62649341caeb4
Gitweb: https://git.kernel.org/tip/d786f05175fae09cc39dfa5769c62649341caeb4
Author: Changbin Du 
AuthorDate: Mon, 6 Nov 2017 11:32:59 +0800
Committer:  Ingo Molnar 
CommitDate: Tue, 7 Nov 2017 11:22:21 +0100

x86/build: Add more generated files to the .gitignore file

Some of the files generated by the build process were not listed.

Signed-off-by: Changbin Du 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Cc: yamada.masah...@socionext.com
Link: 
http://lkml.kernel.org/r/1509939179-7556-5-git-send-email-changbin...@intel.com
Signed-off-by: Ingo Molnar 
---
 arch/x86/boot/.gitignore | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/x86/boot/.gitignore b/arch/x86/boot/.gitignore
index e3cf9f6..09d25dd 100644
--- a/arch/x86/boot/.gitignore
+++ b/arch/x86/boot/.gitignore
@@ -7,3 +7,6 @@ zoffset.h
 setup
 setup.bin
 setup.elf
+fdimage
+mtools.conf
+image.iso


[tip:x86/asm] x86/build: Specify -input-charset=utf-8 for mkisofs

2017-11-07 Thread tip-bot for Changbin Du
Commit-ID:  c306ba7b909408dbf935bb4a8dc62fae64cb337c
Gitweb: https://git.kernel.org/tip/c306ba7b909408dbf935bb4a8dc62fae64cb337c
Author: Changbin Du 
AuthorDate: Mon, 6 Nov 2017 11:32:58 +0800
Committer:  Ingo Molnar 
CommitDate: Tue, 7 Nov 2017 11:22:20 +0100

x86/build: Specify -input-charset=utf-8 for mkisofs

It avoids the following warning triggered by newer versions of mkisofs:

-input-charset not specified, using utf-8 (detected in locale settings)

Signed-off-by: Changbin Du 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Cc: yamada.masah...@socionext.com
Link: 
http://lkml.kernel.org/r/1509939179-7556-4-git-send-email-changbin...@intel.com
Signed-off-by: Ingo Molnar 
---
 arch/x86/boot/genimage.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/boot/genimage.sh b/arch/x86/boot/genimage.sh
index 6c8100b..628e936 100644
--- a/arch/x86/boot/genimage.sh
+++ b/arch/x86/boot/genimage.sh
@@ -103,8 +103,9 @@ genisoimage() {
if [ -f "$FDINITRD" ] ; then
cp "$FDINITRD" $tmp_dir/initrd.img
fi
-   mkisofs -J -r -o $FIMAGE -b isolinux.bin -c boot.cat \
-   -no-emul-boot -boot-load-size 4 -boot-info-table $tmp_dir
+   mkisofs -J -r -input-charset=utf-8 -o $FIMAGE -b isolinux.bin \
+   -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table \
+   $tmp_dir
isohybrid $FIMAGE 2>/dev/null || true
rm -rf $tmp_dir
 }


[tip:x86/asm] x86/build: Specify -input-charset=utf-8 for mkisofs

2017-11-07 Thread tip-bot for Changbin Du
Commit-ID:  c306ba7b909408dbf935bb4a8dc62fae64cb337c
Gitweb: https://git.kernel.org/tip/c306ba7b909408dbf935bb4a8dc62fae64cb337c
Author: Changbin Du 
AuthorDate: Mon, 6 Nov 2017 11:32:58 +0800
Committer:  Ingo Molnar 
CommitDate: Tue, 7 Nov 2017 11:22:20 +0100

x86/build: Specify -input-charset=utf-8 for mkisofs

It avoids the following warning triggered by newer versions of mkisofs:

-input-charset not specified, using utf-8 (detected in locale settings)

Signed-off-by: Changbin Du 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Cc: yamada.masah...@socionext.com
Link: 
http://lkml.kernel.org/r/1509939179-7556-4-git-send-email-changbin...@intel.com
Signed-off-by: Ingo Molnar 
---
 arch/x86/boot/genimage.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/boot/genimage.sh b/arch/x86/boot/genimage.sh
index 6c8100b..628e936 100644
--- a/arch/x86/boot/genimage.sh
+++ b/arch/x86/boot/genimage.sh
@@ -103,8 +103,9 @@ genisoimage() {
if [ -f "$FDINITRD" ] ; then
cp "$FDINITRD" $tmp_dir/initrd.img
fi
-   mkisofs -J -r -o $FIMAGE -b isolinux.bin -c boot.cat \
-   -no-emul-boot -boot-load-size 4 -boot-info-table $tmp_dir
+   mkisofs -J -r -input-charset=utf-8 -o $FIMAGE -b isolinux.bin \
+   -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table \
+   $tmp_dir
isohybrid $FIMAGE 2>/dev/null || true
rm -rf $tmp_dir
 }


[tip:x86/asm] x86/build: Add new paths for isolinux.bin and ldlinux.c32

2017-11-07 Thread tip-bot for Changbin Du
Commit-ID:  8a7546a04ecb7c9388a3e935c6cfcc7c2c4c6b67
Gitweb: https://git.kernel.org/tip/8a7546a04ecb7c9388a3e935c6cfcc7c2c4c6b67
Author: Changbin Du 
AuthorDate: Mon, 6 Nov 2017 11:32:57 +0800
Committer:  Ingo Molnar 
CommitDate: Tue, 7 Nov 2017 11:22:20 +0100

x86/build: Add new paths for isolinux.bin and ldlinux.c32

Recently I failed to build isoimage target, because the path of isolinux.bin
changed to /usr/xxx/ISOLINUX/isolinux.bin, as well as ldlinux.c32 which
changed to /usr/xxx/syslinux/modules/bios/ldlinux.c32.

This patch improves the file search logic:
  - Show a error message instead of silent fail.
  - Add above new paths.

Signed-off-by: Changbin Du 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Cc: yamada.masah...@socionext.com
Link: 
http://lkml.kernel.org/r/1509939179-7556-3-git-send-email-changbin...@intel.com
Signed-off-by: Ingo Molnar 
---
 arch/x86/boot/genimage.sh | 23 ++-
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/arch/x86/boot/genimage.sh b/arch/x86/boot/genimage.sh
index 75a9de1..6c8100b 100644
--- a/arch/x86/boot/genimage.sh
+++ b/arch/x86/boot/genimage.sh
@@ -76,14 +76,27 @@ genisoimage() {
rm -rf $tmp_dir
mkdir $tmp_dir
for i in lib lib64 share end ; do
-   if [ -f /usr/$i/syslinux/isolinux.bin ] ; then
-   cp /usr/$i/syslinux/isolinux.bin $tmp_dir
-   if [ -f /usr/$i/syslinux/ldlinux.c32 ]; then
-   cp /usr/$i/syslinux/ldlinux.c32 $tmp_dir
+   for j in syslinux ISOLINUX ; do
+   if [ -f /usr/$i/$j/isolinux.bin ] ; then
+   isolinux=/usr/$i/$j/isolinux.bin
+   echo "Using $isolinux"
+   cp $isolinux $tmp_dir
fi
+   done
+   for j in syslinux syslinux/modules/bios ; do
+   if [ -f /usr/$i/$j/ldlinux.c32 ]; then
+   ldlinux=/usr/$i/$j/ldlinux.c32
+   echo "Using $ldlinux"
+   cp $ldlinux $tmp_dir
+   fi
+   done
+   if [ -n "$isolinux" -a -n "$ldlinux" ] ; then
break
fi
-   if [ $i = end ] ; then exit 1 ; fi ;
+   if [ $i = end -a -z "$isolinux" ] ; then
+   echo 'Need an isolinux.bin file, please install 
syslinux/isolinux.'
+   exit 1
+   fi
done
cp $FBZIMAGE $tmp_dir/linux
echo "$KCMDLINE" > $tmp_dir/isolinux.cfg


[tip:x86/asm] x86/build: Add new paths for isolinux.bin and ldlinux.c32

2017-11-07 Thread tip-bot for Changbin Du
Commit-ID:  8a7546a04ecb7c9388a3e935c6cfcc7c2c4c6b67
Gitweb: https://git.kernel.org/tip/8a7546a04ecb7c9388a3e935c6cfcc7c2c4c6b67
Author: Changbin Du 
AuthorDate: Mon, 6 Nov 2017 11:32:57 +0800
Committer:  Ingo Molnar 
CommitDate: Tue, 7 Nov 2017 11:22:20 +0100

x86/build: Add new paths for isolinux.bin and ldlinux.c32

Recently I failed to build isoimage target, because the path of isolinux.bin
changed to /usr/xxx/ISOLINUX/isolinux.bin, as well as ldlinux.c32 which
changed to /usr/xxx/syslinux/modules/bios/ldlinux.c32.

This patch improves the file search logic:
  - Show a error message instead of silent fail.
  - Add above new paths.

Signed-off-by: Changbin Du 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Cc: yamada.masah...@socionext.com
Link: 
http://lkml.kernel.org/r/1509939179-7556-3-git-send-email-changbin...@intel.com
Signed-off-by: Ingo Molnar 
---
 arch/x86/boot/genimage.sh | 23 ++-
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/arch/x86/boot/genimage.sh b/arch/x86/boot/genimage.sh
index 75a9de1..6c8100b 100644
--- a/arch/x86/boot/genimage.sh
+++ b/arch/x86/boot/genimage.sh
@@ -76,14 +76,27 @@ genisoimage() {
rm -rf $tmp_dir
mkdir $tmp_dir
for i in lib lib64 share end ; do
-   if [ -f /usr/$i/syslinux/isolinux.bin ] ; then
-   cp /usr/$i/syslinux/isolinux.bin $tmp_dir
-   if [ -f /usr/$i/syslinux/ldlinux.c32 ]; then
-   cp /usr/$i/syslinux/ldlinux.c32 $tmp_dir
+   for j in syslinux ISOLINUX ; do
+   if [ -f /usr/$i/$j/isolinux.bin ] ; then
+   isolinux=/usr/$i/$j/isolinux.bin
+   echo "Using $isolinux"
+   cp $isolinux $tmp_dir
fi
+   done
+   for j in syslinux syslinux/modules/bios ; do
+   if [ -f /usr/$i/$j/ldlinux.c32 ]; then
+   ldlinux=/usr/$i/$j/ldlinux.c32
+   echo "Using $ldlinux"
+   cp $ldlinux $tmp_dir
+   fi
+   done
+   if [ -n "$isolinux" -a -n "$ldlinux" ] ; then
break
fi
-   if [ $i = end ] ; then exit 1 ; fi ;
+   if [ $i = end -a -z "$isolinux" ] ; then
+   echo 'Need an isolinux.bin file, please install 
syslinux/isolinux.'
+   exit 1
+   fi
done
cp $FBZIMAGE $tmp_dir/linux
echo "$KCMDLINE" > $tmp_dir/isolinux.cfg


[tip:perf/core] perf lock: Subcommands should include common options

2017-03-21 Thread tip-bot for Changbin Du
Commit-ID:  249eed53152167c64c6dc66fa269a1d8b415a7b4
Gitweb: http://git.kernel.org/tip/249eed53152167c64c6dc66fa269a1d8b415a7b4
Author: Changbin Du 
AuthorDate: Fri, 17 Mar 2017 13:53:42 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Fri, 17 Mar 2017 11:49:07 -0300

perf lock: Subcommands should include common options

When I use -i option for report subcommand, it doesn't accept it.  We
need add common options using OPT_PARENT macro.

perf lock report -i lock_perf.data
  Error: unknown switch `i'

  Usage: perf lock report []

-f, --force   don't complain, do it
-k, --key   key for sorting ...

Signed-off-by: Changbin Du 
Cc: Peter Zijlstra 
Link: http://lkml.kernel.org/r/20170317055342.8284-1-changbin...@intel.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-lock.c | 19 +++
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index d750cca..4ce815b 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -948,27 +948,30 @@ static int __cmd_record(int argc, const char **argv)
 
 int cmd_lock(int argc, const char **argv, const char *prefix __maybe_unused)
 {
+   const struct option lock_options[] = {
+   OPT_STRING('i', "input", _name, "file", "input file name"),
+   OPT_INCR('v', "verbose", , "be more verbose (show symbol 
address, etc)"),
+   OPT_BOOLEAN('D', "dump-raw-trace", _trace, "dump raw trace in 
ASCII"),
+   OPT_END()
+   };
+
const struct option info_options[] = {
OPT_BOOLEAN('t', "threads", _threads,
"dump thread list in perf.data"),
OPT_BOOLEAN('m', "map", _map,
"map of lock instances (address:name table)"),
OPT_BOOLEAN('f', "force", , "don't complain, do it"),
-   OPT_END()
-   };
-   const struct option lock_options[] = {
-   OPT_STRING('i', "input", _name, "file", "input file name"),
-   OPT_INCR('v', "verbose", , "be more verbose (show symbol 
address, etc)"),
-   OPT_BOOLEAN('D', "dump-raw-trace", _trace, "dump raw trace in 
ASCII"),
-   OPT_END()
+   OPT_PARENT(lock_options)
};
+
const struct option report_options[] = {
OPT_STRING('k', "key", _key, "acquired",
"key for sorting (acquired / contended / avg_wait / 
wait_total / wait_max / wait_min)"),
OPT_BOOLEAN('f', "force", , "don't complain, do it"),
/* TODO: type */
-   OPT_END()
+   OPT_PARENT(lock_options)
};
+
const char * const info_usage[] = {
"perf lock info []",
NULL


[tip:perf/core] perf lock: Subcommands should include common options

2017-03-21 Thread tip-bot for Changbin Du
Commit-ID:  249eed53152167c64c6dc66fa269a1d8b415a7b4
Gitweb: http://git.kernel.org/tip/249eed53152167c64c6dc66fa269a1d8b415a7b4
Author: Changbin Du 
AuthorDate: Fri, 17 Mar 2017 13:53:42 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Fri, 17 Mar 2017 11:49:07 -0300

perf lock: Subcommands should include common options

When I use -i option for report subcommand, it doesn't accept it.  We
need add common options using OPT_PARENT macro.

perf lock report -i lock_perf.data
  Error: unknown switch `i'

  Usage: perf lock report []

-f, --force   don't complain, do it
-k, --key   key for sorting ...

Signed-off-by: Changbin Du 
Cc: Peter Zijlstra 
Link: http://lkml.kernel.org/r/20170317055342.8284-1-changbin...@intel.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-lock.c | 19 +++
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index d750cca..4ce815b 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -948,27 +948,30 @@ static int __cmd_record(int argc, const char **argv)
 
 int cmd_lock(int argc, const char **argv, const char *prefix __maybe_unused)
 {
+   const struct option lock_options[] = {
+   OPT_STRING('i', "input", _name, "file", "input file name"),
+   OPT_INCR('v', "verbose", , "be more verbose (show symbol 
address, etc)"),
+   OPT_BOOLEAN('D', "dump-raw-trace", _trace, "dump raw trace in 
ASCII"),
+   OPT_END()
+   };
+
const struct option info_options[] = {
OPT_BOOLEAN('t', "threads", _threads,
"dump thread list in perf.data"),
OPT_BOOLEAN('m', "map", _map,
"map of lock instances (address:name table)"),
OPT_BOOLEAN('f', "force", , "don't complain, do it"),
-   OPT_END()
-   };
-   const struct option lock_options[] = {
-   OPT_STRING('i', "input", _name, "file", "input file name"),
-   OPT_INCR('v', "verbose", , "be more verbose (show symbol 
address, etc)"),
-   OPT_BOOLEAN('D', "dump-raw-trace", _trace, "dump raw trace in 
ASCII"),
-   OPT_END()
+   OPT_PARENT(lock_options)
};
+
const struct option report_options[] = {
OPT_STRING('k', "key", _key, "acquired",
"key for sorting (acquired / contended / avg_wait / 
wait_total / wait_max / wait_min)"),
OPT_BOOLEAN('f', "force", , "don't complain, do it"),
/* TODO: type */
-   OPT_END()
+   OPT_PARENT(lock_options)
};
+
const char * const info_usage[] = {
"perf lock info []",
NULL


[tip:perf/core] perf hists browser: Fix typo in function switch_data_file

2017-03-15 Thread tip-bot for Changbin Du
Commit-ID:  3ef5b4023c64c16c793a066a7a2ed6ea3767e0d7
Gitweb: http://git.kernel.org/tip/3ef5b4023c64c16c793a066a7a2ed6ea3767e0d7
Author: Changbin Du 
AuthorDate: Mon, 13 Mar 2017 19:46:52 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 13 Mar 2017 11:58:57 -0300

perf hists browser: Fix typo in function switch_data_file

Should clear buf 'abs_path', not 'options'.

Signed-off-by: Changbin Du 
Cc: Feng Tang 
Cc: Peter Zijlstra 
Fixes: 341487ab561f ("perf hists browser: Add option for runtime switching perf 
data file")
Link: http://lkml.kernel.org/r/20170313114652.9207-1-changbin...@intel.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/ui/browsers/hists.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index fc4fb66..2dc82be 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -2308,7 +2308,7 @@ static int switch_data_file(void)
return ret;
 
memset(options, 0, sizeof(options));
-   memset(options, 0, sizeof(abs_path));
+   memset(abs_path, 0, sizeof(abs_path));
 
while ((dent = readdir(pwd_dir))) {
char path[PATH_MAX];


[tip:perf/core] perf hists browser: Fix typo in function switch_data_file

2017-03-15 Thread tip-bot for Changbin Du
Commit-ID:  3ef5b4023c64c16c793a066a7a2ed6ea3767e0d7
Gitweb: http://git.kernel.org/tip/3ef5b4023c64c16c793a066a7a2ed6ea3767e0d7
Author: Changbin Du 
AuthorDate: Mon, 13 Mar 2017 19:46:52 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 13 Mar 2017 11:58:57 -0300

perf hists browser: Fix typo in function switch_data_file

Should clear buf 'abs_path', not 'options'.

Signed-off-by: Changbin Du 
Cc: Feng Tang 
Cc: Peter Zijlstra 
Fixes: 341487ab561f ("perf hists browser: Add option for runtime switching perf 
data file")
Link: http://lkml.kernel.org/r/20170313114652.9207-1-changbin...@intel.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/ui/browsers/hists.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index fc4fb66..2dc82be 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -2308,7 +2308,7 @@ static int switch_data_file(void)
return ret;
 
memset(options, 0, sizeof(options));
-   memset(options, 0, sizeof(abs_path));
+   memset(abs_path, 0, sizeof(abs_path));
 
while ((dent = readdir(pwd_dir))) {
char path[PATH_MAX];


[tip:perf/core] perf report: Document +field style argument support for --field option

2017-03-15 Thread tip-bot for Changbin Du
Commit-ID:  d35fa1e75fdb308ae8a1a3efffe7ddedbd6051e2
Gitweb: http://git.kernel.org/tip/d35fa1e75fdb308ae8a1a3efffe7ddedbd6051e2
Author: Changbin Du 
AuthorDate: Mon, 13 Mar 2017 16:32:52 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 13 Mar 2017 11:44:44 -0300

perf report: Document +field style argument support for --field option

Commit 2f3f9bcf000b ("perf tools: Add +field argument support for
--field option") by Jiri Olsa  introduced +field style
argument support for --field option.

This is useful but not updated documentation.  This add a little
description there.

Signed-off-by: Changbin Du 
Cc: Peter Zijlstra 
Link: http://lkml.kernel.org/r/20170313083252.23644-1-changbin...@intel.com
[ Slightly improved the phrase structure ]
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/Documentation/perf-report.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/perf/Documentation/perf-report.txt 
b/tools/perf/Documentation/perf-report.txt
index 33f9190..672b149a 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -173,6 +173,9 @@ OPTIONS
By default, every sort keys not specified in -F will be appended
automatically.
 
+   If the keys starts with a prefix '+', then it will append the specified
+field(s) to the default field order. For example: perf report -F 
+period,sample.
+
 -p::
 --parent=::
 A regex filter to identify parent. The parent is a caller of this


[tip:perf/core] perf report: Document +field style argument support for --field option

2017-03-15 Thread tip-bot for Changbin Du
Commit-ID:  d35fa1e75fdb308ae8a1a3efffe7ddedbd6051e2
Gitweb: http://git.kernel.org/tip/d35fa1e75fdb308ae8a1a3efffe7ddedbd6051e2
Author: Changbin Du 
AuthorDate: Mon, 13 Mar 2017 16:32:52 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 13 Mar 2017 11:44:44 -0300

perf report: Document +field style argument support for --field option

Commit 2f3f9bcf000b ("perf tools: Add +field argument support for
--field option") by Jiri Olsa  introduced +field style
argument support for --field option.

This is useful but not updated documentation.  This add a little
description there.

Signed-off-by: Changbin Du 
Cc: Peter Zijlstra 
Link: http://lkml.kernel.org/r/20170313083252.23644-1-changbin...@intel.com
[ Slightly improved the phrase structure ]
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/Documentation/perf-report.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/perf/Documentation/perf-report.txt 
b/tools/perf/Documentation/perf-report.txt
index 33f9190..672b149a 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -173,6 +173,9 @@ OPTIONS
By default, every sort keys not specified in -F will be appended
automatically.
 
+   If the keys starts with a prefix '+', then it will append the specified
+field(s) to the default field order. For example: perf report -F 
+period,sample.
+
 -p::
 --parent=::
 A regex filter to identify parent. The parent is a caller of this


[tip:perf/core] perf sort: Fix segfault with basic block 'cycles' sort dimension

2017-03-15 Thread tip-bot for Changbin Du
Commit-ID:  4b0b3aa6a2756e6115fdf275c521e4552a7082f3
Gitweb: http://git.kernel.org/tip/4b0b3aa6a2756e6115fdf275c521e4552a7082f3
Author: Changbin Du 
AuthorDate: Mon, 13 Mar 2017 16:31:48 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 13 Mar 2017 11:41:20 -0300

perf sort: Fix segfault with basic block 'cycles' sort dimension

Skip the sample which doesn't have branch_info to avoid segmentation
fault:

The fault can be reproduced by:

  perf record -a
  perf report -F cycles

Signed-off-by: Changbin Du 
Tested-by: Arnaldo Carvalho de Melo 
Cc: Andi Kleen 
Cc: Peter Zijlstra 
Fixes: 0e332f033a82 ("perf tools: Add support for cycles, weight branch_info 
field")
Link: http://lkml.kernel.org/r/20170313083148.23568-1-changbin...@intel.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/sort.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index f8f16c0..93f755a 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -846,6 +846,9 @@ static int hist_entry__mispredict_snprintf(struct 
hist_entry *he, char *bf,
 static int64_t
 sort__cycles_cmp(struct hist_entry *left, struct hist_entry *right)
 {
+   if (!left->branch_info || !right->branch_info)
+   return cmp_null(left->branch_info, right->branch_info);
+
return left->branch_info->flags.cycles -
right->branch_info->flags.cycles;
 }
@@ -853,6 +856,8 @@ sort__cycles_cmp(struct hist_entry *left, struct hist_entry 
*right)
 static int hist_entry__cycles_snprintf(struct hist_entry *he, char *bf,
size_t size, unsigned int width)
 {
+   if (!he->branch_info)
+   return scnprintf(bf, size, "%-.*s", width, "N/A");
if (he->branch_info->flags.cycles == 0)
return repsep_snprintf(bf, size, "%-*s", width, "-");
return repsep_snprintf(bf, size, "%-*hd", width,


[tip:perf/core] perf sort: Fix segfault with basic block 'cycles' sort dimension

2017-03-15 Thread tip-bot for Changbin Du
Commit-ID:  4b0b3aa6a2756e6115fdf275c521e4552a7082f3
Gitweb: http://git.kernel.org/tip/4b0b3aa6a2756e6115fdf275c521e4552a7082f3
Author: Changbin Du 
AuthorDate: Mon, 13 Mar 2017 16:31:48 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 13 Mar 2017 11:41:20 -0300

perf sort: Fix segfault with basic block 'cycles' sort dimension

Skip the sample which doesn't have branch_info to avoid segmentation
fault:

The fault can be reproduced by:

  perf record -a
  perf report -F cycles

Signed-off-by: Changbin Du 
Tested-by: Arnaldo Carvalho de Melo 
Cc: Andi Kleen 
Cc: Peter Zijlstra 
Fixes: 0e332f033a82 ("perf tools: Add support for cycles, weight branch_info 
field")
Link: http://lkml.kernel.org/r/20170313083148.23568-1-changbin...@intel.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/sort.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index f8f16c0..93f755a 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -846,6 +846,9 @@ static int hist_entry__mispredict_snprintf(struct 
hist_entry *he, char *bf,
 static int64_t
 sort__cycles_cmp(struct hist_entry *left, struct hist_entry *right)
 {
+   if (!left->branch_info || !right->branch_info)
+   return cmp_null(left->branch_info, right->branch_info);
+
return left->branch_info->flags.cycles -
right->branch_info->flags.cycles;
 }
@@ -853,6 +856,8 @@ sort__cycles_cmp(struct hist_entry *left, struct hist_entry 
*right)
 static int hist_entry__cycles_snprintf(struct hist_entry *he, char *bf,
size_t size, unsigned int width)
 {
+   if (!he->branch_info)
+   return scnprintf(bf, size, "%-.*s", width, "N/A");
if (he->branch_info->flags.cycles == 0)
return repsep_snprintf(bf, size, "%-*s", width, "-");
return repsep_snprintf(bf, size, "%-*hd", width,


[tip:perf/core] perf tools: Ignore generated files pmu-events/{jevents,pmu-events.c} for git

2017-03-15 Thread tip-bot for Changbin Du
Commit-ID:  12a601c64339d2d28af534d2324f87cf00ba8cd8
Gitweb: http://git.kernel.org/tip/12a601c64339d2d28af534d2324f87cf00ba8cd8
Author: Changbin Du 
AuthorDate: Mon, 13 Mar 2017 16:30:26 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 13 Mar 2017 10:59:36 -0300

perf tools: Ignore generated files pmu-events/{jevents,pmu-events.c} for git

Ignore two files: pmu-events/{jevents,pmu-events.c} which are generated
during the build.

Committer notes:

Testing it:

  $ make -C tools/perf/
  $ git status
  On branch perf/core
  Untracked files:
  (use "git add ..." to include in what will be committed)

tools/perf/pmu-events/jevents
tools/perf/pmu-events/pmu-events.c

  nothing added to commit but untracked files present (use "git add" to track)
  $

After the patch:

  $ git status
  On branch perf/core
  nothing to commit, working tree clean
  $

Signed-off-by: Changbin Du 
Tested-by: Arnaldo Carvalho de Melo 
Cc: Peter Zijlstra 
Link: http://lkml.kernel.org/r/20170313083026.23487-1-changbin...@intel.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/.gitignore | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/perf/.gitignore b/tools/perf/.gitignore
index 3db3db9..643cc4ba 100644
--- a/tools/perf/.gitignore
+++ b/tools/perf/.gitignore
@@ -31,3 +31,5 @@ config.mak.autogen
 .config-detected
 util/intel-pt-decoder/inat-tables.c
 arch/*/include/generated/
+pmu-events/pmu-events.c
+pmu-events/jevents


[tip:perf/core] perf tools: Ignore generated files pmu-events/{jevents,pmu-events.c} for git

2017-03-15 Thread tip-bot for Changbin Du
Commit-ID:  12a601c64339d2d28af534d2324f87cf00ba8cd8
Gitweb: http://git.kernel.org/tip/12a601c64339d2d28af534d2324f87cf00ba8cd8
Author: Changbin Du 
AuthorDate: Mon, 13 Mar 2017 16:30:26 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 13 Mar 2017 10:59:36 -0300

perf tools: Ignore generated files pmu-events/{jevents,pmu-events.c} for git

Ignore two files: pmu-events/{jevents,pmu-events.c} which are generated
during the build.

Committer notes:

Testing it:

  $ make -C tools/perf/
  $ git status
  On branch perf/core
  Untracked files:
  (use "git add ..." to include in what will be committed)

tools/perf/pmu-events/jevents
tools/perf/pmu-events/pmu-events.c

  nothing added to commit but untracked files present (use "git add" to track)
  $

After the patch:

  $ git status
  On branch perf/core
  nothing to commit, working tree clean
  $

Signed-off-by: Changbin Du 
Tested-by: Arnaldo Carvalho de Melo 
Cc: Peter Zijlstra 
Link: http://lkml.kernel.org/r/20170313083026.23487-1-changbin...@intel.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/.gitignore | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/perf/.gitignore b/tools/perf/.gitignore
index 3db3db9..643cc4ba 100644
--- a/tools/perf/.gitignore
+++ b/tools/perf/.gitignore
@@ -31,3 +31,5 @@ config.mak.autogen
 .config-detected
 util/intel-pt-decoder/inat-tables.c
 arch/*/include/generated/
+pmu-events/pmu-events.c
+pmu-events/jevents


[tip:perf/core] perf tools: Missing c2c command in command-list

2017-03-15 Thread tip-bot for Changbin Du
Commit-ID:  f9c10cd645a3defc24110ac71f93e8d18a50d0d6
Gitweb: http://git.kernel.org/tip/f9c10cd645a3defc24110ac71f93e8d18a50d0d6
Author: Changbin Du 
AuthorDate: Mon, 13 Mar 2017 16:28:45 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 13 Mar 2017 10:59:31 -0300

perf tools: Missing c2c command in command-list

Add the c2c command to command-list.txt so perf help can list this
command.

Committer notes:

Before:

  # perf help | grep c2c
  #

After:

  # perf help | grep c2c
 c2c Shared Data C2C/HITM Analyzer.
  #

Signed-off-by: Changbin Du 
Tested-by: Arnaldo Carvalho de Melo 
Cc: Peter Zijlstra 
Link: http://lkml.kernel.org/r/20170313082845.23373-1-changbin...@intel.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/command-list.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/command-list.txt b/tools/perf/command-list.txt
index ac3efd3..2d0caf2 100644
--- a/tools/perf/command-list.txt
+++ b/tools/perf/command-list.txt
@@ -9,6 +9,7 @@ perf-buildid-cache  mainporcelain common
 perf-buildid-list  mainporcelain common
 perf-data  mainporcelain common
 perf-diff  mainporcelain common
+perf-c2c   mainporcelain common
 perf-configmainporcelain common
 perf-evlistmainporcelain common
 perf-ftracemainporcelain common


[tip:perf/core] perf tools: Missing c2c command in command-list

2017-03-15 Thread tip-bot for Changbin Du
Commit-ID:  f9c10cd645a3defc24110ac71f93e8d18a50d0d6
Gitweb: http://git.kernel.org/tip/f9c10cd645a3defc24110ac71f93e8d18a50d0d6
Author: Changbin Du 
AuthorDate: Mon, 13 Mar 2017 16:28:45 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 13 Mar 2017 10:59:31 -0300

perf tools: Missing c2c command in command-list

Add the c2c command to command-list.txt so perf help can list this
command.

Committer notes:

Before:

  # perf help | grep c2c
  #

After:

  # perf help | grep c2c
 c2c Shared Data C2C/HITM Analyzer.
  #

Signed-off-by: Changbin Du 
Tested-by: Arnaldo Carvalho de Melo 
Cc: Peter Zijlstra 
Link: http://lkml.kernel.org/r/20170313082845.23373-1-changbin...@intel.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/command-list.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/command-list.txt b/tools/perf/command-list.txt
index ac3efd3..2d0caf2 100644
--- a/tools/perf/command-list.txt
+++ b/tools/perf/command-list.txt
@@ -9,6 +9,7 @@ perf-buildid-cache  mainporcelain common
 perf-buildid-list  mainporcelain common
 perf-data  mainporcelain common
 perf-diff  mainporcelain common
+perf-c2c   mainporcelain common
 perf-configmainporcelain common
 perf-evlistmainporcelain common
 perf-ftracemainporcelain common