perf fixes
Subsystems (2)
Linus,
Please pull the latest perf-fixes-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git perf-fixes-for-linus
Thanks,
Ingo
------------------>
Corey Ashford (1):
perf: Fix usages of profile_cpu in builtin-top.c to use cpu_list
Cyrill Gorcunov (1):
perf, ui: Eliminate stack-smashing protection compiler complaint
Peter Zijlstra (1):
perf, amd: Use kmalloc_node(,__GFP_ZERO) for northbridge structure allocation
Stephane Eranian (1):
perf_events: Fix time tracking in samples
Tom Zanussi (7):
perf trace scripting: fix some small memory leaks and missing error checks perf trace scripting: remove system-wide param from shell scripts perf record: make the record options available outside perf record perf trace record: handle commands correctly
perf trace: live-mode command-line cleanup
perf trace: update Documentation with new perf trace variants perf trace: update usage
arch/x86/kernel/cpu/perf_event_amd.c | 4 +- include/linux/perf_event.h | 10 + kernel/perf_event.c | 42 ++++- tools/perf/Documentation/perf-trace.txt | 57 +++++- tools/perf/builtin-record.c | 10 +- tools/perf/builtin-top.c | 12 +- tools/perf/builtin-trace.c | 209 ++++++++++++++------ tools/perf/scripts/perl/bin/failed-syscalls-record | 2 +- tools/perf/scripts/perl/bin/rw-by-file-record | 2 +- tools/perf/scripts/perl/bin/rw-by-pid-record | 2 +- tools/perf/scripts/perl/bin/rwtop-record | 2 +- tools/perf/scripts/perl/bin/wakeup-latency-record | 2 +- tools/perf/scripts/perl/bin/workqueue-stats-record | 2 +- .../python/bin/failed-syscalls-by-pid-record | 2 +- .../scripts/python/bin/futex-contention-record | 2 +- tools/perf/scripts/python/bin/netdev-times-record | 2 +- .../perf/scripts/python/bin/sched-migration-record | 2 +- tools/perf/scripts/python/bin/sctop-record | 2 +- .../python/bin/syscall-counts-by-pid-record | 2 +- .../perf/scripts/python/bin/syscall-counts-record | 2 +- tools/perf/util/ui/util.c | 5 +- 21 files changed, 271 insertions(+), 104 deletions(-)
arch/x86/kernel/cpu/perf_event_amd.c +2 -2
@@ -280,11 +280,11 @@ static struct amd_nb *amd_alloc_nb(int cpu, int nb_id)struct amd_nb *nb;int i; - nb =kmalloc (sizeof (struct amd_nb ),GFP_KERNEL ); + nb =kmalloc_node (sizeof (struct amd_nb ),GFP_KERNEL | __GFP_ZERO, +cpu_to_node (cpu));if (!nb)return NULL ; -memset (nb,0 ,sizeof (*nb)); nb->nb_id = nb_id;/*
include/linux/perf_event.h +10 -0
@@ -747,6 +747,16 @@ struct perf_event {u64 tstamp_running;u64 tstamp_stopped; +/* +* timestamp shadows the actual context timing but it can +* be safely used in NMI interrupt context. It reflects the +* context time as it was when the event was last scheduled in. +* +* ctx_time already accounts for ctx->timestamp. Therefore to +* compute ctx_time for a sample, simply add perf_clock(). +*/ +u64 shadow_ctx_time; +struct perf_event_attr attr;struct hw_perf_event hw;
kernel/perf_event.c +34 -8
88 lines not on this page · raw message
tools/perf/Documentation/perf-trace.txt +49 -8
85 lines not on this page · raw message
tools/perf/builtin-record.c +5 -5
@@ -790,7 +790,7 @@ static const char * const record_usage[] = {static bool force, append_file; -static const struct option options[] = { +const struct option record_options[] = {OPT_CALLBACK ('e' ,"event" ,NULL ,"event" ,"event selector. use 'perf list' to list available events" , parse_events),
@@ -839,16 +839,16 @@ int cmd_record(int argc, const char **argv, const char *prefix __used) {int i, j, err = -ENOMEM ; - argc =parse_options (argc, argv, options, record_usage, + argc =parse_options (argc, argv, record_options, record_usage,PARSE_OPT_STOP_AT_NON_OPTION );if (!argc && target_pid ==-1 && target_tid ==-1 && !system_wide && !cpu_list) -usage_with_options (record_usage, options); +usage_with_options (record_usage, record_options);if (force && append_file) {fprintf (stderr,"Can't overwrite and append at the same time." " You need to choose between -f and -A" ); -usage_with_options (record_usage, options); +usage_with_options (record_usage, record_options); }else if (append_file) { write_mode =WRITE_APPEND ; }else {
@@ -871,7 +871,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)if (thread_num <=0 ) {fprintf (stderr,"Can't find all threads of pid %d\n" , target_pid); -usage_with_options (record_usage, options); +usage_with_options (record_usage, record_options); } }else { all_tids=malloc (sizeof (pid_t));
tools/perf/builtin-top.c +5 -7
@@ -69,7 +69,6 @@ static int target_tid = -1;static pid_t *all_tids =NULL ;static int thread_num =0 ;static bool inherit = false; -static int profile_cpu =-1 ;static int nr_cpus =0 ;static int realtime_prio =0 ;static bool group = false;
@@ -558,13 +557,13 @@ static void print_sym_table(void)else printf (" (all" ); -if (profile_cpu !=-1 ) -printf (", cpu: %d)\n" , profile_cpu); +if (cpu_list) +printf (", CPU%s: %s)\n" , nr_cpus >1 ?"s" :"" , cpu_list);else {if (target_tid !=-1 )printf (")\n" );else -printf (", %d CPUs)\n" , nr_cpus); +printf (", %d CPU%s)\n" , nr_cpus, nr_cpus >1 ?"s" :"" ); }printf ("%-*.*s\n" , win_width, win_width, graph_dotted_line);
@@ -1187,11 +1186,10 @@ int group_fd;static void start_counter (int i,int counter) {struct perf_event_attr *attr; -int cpu; +int cpu =-1 ;int thread_index; - cpu = profile_cpu; -if (target_tid ==-1 && profile_cpu ==-1 ) +if (target_tid ==-1 ) cpu = cpumap[i]; attr = attrs + counter;
tools/perf/builtin-trace.c +150 -59
293 lines not on this page · raw message
tools/perf/scripts/perl/bin/failed-syscalls-record +1 -1
@@ -1,2 +1,2 @@ #!/bin/bash -perf record -a -e raw_syscalls:sys_exit $@ +perf record -e raw_syscalls:sys_exit $@
tools/perf/scripts/perl/bin/rw-by-file-record +1 -1
@@ -1,3 +1,3 @@ #!/bin/bash -perf record -a -e syscalls:sys_enter_read -e syscalls:sys_enter_write $@ +perf record -e syscalls:sys_enter_read -e syscalls:sys_enter_write $@
tools/perf/scripts/perl/bin/rw-by-pid-record +1 -1
@@ -1,2 +1,2 @@ #!/bin/bash -perf record -a -e syscalls:sys_enter_read -e syscalls:sys_exit_read -e syscalls:sys_enter_write -e syscalls:sys_exit_write $@ +perf record -e syscalls:sys_enter_read -e syscalls:sys_exit_read -e syscalls:sys_enter_write -e syscalls:sys_exit_write $@
tools/perf/scripts/perl/bin/rwtop-record +1 -1
@@ -1,2 +1,2 @@ #!/bin/bash -perf record -a -e syscalls:sys_enter_read -e syscalls:sys_exit_read -e syscalls:sys_enter_write -e syscalls:sys_exit_write $@ +perf record -e syscalls:sys_enter_read -e syscalls:sys_exit_read -e syscalls:sys_enter_write -e syscalls:sys_exit_write $@
tools/perf/scripts/perl/bin/wakeup-latency-record +1 -1
@@ -1,5 +1,5 @@ #!/bin/bash -perf record -a -e sched:sched_switch -e sched:sched_wakeup $@ +perf record -e sched:sched_switch -e sched:sched_wakeup $@
tools/perf/scripts/perl/bin/workqueue-stats-record +1 -1
@@ -1,2 +1,2 @@ #!/bin/bash -perf record -a -e workqueue:workqueue_creation -e workqueue:workqueue_destruction -e workqueue:workqueue_execution -e workqueue:workqueue_insertion $@ +perf record -e workqueue:workqueue_creation -e workqueue:workqueue_destruction -e workqueue:workqueue_execution -e workqueue:workqueue_insertion $@
tools/perf/scripts/python/bin/failed-syscalls-by-pid-record +1 -1
@@ -1,2 +1,2 @@ #!/bin/bash -perf record -a -e raw_syscalls:sys_exit $@ +perf record -e raw_syscalls:sys_exit $@
tools/perf/scripts/python/bin/futex-contention-record +1 -1
@@ -1,2 +1,2 @@ #!/bin/bash -perf record -a -e syscalls:sys_enter_futex -e syscalls:sys_exit_futex $@ +perf record -e syscalls:sys_enter_futex -e syscalls:sys_exit_futex $@
tools/perf/scripts/python/bin/netdev-times-record +1 -1
@@ -1,5 +1,5 @@ #!/bin/bash -perf record -a -e net:net_dev_xmit -e net:net_dev_queue \ +perf record -e net:net_dev_xmit -e net:net_dev_queue \ -e net:netif_receive_skb -e net:netif_rx \ -e skb:consume_skb -e skb:kfree_skb \ -e skb:skb_copy_datagram_iovec -e napi:napi_poll \
tools/perf/scripts/python/bin/sched-migration-record +1 -1
@@ -1,2 +1,2 @@ #!/bin/bash -perf record -m 16384 -a -e sched:sched_wakeup -e sched:sched_wakeup_new -e sched:sched_switch -e sched:sched_migrate_task $@ +perf record -m 16384 -e sched:sched_wakeup -e sched:sched_wakeup_new -e sched:sched_switch -e sched:sched_migrate_task $@
tools/perf/scripts/python/bin/sctop-record +1 -1
@@ -1,2 +1,2 @@ #!/bin/bash -perf record -a -e raw_syscalls:sys_enter $@ +perf record -e raw_syscalls:sys_enter $@
tools/perf/scripts/python/bin/syscall-counts-by-pid-record +1 -1
@@ -1,2 +1,2 @@ #!/bin/bash -perf record -a -e raw_syscalls:sys_enter $@ +perf record -e raw_syscalls:sys_enter $@
tools/perf/scripts/python/bin/syscall-counts-record +1 -1
@@ -1,2 +1,2 @@ #!/bin/bash -perf record -a -e raw_syscalls:sys_enter $@ +perf record -e raw_syscalls:sys_enter $@
tools/perf/util/ui/util.c +3 -2
@@ -104,9 +104,10 @@ out_destroy_form:return rc; } +static const char yes[] ="Yes" , no[] ="No" ; +bool ui__dialog_yesno (const char *msg) {/* newtWinChoice should really be accepting const char pointers... */ -char yes[] ="Yes" , no[] ="No" ; -return newtWinChoice (NULL , yes, no, (char *)msg) ==1 ; +return newtWinChoice (NULL , (char *)yes, (char *)no, (char *)msg) ==1 ; }