perf updates/fixes
Subsystems (3)
Linus,
Please pull the latest perf-urgent-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus
HEAD: 95cf59ea72331d0093010543b8951bb43f262cac perf: Fix perf_cgroup_switch for sw-events
This tree includes some late late perf items that missed the first round:
tools:
* Bash auto completion improvements, now we can auto complete the tools long options, tracepoint event names, etc, from Namhyung Kim.
* Look up thread using tid instead of pid in 'perf sched'.
* Move global variables into a perf_kvm struct, from David Ahern.
* Hists refactorings, preparatory for improved 'diff' command, from Jiri Olsa.
* Hists refactorings, preparatory for event group viewieng work, from Namhyung Kim.
* Remove double negation on optional feature macro definitions, from Namhyung Kim.
* Remove several cases of needless global variables, on most builtins.
* misc fixes
kernel:
* sysfs support for IBS on AMD CPUs, from Robert Richter.
* Support for an upcoming Intel CPU, the Xeon-Phi / Knights Corner HPC blade PMU, from Vince Weaver.
* misc fixes
Thanks,
Ingo
------------------>
Arnaldo Carvalho de Melo (19):
perf trace: Use evsel->handler.func
perf inject: Remove unused 'input_name' static var perf inject: Remove static variables
perf sched: Look up thread using tid instead of pid perf stat: Don't use globals where not needed to perf script: Don't use globals where not needed to perf help: Don't use globals where not needed to perf kmem: Don't use globals where not needed to perf lock: Don't use globals where not needed to perf timechart: Don't use globals where not needed to perf buildid-cache: Don't use globals where not needed to perf buildid-list: Don't use globals where not needed to perf probe: Don't use globals where not needed to perf top: Don't use globals where not needed to perf evlist: Don't use globals where not needed to perf record: Don't use globals where not needed to perf inject: Don't use globals where not needed to perf evlist: Introduce add_newtp method
perf evlist: Remove some unused methods
David Ahern (1):
perf kvm: Move global variables into a perf_kvm struct
Jiri Olsa (6):
perf hists: Add struct hists pointer to struct hist_entry perf diff: Refactor diff displacement possition info perf hists: Separate overhead and baseline columns perf tools: Removing hists pair argument from output path perf tool: Add hpp interface to enable/disable hpp column perf diff: Removing the total_period argument from output code
Namhyung Kim (16):
perf tools: Move libdw availability check before arch Makefile perf tools: Remove unused PYRF_OBJS variable on Makefile
perf tools: Convert to LIBELF_SUPPORT
perf tools: Convert to LIBUNWIND_SUPPORT
perf tools: Convert to LIBAUDIT_SUPPORT
perf tools: Convert to NEWT_SUPPORT
perf tools: Convert to GTK2_SUPPORT
perf tools: Convert to HAVE_STRLCPY
perf tools: Check existence of _get_comp_words_by_ref when bash completing perf tools: Complete long option names of perf command
perf tools: Long option completion support for each subcommands perf tools: Convert to BACKTRACE_SUPPORT
perf tools: Complete tracepoint event names
perf hists: Introduce struct he_stat
perf hists: Move he->stat.nr_events initialization to a template perf hists: Add more helpers for hist entry stat
Peter Zijlstra (2):
perf: Clarify perf_cpu_context::active_pmu usage by renaming it to ::unique_pmu
perf: Fix perf_cgroup_switch for sw-events
Robert Richter (1):
perf/AMD/IBS: Add sysfs support
Vince Weaver (1):
perf/x86: Add support for Intel Xeon-Phi Knights Corner PMU
arch/x86/include/asm/msr-index.h | 5 + arch/x86/kernel/cpu/Makefile | 2 +- arch/x86/kernel/cpu/perf_event.h | 2 + arch/x86/kernel/cpu/perf_event_amd_ibs.c | 61 +++- arch/x86/kernel/cpu/perf_event_intel.c | 2 + arch/x86/kernel/cpu/perf_event_knc.c | 248 +++++++++++++++++ arch/x86/kernel/cpu/perfctr-watchdog.c | 4 + include/linux/perf_event.h | 2 +- kernel/events/core.c | 21 +- tools/perf/Makefile | 83 ++---- tools/perf/bash_completion | 50 +++- tools/perf/builtin-buildid-cache.c | 58 ++-- tools/perf/builtin-buildid-list.c | 55 ++-- tools/perf/builtin-diff.c | 68 +++-- tools/perf/builtin-evlist.c | 21 +- tools/perf/builtin-help.c | 40 +-- tools/perf/builtin-inject.c | 88 +++--- tools/perf/builtin-kmem.c | 66 ++--- tools/perf/builtin-kvm.c | 460 +++++++++++++++++-------------- tools/perf/builtin-lock.c | 90 +++--- tools/perf/builtin-probe.c | 26 +- tools/perf/builtin-record.c | 27 +- tools/perf/builtin-report.c | 4 +- tools/perf/builtin-sched.c | 2 +- tools/perf/builtin-script.c | 90 +++--- tools/perf/builtin-stat.c | 328 +++++++++++----------- tools/perf/builtin-timechart.c | 100 +++---- tools/perf/builtin-top.c | 11 +- tools/perf/builtin-trace.c | 134 +++++---- tools/perf/perf.c | 4 +- tools/perf/ui/browsers/hists.c | 12 +- tools/perf/ui/gtk/browser.c | 6 +- tools/perf/ui/gtk/util.c | 2 +- tools/perf/ui/helpline.h | 18 +- tools/perf/ui/hist.c | 145 ++++++---- tools/perf/ui/setup.c | 2 +- tools/perf/ui/stdio/hist.c | 45 ++- tools/perf/util/annotate.h | 8 +- tools/perf/util/cache.h | 38 +-- tools/perf/util/debug.c | 2 +- tools/perf/util/debug.h | 17 +- tools/perf/util/evlist.c | 88 +----- tools/perf/util/evlist.h | 18 +- tools/perf/util/generate-cmdlist.sh | 4 +- tools/perf/util/hist.c | 66 +++-- tools/perf/util/hist.h | 38 ++- tools/perf/util/map.c | 2 +- tools/perf/util/parse-options.c | 8 + tools/perf/util/parse-options.h | 1 + tools/perf/util/path.c | 2 +- tools/perf/util/perf_regs.h | 4 +- tools/perf/util/sort.h | 19 +- tools/perf/util/symbol.h | 10 +- tools/perf/util/unwind.h | 4 +- tools/perf/util/util.c | 4 +- 55 files changed, 1517 insertions(+), 1198 deletions(-) create mode 100644 arch/x86/kernel/cpu/perf_event_knc.c
arch/x86/include/asm/msr-index.h +5 -0
@@ -121,6 +121,11 @@#define MSR_P6_EVNTSEL0 0x00000186#define MSR_P6_EVNTSEL1 0x00000187 +#define MSR_KNC_PERFCTR0 0x00000020 +#define MSR_KNC_PERFCTR1 0x00000021 +#define MSR_KNC_EVNTSEL0 0x00000028 +#define MSR_KNC_EVNTSEL1 0x00000029 +/* AMD64 MSRs. Not complete. See the architecture manual for a more complete list. */
arch/x86/kernel/cpu/Makefile +1 -1
@@ -32,7 +32,7 @@ obj-$(CONFIG_PERF_EVENTS) += perf_event.o ifdef CONFIG_PERF_EVENTS obj-$(CONFIG_CPU_SUP_AMD) += perf_event_amd.o -obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_p6.o perf_event_p4.o +obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_p6.o perf_event_knc.o perf_event_p4.o obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_lbr.o perf_event_intel_ds.o perf_event_intel.o obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_uncore.o endif
arch/x86/kernel/cpu/perf_event.h +2 -0
@@ -626,6 +626,8 @@ int p4_pmu_init(void);int p6_pmu_init (void ); +int knc_pmu_init (void ); +#else /* CONFIG_CPU_SUP_INTEL */ static inline void reserve_ds_buffers (void )
arch/x86/kernel/cpu/perf_event_amd_ibs.c +49 -12
103 lines not on this page · raw message
arch/x86/kernel/cpu/perf_event_intel.c +2 -0
@@ -1906,6 +1906,8 @@ __init int intel_pmu_init(void)switch (boot_cpu_data.x86) {case 0x6 :return p6_pmu_init (); +case 0xb : +return knc_pmu_init ();case 0xf :return p4_pmu_init (); }
arch/x86/kernel/cpu/perf_event_knc.c new file +248 -0
248 lines not on this page · raw message
arch/x86/kernel/cpu/perfctr-watchdog.c +4 -0
@@ -56,6 +56,8 @@ static inline unsigned int nmi_perfctr_msr_to_bit(unsigned int msr)switch (boot_cpu_data.x86) {case 6 :return msr -MSR_P6_PERFCTR0 ; +case 11 : +return msr -MSR_KNC_PERFCTR0 ;case 15 :return msr -MSR_P4_BPU_PERFCTR0 ; }
@@ -82,6 +84,8 @@ static inline unsigned int nmi_evntsel_msr_to_bit(unsigned int msr)switch (boot_cpu_data.x86) {case 6 :return msr -MSR_P6_EVNTSEL0 ; +case 11 : +return msr -MSR_KNC_EVNTSEL0 ;case 15 :return msr -MSR_P4_BSU_ESCR0 ; }
include/linux/perf_event.h +1 -1
@@ -1110,7 +1110,7 @@ struct perf_cpu_context {int exclusive;struct list_head rotation_list;int jiffies_interval; -struct pmu *active_pmu; +struct pmu *unique_pmu;struct perf_cgroup *cgrp; };
kernel/events/core.c +12 -9
@@ -372,6 +372,8 @@ void perf_cgroup_switch(struct task_struct *task, int mode)list_for_each_entry_rcu (pmu, &pmus, entry) { cpuctx =this_cpu_ptr (pmu->pmu_cpu_context); +if (cpuctx->unique_pmu != pmu) +continue ;/* ensure we process each cpuctx once */ /* * perf_cgroup_events says at least one
@@ -395,9 +397,10 @@ void perf_cgroup_switch(struct task_struct *task, int mode)if (mode &PERF_CGROUP_SWIN ) {WARN_ON_ONCE (cpuctx->cgrp); -/* set cgrp before ctxsw in to -* allow event_filter_match() to not -* have to pass task around +/* +* set cgrp before ctxsw in to allow +* event_filter_match() to not have to pass +* task around */ cpuctx->cgrp =perf_cgroup_from_task (task);cpu_ctx_sched_in (cpuctx,EVENT_ALL , task);
@@ -4419,7 +4422,7 @@ static void perf_event_task_event(struct perf_task_event *task_event)rcu_read_lock ();list_for_each_entry_rcu (pmu, &pmus, entry) { cpuctx =get_cpu_ptr (pmu->pmu_cpu_context); -if (cpuctx->active_pmu != pmu) +if (cpuctx->unique_pmu != pmu) goto next;perf_event_task_ctx (&cpuctx->ctx, task_event);
@@ -4565,7 +4568,7 @@ static void perf_event_comm_event(struct perf_comm_event *comm_event)rcu_read_lock ();list_for_each_entry_rcu (pmu, &pmus, entry) { cpuctx =get_cpu_ptr (pmu->pmu_cpu_context); -if (cpuctx->active_pmu != pmu) +if (cpuctx->unique_pmu != pmu) goto next;perf_event_comm_ctx (&cpuctx->ctx, comm_event);
@@ -4761,7 +4764,7 @@ got_name:rcu_read_lock ();list_for_each_entry_rcu (pmu, &pmus, entry) { cpuctx =get_cpu_ptr (pmu->pmu_cpu_context); -if (cpuctx->active_pmu != pmu) +if (cpuctx->unique_pmu != pmu) goto next;perf_event_mmap_ctx (&cpuctx->ctx, mmap_event, vma->vm_flags &VM_EXEC );
@@ -5862,8 +5865,8 @@ static void update_pmu_context(struct pmu *pmu, struct pmu *old_pmu) cpuctx =per_cpu_ptr (pmu->pmu_cpu_context, cpu); -if (cpuctx->active_pmu == old_pmu) - cpuctx->active_pmu = pmu; +if (cpuctx->unique_pmu == old_pmu) + cpuctx->unique_pmu = pmu; } }
@@ -5998,7 +6001,7 @@ skip_type: cpuctx->ctx.pmu = pmu; cpuctx->jiffies_interval =1 ;INIT_LIST_HEAD (&cpuctx->rotation_list); - cpuctx->active_pmu = pmu; + cpuctx->unique_pmu = pmu; } got_cpu_context:
tools/perf/Makefile +29 -54
179 lines not on this page · raw message
tools/perf/bash_completion +43 -7
66 lines not on this page · raw message
tools/perf/builtin-buildid-cache.c +26 -32
83 lines not on this page · raw message
tools/perf/builtin-buildid-list.c +24 -31
76 lines not on this page · raw message
tools/perf/builtin-diff.c +49 -19
125 lines not on this page · raw message
tools/perf/builtin-evlist.c +9 -12
@@ -108,23 +108,20 @@ static int __cmd_evlist(const char *input_name, struct perf_attr_details *detailreturn 0 ; } -static const char *const evlist_usage[] = { -"perf evlist [<options>]" , -NULL -}; -int cmd_evlist (int argc,const char **argv,const char *prefix__maybe_unused ) {struct perf_attr_details details = { .verbose = false, };const char *input_name =NULL ;const struct option options[] = { -OPT_STRING ('i' ,"input" , &input_name,"file" , -"Input file name" ), -OPT_BOOLEAN ('F' ,"freq" , &details.freq, -"Show the sample frequency" ), -OPT_BOOLEAN ('v' ,"verbose" , &details.verbose, -"Show all event attr details" ), -OPT_END () +OPT_STRING ('i' ,"input" , &input_name,"file" ,"Input file name" ), +OPT_BOOLEAN ('F' ,"freq" , &details.freq,"Show the sample frequency" ), +OPT_BOOLEAN ('v' ,"verbose" , &details.verbose, +"Show all event attr details" ), +OPT_END () + }; +const char *const evlist_usage[] = { +"perf evlist [<options>]" , +NULL }; argc =parse_options (argc, argv, options, evlist_usage,0 );
tools/perf/builtin-help.c +20 -20
@@ -30,23 +30,6 @@ enum help_format { HELP_FORMAT_WEB, }; -static bool show_all = false; -static enum help_format help_format =HELP_FORMAT_NONE ; -static struct option builtin_help_options[] = { -OPT_BOOLEAN ('a' ,"all" , &show_all,"print all available commands" ), -OPT_SET_UINT ('m' ,"man" , &help_format,"show man page" ,HELP_FORMAT_MAN ), -OPT_SET_UINT ('w' ,"web" , &help_format,"show manual in web browser" , -HELP_FORMAT_WEB ), -OPT_SET_UINT ('i' ,"info" , &help_format,"show info page" , -HELP_FORMAT_INFO ), -OPT_END (), -}; - -static const char *const builtin_help_usage[] = { -"perf help [--all] [--man|--web|--info] [command]" , -NULL -}; -static enum help_format parse_help_format (const char *format) {if (!strcmp (format,"man" ))
@@ -258,11 +241,13 @@ static int add_man_viewer_info(const char *var, const char *value)static int perf_help_config (const char *var,const char *value,void *cb) { +enum help_format *help_formatp = cb; +if (!strcmp (var,"help.format" )) {if (!value)return config_error_nonbool (var); - help_format =parse_help_format (value); -if (help_format ==HELP_FORMAT_NONE ) + *help_formatp =parse_help_format (value); +if (*help_formatp ==HELP_FORMAT_NONE )return -1 ;return 0 ; }
@@ -428,12 +413,27 @@ static int show_html_page(const char *perf_cmd)int cmd_help (int argc,const char **argv,const char *prefix__maybe_unused ) { +bool show_all = false; +enum help_format help_format =HELP_FORMAT_NONE ; +struct option builtin_help_options[] = { +OPT_BOOLEAN ('a' ,"all" , &show_all,"print all available commands" ), +OPT_SET_UINT ('m' ,"man" , &help_format,"show man page" ,HELP_FORMAT_MAN ), +OPT_SET_UINT ('w' ,"web" , &help_format,"show manual in web browser" , +HELP_FORMAT_WEB ), +OPT_SET_UINT ('i' ,"info" , &help_format,"show info page" , +HELP_FORMAT_INFO ), +OPT_END (), + }; +const char *const builtin_help_usage[] = { +"perf help [--all] [--man|--web|--info] [command]" , +NULL + };const char *alias;int rc =0 ;load_command_list ("perf-" , &main_cmds, &other_cmds); -perf_config (perf_help_config,NULL ); +perf_config (perf_help_config, &help_format); argc =parse_options (argc, argv, builtin_help_options, builtin_help_usage,0 );
tools/perf/builtin-inject.c +45 -43
138 lines not on this page · raw message
tools/perf/builtin-kmem.c +26 -40
114 lines not on this page · raw message
tools/perf/builtin-kvm.c +253 -207
836 lines not on this page · raw message
tools/perf/builtin-lock.c +39 -51
116 lines not on this page · raw message
tools/perf/builtin-probe.c +12 -14
@@ -250,19 +250,20 @@ static int opt_set_filter(const struct option *opt __maybe_unused,return 0 ; } -static const char *const probe_usage[] = { -"perf probe [<options>] 'PROBEDEF' ['PROBEDEF' ...]" , -"perf probe [<options>] --add 'PROBEDEF' [--add 'PROBEDEF' ...]" , -"perf probe [<options>] --del '[GROUP:]EVENT' ..." , -"perf probe --list" , +int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) +{ + const char * const probe_usage[] = { + "perf probe [<options>] 'PROBEDEF' ['PROBEDEF' ...]", + "perf probe [<options>] --add 'PROBEDEF' [--add 'PROBEDEF' ...]", + "perf probe [<options>] --del '[GROUP:]EVENT' ...", + "perf probe --list", #ifdef DWARF_SUPPORT -"perf probe [<options>] --line 'LINEDESC'" , -"perf probe [<options>] --vars 'PROBEPOINT'" , + "perf probe [<options>] --line 'LINEDESC'", + "perf probe [<options>] --vars 'PROBEPOINT'", #endif -NULL + NULL }; - -static const struct option options[] = { + const struct option options[] = { OPT_INCR('v', "verbose", &verbose, "be more verbose (show parsed arguments, etc)"), OPT_BOOLEAN('l', "list", ¶ms.list_events,
@@ -325,10 +326,7 @@ static const struct option options[] = {OPT_CALLBACK ('x' ,"exec" ,NULL ,"executable|path" ,"target executable name or path" , opt_set_target),OPT_END () -}; - -int cmd_probe (int argc,const char **argv,const char *prefix__maybe_unused ) -{ + };int ret; argc = parse_options(argc, argv, options, probe_usage,
tools/perf/builtin-record.c +14 -13
@@ -31,15 +31,6 @@#include <sched.h> #include <sys/mman.h> -#define CALLCHAIN_HELP "do call-graph (stack chain/backtrace) recording: " - -#ifdef NO_LIBUNWIND_SUPPORT -static char callchain_help[] =CALLCHAIN_HELP "[fp]" ; -#else -static unsigned long default_stack_dump_size =8192 ; -static char callchain_help[] =CALLCHAIN_HELP "[fp] dwarf" ; -#endif -enum write_mode_t {WRITE_FORCE ,WRITE_APPEND
@@ -800,7 +791,7 @@ error:return ret; } -#ifndef NO_LIBUNWIND_SUPPORT +#ifdef LIBUNWIND_SUPPORT static int get_stack_size (char *str,unsigned long *_size) {char *endptr;
@@ -826,7 +817,7 @@ static int get_stack_size(char *str, unsigned long *_size) max_size, str);return -1 ; } -#endif /* !NO_LIBUNWIND_SUPPORT */ +#endif /* LIBUNWIND_SUPPORT */ static int parse_callchain_opt(const struct option *opt __maybe_unused, const char *arg,
@@ -865,9 +856,11 @@ parse_callchain_opt(const struct option *opt __maybe_unused, const char *arg, "needed for -g fp\n");break ; -#ifndef NO_LIBUNWIND_SUPPORT +#ifdef LIBUNWIND_SUPPORT /* Dwarf style */ }else if (!strncmp (name,"dwarf" ,sizeof ("dwarf" ))) { +const unsigned long default_stack_dump_size =8192 ; + ret =0 ; rec->opts.call_graph =CALLCHAIN_DWARF ; rec->opts.stack_dump_size = default_stack_dump_size;
@@ -883,7 +876,7 @@ parse_callchain_opt(const struct option *opt __maybe_unused, const char *arg,if (!ret)pr_debug ("callchain: stack dump size %d\n" , rec->opts.stack_dump_size); -#endif /* !NO_LIBUNWIND_SUPPORT */ +#endif /* LIBUNWIND_SUPPORT */ }else {pr_err ("callchain: Unknown -g option " "value: %s\n" , arg);
@@ -930,6 +923,14 @@ static struct perf_record record = { .file_new = true, }; +#define CALLCHAIN_HELP "do call-graph (stack chain/backtrace) recording: " + +#ifdef LIBUNWIND_SUPPORT +static const char callchain_help[] =CALLCHAIN_HELP "[fp] dwarf" ; +#else +static const char callchain_help[] =CALLCHAIN_HELP "[fp]" ; +#endif +/* * XXX Will stay a global variable till we fix builtin-script.c to stop messing * with it and switch to use the library functions in perf_evlist that came
tools/perf/builtin-report.c +2 -2
@@ -320,7 +320,7 @@ static int perf_evlist__tty_browse_hists(struct perf_evlist *evlist,const char *evname =perf_evsel__name (pos);hists__fprintf_nr_sample_events (hists, evname, stdout); -hists__fprintf (hists,NULL , false, true,0 ,0 , stdout); +hists__fprintf (hists, true,0 ,0 , stdout);fprintf (stdout,"\n\n" ); }
@@ -691,7 +691,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)setup_browser (true); else { use_browser =0 ; -perf_hpp__init (false, false); +perf_hpp__init (); }setup_sorting (report_usage, options);
tools/perf/builtin-sched.c +1 -1
@@ -1426,7 +1426,7 @@ static int perf_sched__process_tracepoint_sample(struct perf_tool *tool __maybe_struct perf_evsel *evsel, struct machine *machine) { - struct thread *thread = machine__findnew_thread(machine, sample->pid); + struct thread *thread = machine__findnew_thread(machine, sample->tid);int err =0 ;if (thread ==NULL ) {
tools/perf/builtin-script.c +42 -48
132 lines not on this page · raw message
tools/perf/builtin-stat.c +159 -169
377 lines not on this page · raw message
tools/perf/builtin-timechart.c +41 -59
57 lines not on this page · raw message
tools/perf/builtin-trace.c +82 -52
134 lines not on this page · raw message
tools/perf/ui/hist.c +91 -54
145 lines not on this page · raw message
tools/perf/ui/stdio/hist.c +16 -29
45 lines not on this page · raw message
tools/perf/util/evlist.c +10 -78
88 lines not on this page · raw message
tools/perf/util/hist.c +42 -24
66 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
Quoted 7 lines · Ingo Molnar
Linus,
Please pull the latest perf-urgent-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus HEAD: 95cf59ea72331d0093010543b8951bb43f262cac perf: Fix perf_cgroup_switch for sw-events
Note that if you merge it then there's a new semantic conflict with recent rbtree.c changes in your tree, causing a tools/perf/ build failure:
../../lib/rbtree.c:24:36: fatal error: linux/rbtree_augmented.h: No such file or directory compilation terminated.
See the fix below.
( If the __maybe_unused annotations are too ugly for
lib/rbtree.c then we'll fix that in tools/perf in a cleaner way, weakening the compiler checks for the rbtree build. We are using stronger compiler checks in tools/perf/, which has served us very well so far and is a big net win - the price is the occasional extra annotation of dummy inline function parameters. )
Thanks,
Ingo
--- lib/rbtree.c | 7 ++++--- tools/perf/util/include/linux/rbtree_augmented.h | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-)
lib/rbtree.c +4 -3
@@ -22,6 +22,7 @@*/ #include <linux/rbtree_augmented.h> +#include <linux/compiler.h> #include <linux/export.h> /*
@@ -364,9 +365,9 @@ EXPORT_SYMBOL(__rb_erase_color);* out of the rb_insert_color() and rb_erase() function definitions. */ -static inline void dummy_propagate (struct rb_node *node,struct rb_node *stop) {} -static inline void dummy_copy (struct rb_node *old,struct rb_node *new) {} -static inline void dummy_rotate (struct rb_node *old,struct rb_node *new) {} +static inline void dummy_propagate (struct rb_node *node__maybe_unused ,struct rb_node *stop__maybe_unused ) {} +static inline void dummy_copy (struct rb_node *old__maybe_unused ,struct rb_node *new__maybe_unused ) {} +static inline void dummy_rotate (struct rb_node *old__maybe_unused ,struct rb_node *new__maybe_unused ) {}static const struct rb_augment_callbacks dummy_callbacks = { dummy_propagate, dummy_copy, dummy_rotate
tools/perf/util/include/linux/rbtree_augmented.h new file +2 -0
@@ -0,0 +1,2 @@ +#include <stdbool.h> +#include "../../../../include/linux/rbtree_augmented.h"
Borislav Petkov
maintainerQuoted 19 lines · Ingo Molnar
Quoted 7 lines · Ingo Molnar
Linus,
Please pull the latest perf-urgent-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus HEAD: 95cf59ea72331d0093010543b8951bb43f262cac perf: Fix perf_cgroup_switch for sw-eventsNote that if you merge it then there's a new semantic conflict with recent
rbtree.cchanges in your tree, causing atools/perf/build failure:
../../lib/rbtree.c:24:36: fatal error:linux/rbtree_augmented.h: No such file or directory compilation terminated.See the fix below.
Quoted 7 lines
( If the
__maybe_unusedannotations are too ugly for
lib/rbtree.cthen we'll fix that intools/perfin a cleaner way, weakening the compiler checks for the rbtree build. We are using stronger compiler checks intools/perf/, which has served us very well so far and is a big net win - the price is the occasional extra annotation of dummy inline function parameters. )
Btw,
Markus fixed it that way recently:
http://marc.info/?l=linux-kernel&m=134980573527738
by adding the -Wno-unused-parameter switch only to lib/rbtree.o when built from within perf.
I see now though that his patch has some unrelated changes to trace-event-perl.c's permissions which shouldn't be there.
Signature · 2 lines
Regards/Gruss, Boris.
Ingo Molnar
Acked-byQuoted 32 lines · Borislav Petkov
Quoted 19 lines · Ingo Molnar
Quoted 7 lines · Ingo Molnar
Linus,
Please pull the latest perf-urgent-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus HEAD: 95cf59ea72331d0093010543b8951bb43f262cac perf: Fix perf_cgroup_switch for sw-eventsNote that if you merge it then there's a new semantic conflict with recent
rbtree.cchanges in your tree, causing atools/perf/build failure:
../../lib/rbtree.c:24:36: fatal error:linux/rbtree_augmented.h: No such file or directory compilation terminated.See the fix below.
Quoted 7 lines
( If the
__maybe_unusedannotations are too ugly for
lib/rbtree.cthen we'll fix that intools/perfin a cleaner way, weakening the compiler checks for the rbtree build. We are using stronger compiler checks intools/perf/, which has served us very well so far and is a big net win - the price is the occasional extra annotation of dummy inline function parameters. )Btw,
Markus fixed it that way recently:
Quoted 7 lines
http://marc.info/?l=linux-kernel&m=134980573527738
by adding the -Wno-unused-parameter switch only to
lib/rbtree.owhen built from within perf.I see now though that his patch has some unrelated changes to trace-event-perl.c's permissions which shouldn't be there.
Yes, that final hunk should be removed. Other than that, Markus's solution is fine to me too:
Thanks,
Ingo
PATCH 1/1 perf: Handle new rbtree implementation
Quoted 1 line
From
6c4d077c467d689b5dd2f89cc69713f1bf4e31d7Mon Sep 17 00:00:00 2001
From: Markus Trippelsdorf <[email protected]>
Date: Tue, 9 Oct 2012 20:01:56 +0200
Subject: [PATCH] perf: Handle new rbtree implementation
Perf build fails with the new rbtree implementation:
../../lib/rbtree.c:24:36: fatal error: linux/rbtree_augmented.h: No such file or directory compilation terminated.
Fix by updating the Makefile and adding a btree_augmented.h wrapper.
--- tools/perf/Makefile | 3 ++- tools/perf/util/include/linux/rbtree_augmented.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-)
tools/perf/Makefile +2 -1
@@ -270,6 +270,7 @@ LIB_H += util/include/linux/magic.h LIB_H += util/include/linux/poison.h LIB_H += util/include/linux/prefetch.h LIB_H += util/include/linux/rbtree.h +LIB_H += util/include/linux/rbtree_augmented.h LIB_H += util/include/linux/string.h LIB_H += util/include/linux/types.h LIB_H += util/include/linux/linkage.h
@@ -881,7 +882,7 @@ $(OUTPUT)ui/browsers/map.o: ui/browsers/map.c $(OUTPUT)PERF-CFLAGS $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $< $(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< + $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Wno-unused-parameter -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< $(OUTPUT)util/parse-events.o: util/parse-events.c $(OUTPUT)PERF-CFLAGS $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Wno-redundant-decls $<
tools/perf/util/include/linux/rbtree_augmented.h new file +2 -0
@@ -0,0 +1,2 @@ +#include <stdbool.h> +#include "../../../../include/linux/rbtree_augmented.h"
Quoted 32 lines · Borislav Petkov
Quoted 19 lines · Ingo Molnar
Quoted 7 lines · Ingo Molnar
Linus,
Please pull the latest perf-urgent-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus HEAD: 95cf59ea72331d0093010543b8951bb43f262cac perf: Fix perf_cgroup_switch for sw-eventsNote that if you merge it then there's a new semantic conflict with recent
rbtree.cchanges in your tree, causing atools/perf/build failure:
../../lib/rbtree.c:24:36: fatal error:linux/rbtree_augmented.h: No such file or directory compilation terminated.See the fix below.
Quoted 7 lines
( If the
__maybe_unusedannotations are too ugly for
lib/rbtree.cthen we'll fix that intools/perfin a cleaner way, weakening the compiler checks for the rbtree build. We are using stronger compiler checks intools/perf/, which has served us very well so far and is a big net win - the price is the occasional extra annotation of dummy inline function parameters. )Btw,
Markus fixed it that way recently:
Quoted 7 lines
http://marc.info/?l=linux-kernel&m=134980573527738
by adding the -Wno-unused-parameter switch only to
lib/rbtree.owhen built from within perf.I see now though that his patch has some unrelated changes to trace-event-perl.c's permissions which shouldn't be there.
Yes that was part of a different issue:
CC util/scripting-engines/trace-event-perl.outil/scripting-engines/trace-event-perl.c: In function ‘perl_process_tracepoint’:util/scripting-engines/trace-event-perl.c:285:3: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘__u64’ [-Werror=format]
die("ug! no event found for type %" PRIu64, evsel->attr.config);
^
cc1: all warnings being treated as errors
Which I fixed locally like this:
tools/perf/util/scripting-engines/trace-event-perl.c +1 -1
@@ -282,7 +282,7 @@ static void perl_process_tracepoint(union perf_event *perf_event __maybe_unused, event =find_cache_event (evsel);if (!event) -die ("ug! no event found for type %" PRIu64, evsel->attr.config); +die ("ug! no event found for type %" PRIu64, (unsigned long )evsel->attr.config); pid =raw_field_value (event,"common_pid" , data);
Signature · 1 line
Markus