perf/core improvements and fixes
Subsystems (2)
Arnaldo Carvalho de Melo
maintainerPATCH 4/31 perf cpumap: Factor out functions to get core_id and socket_id
In reply to Arnaldo Carvalho de MeloFrom: Kan Liang <[email protected]>
This patch moves the code which reads core_id and socket_id into separate functions.
--- tools/perf/util/cpumap.c | 51 +++++++++++++++++++++++++++++++----------------- tools/perf/util/cpumap.h | 2 ++ 2 files changed, 35 insertions(+), 18 deletions(-)
tools/perf/util/cpumap.c +33 -18
@@ -225,17 +225,12 @@ void cpu_map__put(struct cpu_map *map)cpu_map__delete (map); } -int cpu_map__get_socket (struct cpu_map *map,int idx) +int cpu_map__get_socket_id (int cpu) {FILE *fp;const char *mnt;char path[PATH_MAX ]; -int cpu, ret; - -if (idx > map->nr) -return -1 ; - - cpu = map->map[idx]; +int socket_id, ret; mnt =sysfs__mountpoint ();if (!mnt)
@@ -248,9 +243,22 @@ int cpu_map__get_socket(struct cpu_map *map, int idx) fp =fopen (path,"r" );if (!fp)return -1 ; - ret =fscanf (fp,"%d" , &cpu); + ret =fscanf (fp,"%d" , &socket_id);fclose (fp); -return ret ==1 ? cpu :-1 ; + +return ret ==1 ? socket_id :-1 ; +} + +int cpu_map__get_socket (struct cpu_map *map,int idx) +{ +int cpu; + +if (idx > map->nr) +return -1 ; + + cpu = map->map[idx]; + +return cpu_map__get_socket_id (cpu); }static int cmp_ids (const void *a,const void *b)
@@ -289,17 +297,12 @@ static int cpu_map__build_map(struct cpu_map *cpus, struct cpu_map **res,return 0 ; } -int cpu_map__get_core (struct cpu_map *map,int idx) +int cpu_map__get_core_id (int cpu) {FILE *fp;const char *mnt;char path[PATH_MAX ]; -int cpu, ret, s; - -if (idx > map->nr) -return -1 ; - - cpu = map->map[idx]; +int core_id, ret; mnt =sysfs__mountpoint ();if (!mnt)
@@ -312,11 +315,23 @@ int cpu_map__get_core(struct cpu_map *map, int idx) fp =fopen (path,"r" );if (!fp)return -1 ; - ret =fscanf (fp,"%d" , &cpu); + ret =fscanf (fp,"%d" , &core_id);fclose (fp); -if (ret !=1 ) + +return ret ==1 ? core_id :-1 ; +} + +int cpu_map__get_core (struct cpu_map *map,int idx) +{ +int cpu, s; + +if (idx > map->nr)return -1 ; + cpu = map->map[idx]; + + cpu =cpu_map__get_core_id (cpu); + s =cpu_map__get_socket (map, idx);if (s ==-1 )return -1 ;
tools/perf/util/cpumap.h +2 -0
@@ -18,7 +18,9 @@ struct cpu_map *cpu_map__new(const char *cpu_list);struct cpu_map *cpu_map__dummy_new (void );struct cpu_map *cpu_map__read (FILE *file);size_t cpu_map__fprintf (struct cpu_map *map,FILE *fp); +int cpu_map__get_socket_id (int cpu);int cpu_map__get_socket (struct cpu_map *map,int idx); +int cpu_map__get_core_id (int cpu);int cpu_map__get_core (struct cpu_map *map,int idx);int cpu_map__build_socket_map (struct cpu_map *cpus,struct cpu_map **sockp);int cpu_map__build_core_map (struct cpu_map *cpus,struct cpu_map **corep);
Signature · 1 line
2.1.0
Arnaldo Carvalho de Melo
maintainerPATCH 1/31 perf tools: Always use non inlined file name for 'srcfile' sort key
In reply to Arnaldo Carvalho de MeloFrom: Andi Kleen <[email protected]>
When profiling the kernel with the 'srcfile' sort key it's common to "get stuck" in include. For example a lot of code uses current or other inlines, so they get accounted to some random include file. This is not very useful as a high level categorization.
For example just profiling the idle loop usually shows mostly inlines, so you never see the actual cpuidle file.
This patch changes the 'srcfile' sort key to always unwind the inline stack using BFD/DWARF. So we always account to the base function that called the inline.
In a few cases include is still shown (for example for MSR accesses), but that is because they get inlining expanded as part of assigning to a global function pointer. For the majority it works fine though.
v2: Use simpler while loop. Add maximum iteration count.
--- tools/perf/util/sort.c | 4 ++-- tools/perf/util/srcline.c | 29 ++++++++++++++++++++++++----- tools/perf/util/util.h | 2 ++ 3 files changed, 28 insertions(+), 7 deletions(-)
tools/perf/util/sort.c +2 -2
@@ -328,8 +328,8 @@ static char *get_srcfile(struct hist_entry *e)char *sf, *p;struct map *map = e->ms.map; - sf =get_srcline (map->dso,map__rip_2objdump (map, e->ip), - e->ms.sym, true); + sf =__get_srcline (map->dso,map__rip_2objdump (map, e->ip), + e->ms.sym, false, true);if (!strcmp (sf,SRCLINE_UNKNOWN ))return no_srcfile; p =strchr (sf,':' );
tools/perf/util/srcline.c +24 -5
@@ -149,8 +149,11 @@ static void addr2line_cleanup(struct a2l_data *a2l)free (a2l); } +#define MAX_INLINE_NEST 1024 +static int addr2line (const char *dso_name,u64 addr, -char **file,unsigned int *line,struct dso *dso) +char **file,unsigned int *line,struct dso *dso, +bool unwind_inlines) {int ret =0 ;struct a2l_data *a2l = dso->a2l;
@@ -170,6 +173,15 @@ static int addr2line(const char *dso_name, u64 addr,bfd_map_over_sections (a2l->abfd, find_address_in_section, a2l); +if (a2l->found && unwind_inlines) { +int cnt =0 ; + +while (bfd_find_inliner_info (a2l->abfd, &a2l->filename, + &a2l->funcname, &a2l->line) && + cnt++ <MAX_INLINE_NEST ) + ; + } +if (a2l->found && a2l->filename) { *file =strdup (a2l->filename); *line = a2l->line;
@@ -197,7 +209,8 @@ void dso__free_a2l(struct dso *dso)static int addr2line (const char *dso_name,u64 addr,char **file,unsigned int *line_nr, -struct dso *dso__maybe_unused ) +struct dso *dso__maybe_unused , +bool unwind_inlines__maybe_unused ) {FILE *fp;char cmd[PATH_MAX ];
@@ -254,8 +267,8 @@ void dso__free_a2l(struct dso *dso __maybe_unused)*/ #define A2L_FAIL_LIMIT 123 -char *get_srcline (struct dso *dso,u64 addr,struct symbol *sym, -bool show_sym) +char *__get_srcline (struct dso *dso,u64 addr,struct symbol *sym, +bool show_sym,bool unwind_inlines) {char *file =NULL ;unsigned line =0 ;
@@ -276,7 +289,7 @@ char *get_srcline(struct dso *dso, u64 addr, struct symbol *sym,if (!strncmp (dso_name,"/tmp/perf-" ,10 )) goto out; -if (!addr2line (dso_name, addr, &file, &line, dso)) +if (!addr2line (dso_name, addr, &file, &line, dso, unwind_inlines)) goto out; if (asprintf(&srcline, "%s:%u",
@@ -310,3 +323,9 @@ void free_srcline(char *srcline)if (srcline &&strcmp (srcline,SRCLINE_UNKNOWN ) !=0 )free (srcline); } + +char *get_srcline (struct dso *dso,u64 addr,struct symbol *sym, +bool show_sym) +{ +return __get_srcline (dso, addr, sym, show_sym, false); +}
tools/perf/util/util.h +2 -0
@@ -321,6 +321,8 @@ struct symbol;extern bool srcline_full_filename;char *get_srcline (struct dso *dso,u64 addr,struct symbol *sym,bool show_sym); +char *__get_srcline (struct dso *dso,u64 addr,struct symbol *sym, +bool show_sym,bool unwind_inlines);void free_srcline (char *srcline);int filename__read_str (const char *filename,char **buf,size_t *sizep);
Signature · 1 line
2.1.0
Arnaldo Carvalho de Melo
maintainerPATCH 7/31 perf tools: Remove mountpoint arg from perf_debugfs_mount
In reply to Arnaldo Carvalho de MeloFrom: Jiri Olsa <[email protected]>
It's not used by any caller. We either detect the mountpoint or use hardcoded one.
--- tools/perf/perf.c | 2 +- tools/perf/util/util.c | 14 +++++++------- tools/perf/util/util.h | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-)
tools/perf/perf.c +1 -1
@@ -518,7 +518,7 @@ int main(int argc, const char **argv)if (!cmd) cmd ="perf-help" ;/* get debugfs mount point from /proc/mounts */ -perf_debugfs_mount (NULL ); +perf_debugfs_mount ();/* * "perf-xxxx" is the same as "perf xxxx", but we obviously: *
tools/perf/util/util.c +7 -7
@@ -398,11 +398,11 @@ static void set_tracing_events_path(const char *tracing, const char *mountpoint) mountpoint, tracing, "events"); } -static const char *__perf_tracefs_mount (const char *mountpoint) +static const char *__perf_tracefs_mount (void ) {const char *mnt; - mnt =tracefs_mount (mountpoint); + mnt =tracefs_mount (NULL );if (!mnt)return NULL ;
@@ -411,11 +411,11 @@ static const char *__perf_tracefs_mount(const char *mountpoint)return mnt; } -static const char *__perf_debugfs_mount (const char *mountpoint) +static const char *__perf_debugfs_mount (void ) {const char *mnt; - mnt =debugfs_mount (mountpoint); + mnt =debugfs_mount (NULL );if (!mnt)return NULL ;
@@ -424,15 +424,15 @@ static const char *__perf_debugfs_mount(const char *mountpoint)return mnt; } -const char *perf_debugfs_mount (const char *mountpoint) +const char *perf_debugfs_mount (void ) {const char *mnt; - mnt =__perf_tracefs_mount (mountpoint); + mnt =__perf_tracefs_mount ();if (mnt)return mnt; - mnt =__perf_debugfs_mount (mountpoint); + mnt =__perf_debugfs_mount ();return mnt; }
tools/perf/util/util.h +1 -1
@@ -86,7 +86,7 @@ extern char buildid_dir[];extern char tracing_path[];extern char tracing_events_path[];extern void perf_debugfs_set_path (const char *mountpoint); -const char *perf_debugfs_mount (const char *mountpoint); +const char *perf_debugfs_mount (void );char *get_tracing_file (const char *name);void put_tracing_file (char *file);
Signature · 1 line
2.1.0
Arnaldo Carvalho de Melo
maintainerPATCH 25/31 perf intel-pt: Add support for PERF_RECORD_SWITCH
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
Add support for selecting and processing PERF_RECORD_SWITCH events for use by Intel PT. If they are available, they will be used in preference to sched_switch events.
This enables an unprivileged user to trace multi-threaded or multi-process workloads with any level of perf_event_paranoid. However it depends on kernel support for PERF_RECORD_SWITCH.
Without this patch, tracing a multi-threaded workload will decode without error but all the data will be attributed to the main thread.
Without this patch, tracing a multi-process workload will result in decoder errors because the decoder will not know which executable is executing.
--- tools/perf/arch/x86/util/intel-pt.c | 55 ++++++++++++--- tools/perf/util/intel-pt.c | 129 +++++++++++++++++++++++++++++------- 2 files changed, 151 insertions(+), 33 deletions(-)
tools/perf/arch/x86/util/intel-pt.c +47 -8
@@ -624,13 +624,49 @@ static int intel_pt_recording_options(struct auxtrace_record *itr,* threads. */ if (have_timing_info && !cpu_map__empty (cpus)) { - err =intel_pt_track_switches (evlist); -if (err == -EPERM ) -pr_debug2 ("Unable to select sched:sched_switch\n" ); -else if (err) -return err; -else - ptr->have_sched_switch =1 ; +if (perf_can_record_switch_events ()) { +bool cpu_wide = !target__none (&opts->target) && + !target__has_task (&opts->target); + +if (!cpu_wide &&perf_can_record_cpu_wide ()) { +struct perf_evsel *switch_evsel; + + err =parse_events (evlist,"dummy:u" ,NULL ); +if (err) +return err; + + switch_evsel =perf_evlist__last (evlist); + + switch_evsel->attr.freq =0 ; + switch_evsel->attr.sample_period =1 ; + switch_evsel->attr.context_switch =1 ; + + switch_evsel->system_wide = true; + switch_evsel->no_aux_samples = true; + switch_evsel->immediate = true; + +perf_evsel__set_sample_bit (switch_evsel,TID ); +perf_evsel__set_sample_bit (switch_evsel,TIME ); +perf_evsel__set_sample_bit (switch_evsel,CPU ); + + opts->record_switch_events = false; + ptr->have_sched_switch =3 ; + }else { + opts->record_switch_events = true; +if (cpu_wide) + ptr->have_sched_switch =3 ; +else + ptr->have_sched_switch =2 ; + } + }else { + err =intel_pt_track_switches (evlist); +if (err == -EPERM ) +pr_debug2 ("Unable to select sched:sched_switch\n" ); +else if (err) +return err; +else + ptr->have_sched_switch =1 ; + } }if (intel_pt_evsel) {
@@ -663,8 +699,11 @@ static int intel_pt_recording_options(struct auxtrace_record *itr, tracking_evsel->attr.sample_period =1 ;/* In per-cpu case, always need the time of mmap events etc */ -if (!cpu_map__empty (cpus)) +if (!cpu_map__empty (cpus)) {perf_evsel__set_sample_bit (tracking_evsel,TIME ); +/* And the CPU for switch events */ +perf_evsel__set_sample_bit (tracking_evsel,CPU ); + } }/*
tools/perf/util/intel-pt.c +104 -25
200 lines not on this page · raw message
Signature · 1 line
2.1.0
Arnaldo Carvalho de Melo
maintainerPATCH 17/31 perf tools: Display build warning if x86 instruction decoder differs from kernel
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
perf tools has a copy of the x86 instruction decoder used by the kernel. The expectation is that the copy will be kept more-or-less in-synch with the kernel version. Consequently it is helpful to know if there are differences.
This patch adds a check into the perf tools build so that a diff is done on the sources, and a warning is printed if they are different. Note that the warning is not fatal and the build continues as normal.
The check is done as part of building the instruction decoder, so, like a compiler warning, it is not seen unless the instruction decoder has to be re-compiled. e.g.
$ make -C tools/perf >/dev/null $ echo "/* blah */" >> tools/perf/util/intel-pt-decoder/inat_types.h $ make -C tools/perf >/dev/null Warning: Intel PT: x86 instruction decoder differs from kernel $ make -C tools/perf >/dev/null $
--- tools/perf/util/intel-pt-decoder/Build | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
tools/perf/util/intel-pt-decoder/Build +12 -1
@@ -7,6 +7,17 @@ $(OUTPUT)util/intel-pt-decoder/inat-tables.c: $(inat_tables_script) $(inat_table $(call rule_mkdir) @$(call echo-cmd,gen)$(AWK) -f $(inat_tables_script) $(inat_tables_maps) > $@ || rm -f $@ -$(OUTPUT)util/intel-pt-decoder/intel-pt-insn-decoder.o: util/intel-pt-decoder/inat.c $(OUTPUT)util/intel-pt-decoder/inat-tables.c +$(OUTPUT)util/intel-pt-decoder/intel-pt-insn-decoder.o: util/intel-pt-decoder/intel-pt-insn-decoder.c util/intel-pt-decoder/inat.c $(OUTPUT)util/intel-pt-decoder/inat-tables.c + @(test -d ../../kernel -a -d ../../tools -a -d ../perf && (( \ + diff -B -I'^#include' util/intel-pt-decoder/insn.c ../../arch/x86/lib/insn.c >/dev/null && \ + diff -B -I'^#include' util/intel-pt-decoder/inat.c ../../arch/x86/lib/inat.c >/dev/null && \ + diff -B util/intel-pt-decoder/x86-opcode-map.txt ../../arch/x86/lib/x86-opcode-map.txt >/dev/null && \ + diff -B util/intel-pt-decoder/gen-insn-attr-x86.awk ../../arch/x86/tools/gen-insn-attr-x86.awk >/dev/null && \ + diff -B -I'^#include' util/intel-pt-decoder/insn.h ../../arch/x86/include/asm/insn.h >/dev/null && \ + diff -B -I'^#include' util/intel-pt-decoder/inat.h ../../arch/x86/include/asm/inat.h >/dev/null && \ + diff -B -I'^#include' util/intel-pt-decoder/inat_types.h ../../arch/x86/include/asm/inat_types.h >/dev/null) \ + || echo "Warning: Intel PT: x86 instruction decoder differs from kernel" >&2 )) || true + $(call rule_mkdir) + $(call if_changed_dep,cc_o_c) CFLAGS_intel-pt-insn-decoder.o += -I$(OUTPUT)util/intel-pt-decoder -Wno-override-init
Signature · 1 line
2.1.0
Arnaldo Carvalho de Melo
maintainerPATCH 19/31 x86/insn: perf tools: Pedantically tweak opcode map for MPX instructions
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
The MPX instructions are presently not described in the SDM opcode maps, and there are not encoding characters for bnd registers, address method or operand type. So the kernel opcode map is using 'Gv' for bnd registers and 'Ev' for everything else. That is fine because the instruction decoder does not use that information anyway, except as an indication that there is a ModR/M byte.
Nevertheless, in some cases the 'Gv' and 'Ev' are the wrong way around, BNDLDX and BNDSTX have 2 operands not 3, and it wouldn't hurt to identify the mandatory prefixes.
This has no effect on the decoding of valid instructions, but the addition of the mandatory prefixes will cause some invalid instructions to error out that wouldn't have previously.
Note that perf tools has a copy of the instruction decoder and provides a test for new instructions which includes MPX instructions e.g.
$ perf test "x86 ins" 39: Test x86 instruction decoder - new instructions : Ok
Or to see the details:
$ perf test -v "x86 ins"
Commiter notes:
And to see these MPX instructions specifically:
$ perf test -v "x86 ins" 2>&1 | grep bndldx | head -3 Decoded ok: 0f 1a 00 bndldx (%eax),%bnd0 Decoded ok: 0f 1a 05 78 56 34 12 bndldx 0x12345678,%bnd0 Decoded ok: 0f 1a 18 bndldx (%eax),%bnd3 $ perf test -v "x86 ins" 2>&1 | grep bndstx | head -3 Decoded ok: 0f 1b 00 bndstx %bnd0,(%eax) Decoded ok: 0f 1b 05 78 56 34 12 bndstx %bnd0,0x12345678 Decoded ok: 0f 1b 18 bndstx %bnd3,(%eax) $
--- arch/x86/lib/x86-opcode-map.txt | 8 ++++++-- tools/perf/util/intel-pt-decoder/x86-opcode-map.txt | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-)
arch/x86/lib/x86-opcode-map.txt +6 -2
@@ -353,8 +353,12 @@ AVXcode: 1 17: vmovhps Mq,Vq (v1) | vmovhpd Mq,Vq (66),(v1) 18: Grp16 (1A) 19: -1a: BNDCL Ev,Gv | BNDCU Ev,Gv | BNDMOV Gv,Ev | BNDLDX Gv,Ev,Gv -1b: BNDCN Ev,Gv | BNDMOV Ev,Gv | BNDMK Gv,Ev | BNDSTX Ev,GV,Gv +# Intel SDM opcode map does not list MPX instructions. For now using Gv for +# bnd registers and Ev for everything else is OK because the instruction +# decoder does not use the information except as an indication that there is +# a ModR/M byte. +1a: BNDCL Gv,Ev (F3) | BNDCU Gv,Ev (F2) | BNDMOV Gv,Ev (66) | BNDLDX Gv,Ev +1b: BNDCN Gv,Ev (F2) | BNDMOV Ev,Gv (66) | BNDMK Gv,Ev (F3) | BNDSTX Ev,Gv 1c: 1d: 1e:
tools/perf/util/intel-pt-decoder/x86-opcode-map.txt +6 -2
@@ -353,8 +353,12 @@ AVXcode: 1 17: vmovhps Mq,Vq (v1) | vmovhpd Mq,Vq (66),(v1) 18: Grp16 (1A) 19: -1a: BNDCL Ev,Gv | BNDCU Ev,Gv | BNDMOV Gv,Ev | BNDLDX Gv,Ev,Gv -1b: BNDCN Ev,Gv | BNDMOV Ev,Gv | BNDMK Gv,Ev | BNDSTX Ev,GV,Gv +# Intel SDM opcode map does not list MPX instructions. For now using Gv for +# bnd registers and Ev for everything else is OK because the instruction +# decoder does not use the information except as an indication that there is +# a ModR/M byte. +1a: BNDCL Gv,Ev (F3) | BNDCU Gv,Ev (F2) | BNDMOV Gv,Ev (66) | BNDLDX Gv,Ev +1b: BNDCN Gv,Ev (F2) | BNDMOV Ev,Gv (66) | BNDMK Gv,Ev (F3) | BNDSTX Ev,Gv 1c: 1d: 1e:
Signature · 1 line
2.1.0
Arnaldo Carvalho de Melo
maintainerPATCH 14/31 tools lib api fs: Add tracefs into fs.c object
In reply to Arnaldo Carvalho de MeloFrom: Jiri Olsa <[email protected]>
Adding tracefs support into fs.c framework. It'll replace the tracefs object functionality in following patches.
--- tools/lib/api/fs/fs.c | 28 ++++++++++++++++++++++++++++ tools/lib/api/fs/fs.h | 1 + 2 files changed, 29 insertions(+)
tools/lib/api/fs/fs.c +28 -0
@@ -28,6 +28,10 @@#define DEBUGFS_MAGIC 0x64626720#endif +#ifndef TRACEFS_MAGIC +#define TRACEFS_MAGIC 0x74726163 +#endif +static const char *const sysfs__fs_known_mountpoints[] = {"/sys" ,0 ,
@@ -48,6 +52,19 @@ static const char * const debugfs__known_mountpoints[] = { 0, }; + +#ifndef TRACEFS_DEFAULT_PATH +#define TRACEFS_DEFAULT_PATH "/sys/kernel/tracing" +#endif + +static const char *const tracefs__known_mountpoints[] = { +TRACEFS_DEFAULT_PATH , +"/sys/kernel/debug/tracing" , +"/tracing" , +"/trace" , +0 , +}; +struct fs {const char *name;const char *const *mounts;
@@ -60,8 +77,13 @@ enum {FS__SYSFS =0 ,FS__PROCFS =1 ,FS__DEBUGFS =2 , + FS__TRACEFS = 3, }; +#ifndef TRACEFS_MAGIC +#define TRACEFS_MAGIC 0x74726163 +#endif +static struct fs fs__entries[] = { [FS__SYSFS ] = { .name ="sysfs" ,
@@ -78,6 +100,11 @@ static struct fs fs__entries[] = { .mounts = debugfs__known_mountpoints, .magic = DEBUGFS_MAGIC, }, + [FS__TRACEFS] = { + .name = "tracefs", + .mounts = tracefs__known_mountpoints, + .magic = TRACEFS_MAGIC, + }, };static bool fs__read_mounts (struct fs *fs)
@@ -197,6 +224,7 @@ const char *name##__mountpoint(void) \FS__MOUNTPOINT (sysfs,FS__SYSFS );FS__MOUNTPOINT (procfs,FS__PROCFS );FS__MOUNTPOINT (debugfs,FS__DEBUGFS ); +FS__MOUNTPOINT (tracefs,FS__TRACEFS );int filename__read_int (const char *filename,int *value) {
tools/lib/api/fs/fs.h +1 -0
@@ -12,6 +12,7 @@const char *sysfs__mountpoint (void );const char *procfs__mountpoint (void );const char *debugfs__mountpoint (void ); +const char *tracefs__mountpoint (void );int filename__read_int (const char *filename,int *value);int sysctl__read_int (const char *sysctl,int *value);
Signature · 1 line
2.1.0
Arnaldo Carvalho de Melo
maintainerPATCH 26/31 perf probe: Split add_perf_probe_events()
In reply to Arnaldo Carvalho de MeloFrom: Namhyung Kim <[email protected]>
The add_perf_probe_events() does 3 things:
1. convert all perf events to trace events
2. add all trace events to kernel
3. cleanup all trace events
But sometimes we need to do something with the trace events. So split the funtion into three, so that it can access intermediate trace events via struct __event_package if needed.
--- tools/perf/util/probe-event.c | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-)
tools/perf/util/probe-event.c +35 -4
@@ -2765,9 +2765,10 @@ struct __event_package {int ntevs; }; -int add_perf_probe_events (struct perf_probe_event *pevs,int npevs) +static int convert_perf_probe_events (struct perf_probe_event *pevs,int npevs, +struct __event_package **ppkgs) { -int i, j, ret; +int i, ret;struct __event_package *pkgs; ret =0 ;
@@ -2792,12 +2793,21 @@ int add_perf_probe_events(struct perf_probe_event *pevs, int npevs) ret =convert_to_probe_trace_events (pkgs[i].pev, &pkgs[i].tevs);if (ret <0 ) - goto end; +return ret; pkgs[i].ntevs = ret; }/* This just release blacklist only if allocated */ kprobe_blacklist__release (); + *ppkgs = pkgs; + +return 0 ; +} + +static int apply_perf_probe_events (struct __event_package *pkgs,int npevs) +{ +int i, ret =0 ; +/* Loop 2: add all events */ for (i =0 ; i < npevs; i++) { ret = __add_probe_trace_events(pkgs[i].pev, pkgs[i].tevs,
@@ -2806,7 +2816,16 @@ int add_perf_probe_events(struct perf_probe_event *pevs, int npevs)if (ret <0 )break ; } -end: +return ret; +} + +static void cleanup_perf_probe_events (struct __event_package *pkgs,int npevs) +{ +int i, j; + +if (pkgs ==NULL ) +return ; +/* Loop 3: cleanup and free trace events */ for (i =0 ; i < npevs; i++) {for (j =0 ; j < pkgs[i].ntevs; j++)
@@ -2815,6 +2834,18 @@ end: }free (pkgs);exit_symbol_maps (); +} + +int add_perf_probe_events (struct perf_probe_event *pevs,int npevs) +{ +int ret; +struct __event_package *pkgs =NULL ; + + ret =convert_perf_probe_events (pevs, npevs, &pkgs); +if (ret ==0 ) + ret =apply_perf_probe_events (pkgs, npevs); + +cleanup_perf_probe_events (pkgs, npevs);return ret; }
Signature · 1 line
2.1.0
Arnaldo Carvalho de Melo
maintainerPATCH 27/31 perf probe: Link trace_probe_event into perf_probe_event
In reply to Arnaldo Carvalho de MeloFrom: Wang Nan <[email protected]>
This patch drops struct __event_package structure. Instead, it adds a 'struct trace_probe_event' pointer to 'struct perf_probe_event'.
The trace_probe_event information gives further patches a chance to access actual probe points and actual arguments.
Using them, 'perf probe' can get the whole list of added probes and print them at once.
Other users like the upcoming bpf_loader will be able to attach one bpf program to different probing points of an inline function (which has multiple probing points) and glob functions.
Moreover, by reading the arguments information, bpf code for reading those arguments can be generated.
--- tools/perf/util/probe-event.c | 57 +++++++++++++------------------------------ tools/perf/util/probe-event.h | 5 ++++ 2 files changed, 22 insertions(+), 40 deletions(-)
tools/perf/util/probe-event.c +17 -40
@@ -2759,59 +2759,39 @@ static int convert_to_probe_trace_events(struct perf_probe_event *pev,return find_probe_trace_events_from_map (pev, tevs); } -struct __event_package { -struct perf_probe_event *pev; -struct probe_trace_event *tevs; -int ntevs; -}; - -static int convert_perf_probe_events (struct perf_probe_event *pevs,int npevs, -struct __event_package **ppkgs) +int convert_perf_probe_events (struct perf_probe_event *pevs,int npevs) {int i, ret; -struct __event_package *pkgs; - - ret =0 ; - pkgs =zalloc (sizeof (struct __event_package ) * npevs); - -if (pkgs ==NULL ) -return -ENOMEM ; ret =init_symbol_maps (pevs->uprobes); -if (ret <0 ) { -free (pkgs); +if (ret <0 )return ret; - }/* Loop 1: convert all events */ for (i =0 ; i < npevs; i++) { - pkgs[i].pev = &pevs[i];/* Init kprobe blacklist if needed */ -if (!pkgs[i].pev->uprobes) +if (!pevs[i].uprobes)kprobe_blacklist__init ();/* Convert with or without debuginfo */ - ret =convert_to_probe_trace_events (pkgs[i].pev, - &pkgs[i].tevs); + ret =convert_to_probe_trace_events (&pevs[i], &pevs[i].tevs);if (ret <0 )return ret; - pkgs[i].ntevs = ret; + pevs[i].ntevs = ret; }/* This just release blacklist only if allocated */ kprobe_blacklist__release (); - *ppkgs = pkgs; -return 0 ; } -static int apply_perf_probe_events (struct __event_package *pkgs,int npevs) +int apply_perf_probe_events (struct perf_probe_event *pevs,int npevs) {int i, ret =0 ;/* Loop 2: add all events */ for (i =0 ; i < npevs; i++) { - ret =__add_probe_trace_events (pkgs[i].pev, pkgs[i].tevs, - pkgs[i].ntevs, + ret =__add_probe_trace_events (&pevs[i], pevs[i].tevs, + pevs[i].ntevs, probe_conf.force_add);if (ret <0 )break ;
@@ -2819,33 +2799,30 @@ static int apply_perf_probe_events(struct __event_package *pkgs, int npevs)return ret; } -static void cleanup_perf_probe_events (struct __event_package *pkgs,int npevs) +void cleanup_perf_probe_events (struct perf_probe_event *pevs,int npevs) {int i, j; -if (pkgs ==NULL ) -return ; -/* Loop 3: cleanup and free trace events */ for (i =0 ; i < npevs; i++) { -for (j =0 ; j < pkgs[i].ntevs; j++) -clear_probe_trace_event (&pkgs[i].tevs[j]); -zfree (&pkgs[i].tevs); +for (j =0 ; j < pevs[i].ntevs; j++) +clear_probe_trace_event (&pevs[i].tevs[j]); +zfree (&pevs[i].tevs); + pevs[i].ntevs =0 ; } -free (pkgs); +exit_symbol_maps (); }int add_perf_probe_events (struct perf_probe_event *pevs,int npevs) {int ret; -struct __event_package *pkgs =NULL ; - ret =convert_perf_probe_events (pevs, npevs, &pkgs); + ret =convert_perf_probe_events (pevs, npevs);if (ret ==0 ) - ret =apply_perf_probe_events (pkgs, npevs); + ret =apply_perf_probe_events (pevs, npevs); -cleanup_perf_probe_events (pkgs, npevs); +cleanup_perf_probe_events (pevs, npevs);return ret; }
tools/perf/util/probe-event.h +5 -0
@@ -87,6 +87,8 @@ struct perf_probe_event {bool uprobes;/* Uprobe event flag */ char *target;/* Target binary */ struct perf_probe_arg *args;/* Arguments */ +struct probe_trace_event *tevs; +int ntevs; };/* Line range */
@@ -138,6 +140,9 @@ extern void line_range__clear(struct line_range *lr);extern int line_range__init (struct line_range *lr);extern int add_perf_probe_events (struct perf_probe_event *pevs,int npevs); +extern int convert_perf_probe_events (struct perf_probe_event *pevs,int npevs); +extern int apply_perf_probe_events (struct perf_probe_event *pevs,int npevs); +extern void cleanup_perf_probe_events (struct perf_probe_event *pevs,int npevs);extern int del_perf_probe_events (struct strfilter *filter);extern int show_perf_probe_events (struct strfilter *filter); extern int show_line_range(struct line_range *lr, const char *module,
Signature · 1 line
2.1.0
Arnaldo Carvalho de Melo
maintainerPATCH 29/31 perf probe: Split del_perf_probe_events()
In reply to Arnaldo Carvalho de MeloFrom: Namhyung Kim <[email protected]>
The del_perf_probe_events() does 2 things:
1. find existing events which match to filter
2. delete such trace events from kernel
But sometimes we need to do something with the trace events. So split the funtion into two, so that it can access intermediate trace events name using strlist if needed.
--- tools/perf/util/probe-file.c | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-)
tools/perf/util/probe-file.c +36 -4
@@ -275,7 +275,8 @@ error:return ret; } -int probe_file__del_events (int fd,struct strfilter *filter) +static int probe_file__get_events (int fd,struct strfilter *filter, +struct strlist *plist) {struct strlist *namelist;struct str_node *ent;
@@ -290,12 +291,43 @@ int probe_file__del_events(int fd, struct strfilter *filter) p =strchr (ent->s,':' );if ((p &&strfilter__compare (filter, p +1 )) ||strfilter__compare (filter, ent->s)) { - ret =__del_trace_probe_event (fd, ent); -if (ret <0 ) -break ; +strlist__add (plist, ent->s); + ret =0 ; } }strlist__delete (namelist);return ret; } + +static int probe_file__del_strlist (int fd,struct strlist *namelist) +{ +int ret =0 ; +struct str_node *ent; + +strlist__for_each (ent, namelist) { + ret =__del_trace_probe_event (fd, ent); +if (ret <0 ) +break ; + } +return ret; +} + +int probe_file__del_events (int fd,struct strfilter *filter) +{ +struct strlist *namelist; +int ret; + + namelist =strlist__new (NULL ,NULL ); +if (!namelist) +return -ENOMEM ; + + ret =probe_file__get_events (fd, filter, namelist); +if (ret <0 ) +return ret; + + ret =probe_file__del_strlist (fd, namelist); +strlist__delete (namelist); + +return ret; +}
Signature · 1 line
2.1.0
Arnaldo Carvalho de Melo
maintainerPATCH 20/31 x86/insn: perf tools: Add new SHA instructions
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
Intel SHA Extensions are explained in the Intel Architecture Instruction Set Extensions Programing Reference (Oct 2014). There are 7 new instructions. Add them to the op code map and the perf tools new instructions test. e.g.
$ tools/perf/perf test "x86 ins" 39: Test x86 instruction decoder - new instructions : Ok
Or to see the details:
$ tools/perf/perf test -v "x86 ins" 2>&1 | grep sha
Committer note:
3 lines of details, for the curious:
$ perf test -v "x86 ins" 2>&1 | grep sha256msg1 | tail -3 Decoded ok: 0f 38 cc 84 08 78 56 34 12 sha256msg1 0x12345678(%rax,%rcx,1),%xmm0 Decoded ok: 0f 38 cc 84 c8 78 56 34 12 sha256msg1 0x12345678(%rax,%rcx,8),%xmm0 Decoded ok: 44 0f 38 cc bc c8 78 56 34 12 sha256msg1 0x12345678(%rax,%rcx,8),%xmm15 $
--- arch/x86/lib/x86-opcode-map.txt | 7 + tools/perf/tests/insn-x86-dat-32.c | 294 ++++++++++++++++ tools/perf/tests/insn-x86-dat-64.c | 364 ++++++++++++++++++++ tools/perf/tests/insn-x86-dat-src.c | 373 +++++++++++++++++++++ .../perf/util/intel-pt-decoder/x86-opcode-map.txt | 7 + 5 files changed, 1045 insertions(+)
arch/x86/lib/x86-opcode-map.txt +7 -0
@@ -736,6 +736,12 @@ bd: vfnmadd231ss/d Vx,Hx,Wx (66),(v),(v1) be: vfnmsub231ps/d Vx,Hx,Wx (66),(v) bf: vfnmsub231ss/d Vx,Hx,Wx (66),(v),(v1) # 0x0f 0x38 0xc0-0xff +c8: sha1nexte Vdq,Wdq +c9: sha1msg1 Vdq,Wdq +ca: sha1msg2 Vdq,Wdq +cb: sha256rnds2 Vdq,Wdq +cc: sha256msg1 Vdq,Wdq +cd: sha256msg2 Vdq,Wdq db: VAESIMC Vdq,Wdq (66),(v1) dc: VAESENC Vdq,Hdq,Wdq (66),(v1) dd: VAESENCLAST Vdq,Hdq,Wdq (66),(v1)
@@ -794,6 +800,7 @@ AVXcode: 3 61: vpcmpestri Vdq,Wdq,Ib (66),(v1) 62: vpcmpistrm Vdq,Wdq,Ib (66),(v1) 63: vpcmpistri Vdq,Wdq,Ib (66),(v1) +cc: sha1rnds4 Vdq,Wdq,Ib df: VAESKEYGEN Vdq,Wdq,Ib (66),(v1) f0: RORX Gy,Ey,Ib (F2),(v) EndTable
tools/perf/tests/insn-x86-dat-32.c +294 -0
297 lines not on this page · raw message
tools/perf/tests/insn-x86-dat-64.c +364 -0
367 lines not on this page · raw message
tools/perf/tests/insn-x86-dat-src.c +373 -0
385 lines not on this page · raw message
tools/perf/util/intel-pt-decoder/x86-opcode-map.txt +7 -0
@@ -736,6 +736,12 @@ bd: vfnmadd231ss/d Vx,Hx,Wx (66),(v),(v1) be: vfnmsub231ps/d Vx,Hx,Wx (66),(v) bf: vfnmsub231ss/d Vx,Hx,Wx (66),(v),(v1) # 0x0f 0x38 0xc0-0xff +c8: sha1nexte Vdq,Wdq +c9: sha1msg1 Vdq,Wdq +ca: sha1msg2 Vdq,Wdq +cb: sha256rnds2 Vdq,Wdq +cc: sha256msg1 Vdq,Wdq +cd: sha256msg2 Vdq,Wdq db: VAESIMC Vdq,Wdq (66),(v1) dc: VAESENC Vdq,Hdq,Wdq (66),(v1) dd: VAESENCLAST Vdq,Hdq,Wdq (66),(v1)
@@ -794,6 +800,7 @@ AVXcode: 3 61: vpcmpestri Vdq,Wdq,Ib (66),(v1) 62: vpcmpistrm Vdq,Wdq,Ib (66),(v1) 63: vpcmpistri Vdq,Wdq,Ib (66),(v1) +cc: sha1rnds4 Vdq,Wdq,Ib df: VAESKEYGEN Vdq,Wdq,Ib (66),(v1) f0: RORX Gy,Ey,Ib (F2),(v) EndTable
Signature · 1 line
2.1.0
Arnaldo Carvalho de Melo
maintainerPATCH 30/31 perf probe: Print deleted events in cmd_probe()
In reply to Arnaldo Carvalho de MeloFrom: Namhyung Kim <[email protected]>
Showing actual trace event when deleteing perf events is only needed in perf probe command. But the add functionality itself can be used by other places. So move the printing code into the cmd_probe().
The output is not changed.
--- tools/perf/builtin-probe.c | 62 ++++++++++++++++++++++++++++++++++++++++++- tools/perf/util/probe-event.c | 5 ---- tools/perf/util/probe-event.h | 1 + tools/perf/util/probe-file.c | 7 +++-- tools/perf/util/probe-file.h | 4 +++ 5 files changed, 69 insertions(+), 10 deletions(-)
tools/perf/builtin-probe.c +61 -1
@@ -41,6 +41,7 @@#include "util/parse-options.h" #include "util/probe-finder.h" #include "util/probe-event.h" +#include "util/probe-file.h" #define DEFAULT_VAR_FILTER "!__k???tab_* & !__crc_*"#define DEFAULT_FUNC_FILTER "!_*"
@@ -357,6 +358,65 @@ out_cleanup:return ret; } +static int perf_del_probe_events (struct strfilter *filter) +{ +int ret, ret2, ufd =-1 , kfd =-1 ; +char *str =strfilter__string (filter); +struct strlist *klist =NULL , *ulist =NULL ; +struct str_node *ent; + +if (!str) +return -EINVAL ; + +pr_debug ("Delete filter: \'%s\'\n" , str); + +/* Get current event names */ + ret =probe_file__open_both (&kfd, &ufd,PF_FL_RW ); +if (ret <0 ) + goto out; + + klist =strlist__new (NULL ,NULL ); +if (!klist) +return -ENOMEM ; + + ret =probe_file__get_events (kfd, filter, klist); +if (ret ==0 ) { +strlist__for_each (ent, klist) +pr_info ("Removed event: %s\n" , ent->s); + + ret =probe_file__del_strlist (kfd, klist); +if (ret <0 ) + goto error; + } + + ret2 =probe_file__get_events (ufd, filter, ulist); +if (ret2 ==0 ) { +strlist__for_each (ent, ulist) +pr_info ("Removed event: %s\n" , ent->s); + + ret2 =probe_file__del_strlist (ufd, ulist); +if (ret2 <0 ) + goto error; + } + +if (ret == -ENOENT && ret2 == -ENOENT ) +pr_debug ("\"%s\" does not hit any event.\n" , str); +/* Note that this is silently ignored */ + ret =0 ; + +error: +if (kfd >=0 ) +close (kfd); +if (ufd >=0 ) +close (ufd); +out: +strlist__delete (klist); +strlist__delete (ulist); +free (str); + +return ret; +} +static int __cmd_probe (int argc,const char **argv,const char *prefix__maybe_unused ) {
@@ -529,7 +589,7 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)return ret;#endif case 'd' : - ret =del_perf_probe_events (params.filter); + ret =perf_del_probe_events (params.filter);if (ret <0 ) {pr_err_with_code (" Error: Failed to delete events." , ret);return ret;
tools/perf/util/probe-event.c +0 -5
@@ -2819,8 +2819,6 @@ int del_perf_probe_events(struct strfilter *filter)if (!str)return -EINVAL ; -pr_debug ("Delete filter: \'%s\'\n" , str); -/* Get current event names */ ret =probe_file__open_both (&kfd, &ufd,PF_FL_RW );if (ret <0 )
@@ -2835,9 +2833,6 @@ int del_perf_probe_events(struct strfilter *filter) ret = ret2; goto error; } -if (ret == -ENOENT && ret2 == -ENOENT ) -pr_debug ("\"%s\" does not hit any event.\n" , str); -/* Note that this is silently ignored */ ret =0 ; error:
tools/perf/util/probe-event.h +1 -0
@@ -144,6 +144,7 @@ extern int convert_perf_probe_events(struct perf_probe_event *pevs, int npevs);extern int apply_perf_probe_events (struct perf_probe_event *pevs,int npevs);extern void cleanup_perf_probe_events (struct perf_probe_event *pevs,int npevs);extern int del_perf_probe_events (struct strfilter *filter); +extern int show_perf_probe_event (const char *group,const char *event,struct perf_probe_event *pev,const char *module,bool use_stdout);
tools/perf/util/probe-file.c +3 -4
@@ -267,7 +267,6 @@ static int __del_trace_probe_event(int fd, struct str_node *ent) goto error; } -pr_info ("Removed event: %s\n" , ent->s);return 0 ; error: pr_warning("Failed to delete event: %s\n",
@@ -275,8 +274,8 @@ error:return ret; } -static int probe_file__get_events (int fd,struct strfilter *filter, -struct strlist *plist) +int probe_file__get_events (int fd,struct strfilter *filter, +struct strlist *plist) {struct strlist *namelist;struct str_node *ent;
@@ -300,7 +299,7 @@ static int probe_file__get_events(int fd, struct strfilter *filter,return ret; } -static int probe_file__del_strlist (int fd,struct strlist *namelist) +int probe_file__del_strlist (int fd,struct strlist *namelist) {int ret =0 ;struct str_node *ent;
tools/perf/util/probe-file.h +4 -0
@@ -14,5 +14,9 @@ struct strlist *probe_file__get_namelist(int fd);struct strlist *probe_file__get_rawlist (int fd);int probe_file__add_event (int fd,struct probe_trace_event *tev);int probe_file__del_events (int fd,struct strfilter *filter); +int probe_file__get_events (int fd,struct strfilter *filter, +struct strlist *plist); +int probe_file__del_strlist (int fd,struct strlist *namelist); +#endif
Signature · 1 line
2.1.0
Arnaldo Carvalho de Melo
maintainerPATCH 28/31 perf probe: Move print logic into cmd_probe()
In reply to Arnaldo Carvalho de MeloFrom: Namhyung Kim <[email protected]>
Showing actual trace event when adding perf events is only needed in perf probe command. But the add functionality itself can be used by other places. So move the printing code into the cmd_probe().
Also it combines the output if more than one event is added.
Before:
$ sudo perf probe -a do_fork -a do_exit Added new event: probe:do_fork (on do_fork)
You can now use it in all perf tools, such as:
perf record -e probe:do_fork -aR sleep 1
Added new events:
probe:do_exit (on do_exit)
probe:do_exit_1 (on do_exit)
You can now use it in all perf tools, such as:
perf record -e probe:do_exit_1 -aR sleep 1
After:
$ sudo perf probe -a do_fork -a do_exit Added new events: probe:do_fork (on do_fork) probe:do_exit (on do_exit) probe:do_exit_1 (on do_exit)
You can now use it in all perf tools, such as:
perf record -e probe:do_exit_1 -aR sleep 1
--- tools/perf/builtin-probe.c | 48 ++++++++++++++++++++++++++++++++++++++++++- tools/perf/util/probe-event.c | 22 +++----------------- tools/perf/util/probe-event.h | 3 +++ 3 files changed, 53 insertions(+), 20 deletions(-)
tools/perf/builtin-probe.c +47 -1
@@ -311,6 +311,52 @@ static void pr_err_with_code(const char *msg, int err)pr_err ("\n" ); } +static int perf_add_probe_events (struct perf_probe_event *pevs,int npevs) +{ +int ret; +int i, k; +const char *event =NULL , *group =NULL ; + + ret =convert_perf_probe_events (pevs, npevs); +if (ret <0 ) + goto out_cleanup; + + ret =apply_perf_probe_events (pevs, npevs); +if (ret <0 ) + goto out_cleanup; + +for (i = k =0 ; i < npevs; i++) + k += pevs[i].ntevs; + +pr_info ("Added new event%s\n" , (k >1 ) ?"s:" :":" ); +for (i =0 ; i < npevs; i++) { +struct perf_probe_event *pev = &pevs[i]; + +for (k =0 ; k < pev->ntevs; k++) { +struct probe_trace_event *tev = &pev->tevs[k]; + +/* We use tev's name for showing new events */ +show_perf_probe_event (tev->group, tev->event, pev, + tev->point.module, false); + +/* Save the last valid name */ + event = tev->event; + group = tev->group; + } + } + +/* Note that it is possible to skip all events because of blacklist */ +if (event) { +/* Show how to use the event. */ +pr_info ("\nYou can now use it in all perf tools, such as:\n\n" ); +pr_info ("\tperf record -e %s:%s -aR sleep 1\n\n" , group, event); + } + +out_cleanup: +cleanup_perf_probe_events (pevs, npevs); +return ret; +} +static int __cmd_probe (int argc,const char **argv,const char *prefix__maybe_unused ) {
@@ -496,7 +542,7 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)usage_with_options (probe_usage, options); } - ret =add_perf_probe_events (params.events, params.nevents); + ret =perf_add_probe_events (params.events, params.nevents);if (ret <0 ) {pr_err_with_code (" Error: Failed to add events." , ret);return ret;
tools/perf/util/probe-event.c +3 -19
@@ -2180,9 +2180,9 @@ out: }/* Show an event */ -static int show_perf_probe_event (const char *group,const char *event, -struct perf_probe_event *pev, -const char *module,bool use_stdout) +int show_perf_probe_event (const char *group,const char *event, +struct perf_probe_event *pev, +const char *module,bool use_stdout) {struct strbuf buf =STRBUF_INIT ;int ret;
@@ -2399,7 +2399,6 @@ static int __add_probe_trace_events(struct perf_probe_event *pev, {int i, fd, ret;struct probe_trace_event *tev =NULL ; -const char *event =NULL , *group =NULL ;struct strlist *namelist; fd =probe_file__open (PF_FL_RW | (pev->uprobes ?PF_FL_UPROBE :0 ));
@@ -2415,7 +2414,6 @@ static int __add_probe_trace_events(struct perf_probe_event *pev, } ret =0 ; -pr_info ("Added new event%s\n" , (ntevs >1 ) ?"s:" :":" );for (i =0 ; i < ntevs; i++) { tev = &tevs[i];/* Skip if the symbol is out of .text or blacklisted */
@@ -2432,13 +2430,6 @@ static int __add_probe_trace_events(struct perf_probe_event *pev,if (ret <0 )break ; -/* We use tev's name for showing new events */ -show_perf_probe_event (tev->group, tev->event, pev, - tev->point.module, false); -/* Save the last valid name */ - event = tev->event; - group = tev->group; -/* * Probes after the first probe which comes from same * user input are always allowed to add suffix, because
@@ -2450,13 +2441,6 @@ static int __add_probe_trace_events(struct perf_probe_event *pev,if (ret == -EINVAL && pev->uprobes)warn_uprobe_event_compat (tev); -/* Note that it is possible to skip all events because of blacklist */ -if (ret >=0 && event) { -/* Show how to use the event. */ -pr_info ("\nYou can now use it in all perf tools, such as:\n\n" ); -pr_info ("\tperf record -e %s:%s -aR sleep 1\n\n" , group, event); - } -strlist__delete (namelist); close_out:close (fd);
tools/perf/util/probe-event.h +3 -0
@@ -144,6 +144,9 @@ extern int convert_perf_probe_events(struct perf_probe_event *pevs, int npevs);extern int apply_perf_probe_events (struct perf_probe_event *pevs,int npevs);extern void cleanup_perf_probe_events (struct perf_probe_event *pevs,int npevs);extern int del_perf_probe_events (struct strfilter *filter); +extern int show_perf_probe_event (const char *group,const char *event, +struct perf_probe_event *pev, +const char *module,bool use_stdout);extern int show_perf_probe_events (struct strfilter *filter);extern int show_line_range (struct line_range *lr,const char *module,bool user);
Signature · 1 line
2.1.0
Arnaldo Carvalho de Melo
maintainerPATCH 21/31 x86/insn: perf tools: Add new memory instructions
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
Intel Architecture Instruction Set Extensions Programing Reference (Oct 2014) describes 3 new memory instructions, namely clflushopt, clwb and pcommit. Add them to the op code map and the perf tools new instructions test. e.g.
$ tools/perf/perf test "x86 ins" 39: Test x86 instruction decoder - new instructions : Ok
Or to see the details:
$ tools/perf/perf test -v "x86 ins"
--- arch/x86/lib/x86-opcode-map.txt | 4 +- tools/perf/tests/insn-x86-dat-32.c | 22 +++++++++++ tools/perf/tests/insn-x86-dat-64.c | 34 ++++++++++++++++ tools/perf/tests/insn-x86-dat-src.c | 46 ++++++++++++++++++++++ .../perf/util/intel-pt-decoder/x86-opcode-map.txt | 4 +- 5 files changed, 106 insertions(+), 4 deletions(-)
arch/x86/lib/x86-opcode-map.txt +2 -2
@@ -943,8 +943,8 @@ GrpTable: Grp15 3: vstmxcsr Md (v1) | WRGSBASE Ry (F3),(11B) 4: XSAVE 5: XRSTOR | lfence (11B) -6: XSAVEOPT | mfence (11B) -7: clflush | sfence (11B) +6: XSAVEOPT | clwb (66) | mfence (11B) +7: clflush | clflushopt (66) | sfence (11B) | pcommit (66),(11B) EndTable GrpTable: Grp16
tools/perf/tests/insn-x86-dat-32.c +22 -0
@@ -616,3 +616,25 @@ "0f 38 cd 84 08 78 56 34 12 \tsha256msg2 0x12345678(%eax,%ecx,1),%xmm0",}, {{0x0f, 0x38, 0xcd, 0x84, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", "0f 38 cd 84 c8 78 56 34 12 \tsha256msg2 0x12345678(%eax,%ecx,8),%xmm0",}, +{{0x66, 0x0f, 0xae, 0x38, }, 4, 0, "", "", +"66 0f ae 38 \tclflushopt (%eax)",}, +{{0x66, 0x0f, 0xae, 0x3d, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"66 0f ae 3d 78 56 34 12 \tclflushopt 0x12345678",}, +{{0x66, 0x0f, 0xae, 0xbc, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"66 0f ae bc c8 78 56 34 12 \tclflushopt 0x12345678(%eax,%ecx,8)",}, +{{0x0f, 0xae, 0x38, }, 3, 0, "", "", +"0f ae 38 \tclflush (%eax)",}, +{{0x0f, 0xae, 0xf8, }, 3, 0, "", "", +"0f ae f8 \tsfence ",}, +{{0x66, 0x0f, 0xae, 0x30, }, 4, 0, "", "", +"66 0f ae 30 \tclwb (%eax)",}, +{{0x66, 0x0f, 0xae, 0x35, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"66 0f ae 35 78 56 34 12 \tclwb 0x12345678",}, +{{0x66, 0x0f, 0xae, 0xb4, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"66 0f ae b4 c8 78 56 34 12 \tclwb 0x12345678(%eax,%ecx,8)",}, +{{0x0f, 0xae, 0x30, }, 3, 0, "", "", +"0f ae 30 \txsaveopt (%eax)",}, +{{0x0f, 0xae, 0xf0, }, 3, 0, "", "", +"0f ae f0 \tmfence ",}, +{{0x66, 0x0f, 0xae, 0xf8, }, 4, 0, "", "", +"66 0f ae f8 \tpcommit ",},
tools/perf/tests/insn-x86-dat-64.c +34 -0
@@ -702,3 +702,37 @@ "0f 38 cd 84 c8 78 56 34 12 \tsha256msg2 0x12345678(%rax,%rcx,8),%xmm0",}, {{0x44, 0x0f, 0x38, 0xcd, 0xbc, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 10, 0, "", "", "44 0f 38 cd bc c8 78 56 34 12 \tsha256msg2 0x12345678(%rax,%rcx,8),%xmm15",}, +{{0x66, 0x0f, 0xae, 0x38, }, 4, 0, "", "", +"66 0f ae 38 \tclflushopt (%rax)",}, +{{0x66, 0x41, 0x0f, 0xae, 0x38, }, 5, 0, "", "", +"66 41 0f ae 38 \tclflushopt (%r8)",}, +{{0x66, 0x0f, 0xae, 0x3c, 0x25, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"66 0f ae 3c 25 78 56 34 12 \tclflushopt 0x12345678",}, +{{0x66, 0x0f, 0xae, 0xbc, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"66 0f ae bc c8 78 56 34 12 \tclflushopt 0x12345678(%rax,%rcx,8)",}, +{{0x66, 0x41, 0x0f, 0xae, 0xbc, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 10, 0, "", "", +"66 41 0f ae bc c8 78 56 34 12 \tclflushopt 0x12345678(%r8,%rcx,8)",}, +{{0x0f, 0xae, 0x38, }, 3, 0, "", "", +"0f ae 38 \tclflush (%rax)",}, +{{0x41, 0x0f, 0xae, 0x38, }, 4, 0, "", "", +"41 0f ae 38 \tclflush (%r8)",}, +{{0x0f, 0xae, 0xf8, }, 3, 0, "", "", +"0f ae f8 \tsfence ",}, +{{0x66, 0x0f, 0xae, 0x30, }, 4, 0, "", "", +"66 0f ae 30 \tclwb (%rax)",}, +{{0x66, 0x41, 0x0f, 0xae, 0x30, }, 5, 0, "", "", +"66 41 0f ae 30 \tclwb (%r8)",}, +{{0x66, 0x0f, 0xae, 0x34, 0x25, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"66 0f ae 34 25 78 56 34 12 \tclwb 0x12345678",}, +{{0x66, 0x0f, 0xae, 0xb4, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"66 0f ae b4 c8 78 56 34 12 \tclwb 0x12345678(%rax,%rcx,8)",}, +{{0x66, 0x41, 0x0f, 0xae, 0xb4, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 10, 0, "", "", +"66 41 0f ae b4 c8 78 56 34 12 \tclwb 0x12345678(%r8,%rcx,8)",}, +{{0x0f, 0xae, 0x30, }, 3, 0, "", "", +"0f ae 30 \txsaveopt (%rax)",}, +{{0x41, 0x0f, 0xae, 0x30, }, 4, 0, "", "", +"41 0f ae 30 \txsaveopt (%r8)",}, +{{0x0f, 0xae, 0xf0, }, 3, 0, "", "", +"0f ae f0 \tmfence ",}, +{{0x66, 0x0f, 0xae, 0xf8, }, 4, 0, "", "", +"66 0f ae f8 \tpcommit ",},
tools/perf/tests/insn-x86-dat-src.c +46 -0
60 lines not on this page · raw message
tools/perf/util/intel-pt-decoder/x86-opcode-map.txt +2 -2
@@ -943,8 +943,8 @@ GrpTable: Grp15 3: vstmxcsr Md (v1) | WRGSBASE Ry (F3),(11B) 4: XSAVE 5: XRSTOR | lfence (11B) -6: XSAVEOPT | mfence (11B) -7: clflush | sfence (11B) +6: XSAVEOPT | clwb (66) | mfence (11B) +7: clflush | clflushopt (66) | sfence (11B) | pcommit (66),(11B) EndTable GrpTable: Grp16
Signature · 1 line
2.1.0
Arnaldo Carvalho de Melo
maintainerPATCH 8/31 perf tools: Move tracing_path stuff under same namespace
In reply to Arnaldo Carvalho de MeloFrom: Jiri Olsa <[email protected]>
Renaming all functions touching tracing_path under same namespace. New interface is:
char tracing_path[];
- tracing mount path
char tracing_events_path[];
- tracing mount/events path
void tracing_path_set(const char *mountpoint);
- setting directly tracing_path(_events), used by --debugfs-dir option
const char *tracing_path_mount(void);
- initial setup of tracing_(events)_path, called from perf.c mounts debugfs/tracefs if needed and possible
char *get_tracing_file(const char *name); void put_tracing_file(char *file); - get/put tracing file path
--- tools/perf/perf.c | 10 ++++++---- tools/perf/util/util.c | 20 ++++++++++---------- tools/perf/util/util.h | 4 ++-- 3 files changed, 18 insertions(+), 16 deletions(-)
tools/perf/perf.c +6 -4
@@ -214,7 +214,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)fprintf (stderr,"No directory given for --debugfs-dir.\n" );usage (perf_usage_string); } -perf_debugfs_set_path ((*argv)[1 ]); +tracing_path_set ((*argv)[1 ]);if (envchanged) *envchanged =1 ; (*argv)++;
@@ -230,7 +230,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) (*argv)++; (*argc)--; }else if (!prefixcmp (cmd,CMD_DEBUGFS_DIR )) { -perf_debugfs_set_path (cmd +strlen (CMD_DEBUGFS_DIR )); +tracing_path_set (cmd +strlen (CMD_DEBUGFS_DIR ));fprintf (stderr,"dir: %s\n" , tracing_path);if (envchanged) *envchanged =1 ;
@@ -517,8 +517,10 @@ int main(int argc, const char **argv) cmd =perf_extract_argv0_path (argv[0 ]);if (!cmd) cmd ="perf-help" ; -/* get debugfs mount point from /proc/mounts */ -perf_debugfs_mount (); + +/* get debugfs/tracefs mount point from /proc/mounts */ +tracing_path_mount (); +/* * "perf-xxxx" is the same as "perf xxxx", but we obviously: *
tools/perf/util/util.c +10 -10
@@ -390,7 +390,7 @@ void set_term_quiet_input(struct termios *old)tcsetattr (0 ,TCSANOW , &tc); } -static void set_tracing_events_path (const char *tracing,const char *mountpoint) +static void __tracing_path_set (const char *tracing,const char *mountpoint) {snprintf (tracing_path,sizeof (tracing_path),"%s/%s" , mountpoint, tracing);
@@ -398,7 +398,7 @@ static void set_tracing_events_path(const char *tracing, const char *mountpoint) mountpoint, tracing, "events"); } -static const char *__perf_tracefs_mount (void ) +static const char *tracing_path_tracefs_mount (void ) {const char *mnt;
@@ -406,12 +406,12 @@ static const char *__perf_tracefs_mount(void)if (!mnt)return NULL ; -set_tracing_events_path ("" , mnt); +__tracing_path_set ("" , mnt);return mnt; } -static const char *__perf_debugfs_mount (void ) +static const char *tracing_path_debugfs_mount (void ) {const char *mnt;
@@ -419,27 +419,27 @@ static const char *__perf_debugfs_mount(void)if (!mnt)return NULL ; -set_tracing_events_path ("tracing/" , mnt); +__tracing_path_set ("tracing/" , mnt);return mnt; } -const char *perf_debugfs_mount (void ) +const char *tracing_path_mount (void ) {const char *mnt; - mnt =__perf_tracefs_mount (); + mnt =tracing_path_tracefs_mount ();if (mnt)return mnt; - mnt =__perf_debugfs_mount (); + mnt =tracing_path_debugfs_mount ();return mnt; } -void perf_debugfs_set_path (const char *mntpt) +void tracing_path_set (const char *mntpt) { -set_tracing_events_path ("tracing/" , mntpt); +__tracing_path_set ("tracing/" , mntpt); }char *get_tracing_file (const char *name)
tools/perf/util/util.h +2 -2
@@ -85,8 +85,8 @@ extern const char *graph_dotted_line;extern char buildid_dir[];extern char tracing_path[];extern char tracing_events_path[]; -extern void perf_debugfs_set_path (const char *mountpoint); -const char *perf_debugfs_mount (void ); +extern void tracing_path_set (const char *mountpoint); +const char *tracing_path_mount (void );char *get_tracing_file (const char *name);void put_tracing_file (char *file);
Signature · 1 line
2.1.0
Arnaldo Carvalho de Melo
maintainerPATCH 11/31 tools lib api fs: Add STR and PATH_MAX macros to fs object
In reply to Arnaldo Carvalho de MeloFrom: Jiri Olsa <[email protected]>
We're going to get rid of findfs.h in following patches, but we'll still need these macros.
--- tools/lib/api/fs/fs.c | 3 +++ tools/lib/api/fs/fs.h | 8 ++++++++ 2 files changed, 11 insertions(+)
tools/lib/api/fs/fs.c +3 -0
@@ -15,6 +15,9 @@#include "debugfs.h" #include "fs.h" +#define _STR (x) #x +#define STR (x) _STR(x) +static const char *const sysfs__fs_known_mountpoints[] = {"/sys" ,0 ,
tools/lib/api/fs/fs.h +8 -0
@@ -1,6 +1,14 @@#ifndef __API_FS__#define __API_FS__ +/* +* On most systems <limits.h> would have given us this, but not on some systems +* (e.g. GNU/Hurd). +*/ +#ifndef PATH_MAX +#define PATH_MAX 4096 +#endif +#ifndef SYSFS_MAGIC #define SYSFS_MAGIC 0x62656572#endif
Signature · 1 line
2.1.0
Arnaldo Carvalho de Melo
maintainerPATCH 3/31 tools lib traceevent: Support function __get_dynamic_array_len
In reply to Arnaldo Carvalho de MeloFrom: He Kuang <[email protected]>
Support helper function __get_dynamic_array_len() in libtraceevent, this function is used accompany with __print_array() or __print_hex(), but currently it is not an available function in the function list of process_function().
The total allocated length of the dynamic array is embedded in the top half of __data_loc_##item field. This patch adds new arg type PRINT_DYNAMIC_ARRAY_LEN to return the length to eval_num_arg(),
--- tools/lib/traceevent/event-parse.c | 56 +++++++++++++++++++++- tools/lib/traceevent/event-parse.h | 1 + .../perf/util/scripting-engines/trace-event-perl.c | 1 + .../util/scripting-engines/trace-event-python.c | 1 + 4 files changed, 57 insertions(+), 2 deletions(-)
tools/lib/traceevent/event-parse.c +54 -2
@@ -848,6 +848,7 @@ static void free_arg(struct print_arg *arg)free (arg->bitmask.bitmask);break ;case PRINT_DYNAMIC_ARRAY : +case PRINT_DYNAMIC_ARRAY_LEN :free (arg->dynarray.index);break ;case PRINT_OP :
@@ -2729,6 +2730,42 @@ process_dynamic_array(struct event_format *event, struct print_arg *arg, char ** }static enum event_type +process_dynamic_array_len (struct event_format *event,struct print_arg *arg, +char **tok) +{ +struct format_field *field; +enum event_type type; +char *token; + +if (read_expect_type (EVENT_ITEM , &token) <0 ) + goto out_free; + + arg->type =PRINT_DYNAMIC_ARRAY_LEN ; + +/* Find the field */ + field =pevent_find_field (event, token); +if (!field) + goto out_free; + + arg->dynarray.field = field; + arg->dynarray.index =0 ; + +if (read_expected (EVENT_DELIM ,")" ) <0 ) + goto out_err; + + type =read_token (&token); + *tok = token; + +return type; + + out_free: +free_token (token); + out_err: + *tok =NULL ; +return EVENT_ERROR ; +} + +static enum event_type process_paren (struct event_format *event,struct print_arg *arg,char **tok) {struct print_arg *item_arg;
@@ -2975,6 +3012,10 @@ process_function(struct event_format *event, struct print_arg *arg,free_token (token);return process_dynamic_array (event, arg, tok); } +if (strcmp (token,"__get_dynamic_array_len" ) ==0 ) { +free_token (token); +return process_dynamic_array_len (event, arg, tok); + } func =find_func_handler (event->pevent, token);if (func) {
@@ -3655,14 +3696,25 @@ eval_num_arg(void *data, int size, struct event_format *event, struct print_arg goto out_warning_op; }break ; +case PRINT_DYNAMIC_ARRAY_LEN : + offset =pevent_read_number (pevent, + data + arg->dynarray.field->offset, + arg->dynarray.field->size); +/* +* The total allocated length of the dynamic array is +* stored in the top half of the field, and the offset +* is in the bottom half of the 32 bit field. +*/ + val = (unsigned long long )(offset >>16 ); +break ;case PRINT_DYNAMIC_ARRAY :/* Without [], we pass the address to the dynamic data */ offset =pevent_read_number (pevent, data + arg->dynarray.field->offset, arg->dynarray.field->size);/* -* The actual length of the dynamic array is stored -* in the top half of the field, and the offset +* The total allocated length of the dynamic array is +* stored in the top half of the field, and the offset * is in the bottom half of the 32 bit field. */ offset &=0xffff ;
tools/lib/traceevent/event-parse.h +1 -0
@@ -294,6 +294,7 @@ enum print_arg_type {PRINT_OP ,PRINT_FUNC ,PRINT_BITMASK , + PRINT_DYNAMIC_ARRAY_LEN, }; struct print_arg {
tools/perf/util/scripting-engines/trace-event-perl.c +1 -0
@@ -221,6 +221,7 @@ static void define_event_symbols(struct event_format *event,break ;case PRINT_BSTRING :case PRINT_DYNAMIC_ARRAY : +case PRINT_DYNAMIC_ARRAY_LEN :case PRINT_STRING :case PRINT_BITMASK :break ;
tools/perf/util/scripting-engines/trace-event-python.c +1 -0
@@ -251,6 +251,7 @@ static void define_event_symbols(struct event_format *event,/* gcc warns for these? */ case PRINT_BSTRING :case PRINT_DYNAMIC_ARRAY : +case PRINT_DYNAMIC_ARRAY_LEN :case PRINT_FUNC :case PRINT_BITMASK :/* we should warn... */
Signature · 1 line
2.1.0
Arnaldo Carvalho de Melo
maintainerPATCH 2/31 perf tools: Copy linux/filter.h to tools/include
In reply to Arnaldo Carvalho de MeloFrom: He Kuang <[email protected]>
This patch copies filter.h from include/linux/kernel.h to tools/include/linux/filter.h to enable other libraries to use macros in it, like libbpf which will be introduced by further patches.
Currently, the filter.h copy only contains the useful macros needed by libbpf for not introducing too much dependence.
tools/perf/MANIFEST is also updated for 'make perf-*-src-pkg'.
One change:
The 'imm' field of BPF_EMIT_CALL becomes ((FUNC) - BPF_FUNC_unspec) to suit user space code generator.
--- tools/include/linux/filter.h | 231 +++++++++++++++++++++++++++++++++++++++++++ tools/perf/MANIFEST | 1 + 2 files changed, 232 insertions(+) create mode 100644 tools/include/linux/filter.h
tools/include/linux/filter.h new file +231 -0
@@ -0,0 +1,231 @@ +/* +* Linux Socket Filter Data Structures +*/ +#ifndef __TOOLS_LINUX_FILTER_H +#define __TOOLS_LINUX_FILTER_H + +#include <linux/bpf.h> + +/* ArgX, context and stack frame pointer register positions. Note, +* Arg1, Arg2, Arg3, etc are used as argument mappings of function +* calls in BPF_CALL instruction. +*/ +#define BPF_REG_ARG1 BPF_REG_1 +#define BPF_REG_ARG2 BPF_REG_2 +#define BPF_REG_ARG3 BPF_REG_3 +#define BPF_REG_ARG4 BPF_REG_4 +#define BPF_REG_ARG5 BPF_REG_5 +#define BPF_REG_CTX BPF_REG_6 +#define BPF_REG_FP BPF_REG_10 + +/* Additional register mappings for converted user programs. */ +#define BPF_REG_A BPF_REG_0 +#define BPF_REG_X BPF_REG_7 +#define BPF_REG_TMP BPF_REG_8 + +/* BPF program can access up to 512 bytes of stack space. */ +#define MAX_BPF_STACK 512 + +/* Helper macros for filter block array initializers. */ + +/* ALU ops on registers, bpf_add|sub|...: dst_reg += src_reg */ + +#define BPF_ALU64_REG (OP ,DST ,SRC ) \ + ((struct bpf_insn) { \ + .code = BPF_ALU64 | BPF_OP(OP) | BPF_X, \ + .dst_reg = DST, \ + .src_reg = SRC, \ + .off = 0, \ + .imm = 0 }) + +#define BPF_ALU32_REG (OP ,DST ,SRC ) \ + ((struct bpf_insn) { \ + .code = BPF_ALU | BPF_OP(OP) | BPF_X, \ + .dst_reg = DST, \ + .src_reg = SRC, \ + .off = 0, \ + .imm = 0 }) + +/* ALU ops on immediates, bpf_add|sub|...: dst_reg += imm32 */ + +#define BPF_ALU64_IMM (OP ,DST ,IMM ) \ + ((struct bpf_insn) { \ + .code = BPF_ALU64 | BPF_OP(OP) | BPF_K, \ + .dst_reg = DST, \ + .src_reg = 0, \ + .off = 0, \ + .imm = IMM }) + +#define BPF_ALU32_IMM (OP ,DST ,IMM ) \ + ((struct bpf_insn) { \ + .code = BPF_ALU | BPF_OP(OP) | BPF_K, \ + .dst_reg = DST, \ + .src_reg = 0, \ + .off = 0, \ + .imm = IMM }) + +/* Endianess conversion, cpu_to_{l,b}e(), {l,b}e_to_cpu() */ + +#define BPF_ENDIAN (TYPE ,DST ,LEN ) \ + ((struct bpf_insn) { \ + .code = BPF_ALU | BPF_END | BPF_SRC(TYPE), \ + .dst_reg = DST, \ + .src_reg = 0, \ + .off = 0, \ + .imm = LEN }) + +/* Short form of mov, dst_reg = src_reg */ + +#define BPF_MOV64_REG (DST ,SRC ) \ + ((struct bpf_insn) { \ + .code = BPF_ALU64 | BPF_MOV | BPF_X, \ + .dst_reg = DST, \ + .src_reg = SRC, \ + .off = 0, \ + .imm = 0 }) + +#define BPF_MOV32_REG (DST ,SRC ) \ + ((struct bpf_insn) { \ + .code = BPF_ALU | BPF_MOV | BPF_X, \ + .dst_reg = DST, \ + .src_reg = SRC, \ + .off = 0, \ + .imm = 0 }) + +/* Short form of mov, dst_reg = imm32 */ + +#define BPF_MOV64_IMM (DST ,IMM ) \ + ((struct bpf_insn) { \ + .code = BPF_ALU64 | BPF_MOV | BPF_K, \ + .dst_reg = DST, \ + .src_reg = 0, \ + .off = 0, \ + .imm = IMM }) + +#define BPF_MOV32_IMM (DST ,IMM ) \ + ((struct bpf_insn) { \ + .code = BPF_ALU | BPF_MOV | BPF_K, \ + .dst_reg = DST, \ + .src_reg = 0, \ + .off = 0, \ + .imm = IMM }) + +/* Short form of mov based on type, BPF_X: dst_reg = src_reg, BPF_K: dst_reg = imm32 */ + +#define BPF_MOV64_RAW (TYPE ,DST ,SRC ,IMM ) \ + ((struct bpf_insn) { \ + .code = BPF_ALU64 | BPF_MOV | BPF_SRC(TYPE), \ + .dst_reg = DST, \ + .src_reg = SRC, \ + .off = 0, \ + .imm = IMM }) + +#define BPF_MOV32_RAW (TYPE ,DST ,SRC ,IMM ) \ + ((struct bpf_insn) { \ + .code = BPF_ALU | BPF_MOV | BPF_SRC(TYPE), \ + .dst_reg = DST, \ + .src_reg = SRC, \ + .off = 0, \ + .imm = IMM }) + +/* Direct packet access, R0 = *(uint *) (skb->data + imm32) */ + +#define BPF_LD_ABS (SIZE ,IMM ) \ + ((struct bpf_insn) { \ + .code = BPF_LD | BPF_SIZE(SIZE) | BPF_ABS, \ + .dst_reg = 0, \ + .src_reg = 0, \ + .off = 0, \ + .imm = IMM }) + +/* Indirect packet access, R0 = *(uint *) (skb->data + src_reg + imm32) */ + +#define BPF_LD_IND (SIZE ,SRC ,IMM ) \ + ((struct bpf_insn) { \ + .code = BPF_LD | BPF_SIZE(SIZE) | BPF_IND, \ + .dst_reg = 0, \ + .src_reg = SRC, \ + .off = 0, \ + .imm = IMM }) + +/* Memory load, dst_reg = *(uint *) (src_reg + off16) */ + +#define BPF_LDX_MEM (SIZE ,DST ,SRC ,OFF ) \ + ((struct bpf_insn) { \ + .code = BPF_LDX | BPF_SIZE(SIZE) | BPF_MEM, \ + .dst_reg = DST, \ + .src_reg = SRC, \ + .off = OFF, \ + .imm = 0 }) + +/* Memory store, *(uint *) (dst_reg + off16) = src_reg */ + +#define BPF_STX_MEM (SIZE ,DST ,SRC ,OFF ) \ + ((struct bpf_insn) { \ + .code = BPF_STX | BPF_SIZE(SIZE) | BPF_MEM, \ + .dst_reg = DST, \ + .src_reg = SRC, \ + .off = OFF, \ + .imm = 0 }) + +/* Memory store, *(uint *) (dst_reg + off16) = imm32 */ + +#define BPF_ST_MEM (SIZE ,DST ,OFF ,IMM ) \ + ((struct bpf_insn) { \ + .code = BPF_ST | BPF_SIZE(SIZE) | BPF_MEM, \ + .dst_reg = DST, \ + .src_reg = 0, \ + .off = OFF, \ + .imm = IMM }) + +/* Conditional jumps against registers, if (dst_reg 'op' src_reg) goto pc + off16 */ + +#define BPF_JMP_REG (OP ,DST ,SRC ,OFF ) \ + ((struct bpf_insn) { \ + .code = BPF_JMP | BPF_OP(OP) | BPF_X, \ + .dst_reg = DST, \ + .src_reg = SRC, \ + .off = OFF, \ + .imm = 0 }) + +/* Conditional jumps against immediates, if (dst_reg 'op' imm32) goto pc + off16 */ + +#define BPF_JMP_IMM (OP ,DST ,IMM ,OFF ) \ + ((struct bpf_insn) { \ + .code = BPF_JMP | BPF_OP(OP) | BPF_K, \ + .dst_reg = DST, \ + .src_reg = 0, \ + .off = OFF, \ + .imm = IMM }) + +/* Function call */ + +#define BPF_EMIT_CALL (FUNC ) \ + ((struct bpf_insn) { \ + .code = BPF_JMP | BPF_CALL, \ + .dst_reg = 0, \ + .src_reg = 0, \ + .off = 0, \ + .imm = ((FUNC) - BPF_FUNC_unspec) }) + +/* Raw code statement block */ + +#define BPF_RAW_INSN (CODE ,DST ,SRC ,OFF ,IMM ) \ + ((struct bpf_insn) { \ + .code = CODE, \ + .dst_reg = DST, \ + .src_reg = SRC, \ + .off = OFF, \ + .imm = IMM }) + +/* Program exit */ + +#define BPF_EXIT_INSN () \ + ((struct bpf_insn) { \ + .code = BPF_JMP | BPF_EXIT, \ + .dst_reg = 0, \ + .src_reg = 0, \ + .off = 0, \ + .imm = 0 }) + +#endif /* __TOOLS_LINUX_FILTER_H */
tools/perf/MANIFEST +1 -0
@@ -41,6 +41,7 @@ tools/include/asm-generic/bitops.h tools/include/linux/atomic.h tools/include/linux/bitops.h tools/include/linux/compiler.h +tools/include/linux/filter.h tools/include/linux/hash.h tools/include/linux/kernel.h tools/include/linux/list.h
Signature · 1 line
2.1.0
Arnaldo Carvalho de Melo
maintainerPATCH 23/31 x86/insn: perf tools: Add new xsave instructions
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
Add xsavec, xsaves and xrstors to the op code map and the perf tools new instructions test. To run the test:
$ tools/perf/perf test "x86 ins" 39: Test x86 instruction decoder - new instructions : Ok
Or to see the details:
$ tools/perf/perf test -v "x86 ins" 2>&1 | grep 'xsave\|xrst'
For information about xsavec, xsaves and xrstors, refer the Intel SDM.
--- arch/x86/lib/x86-opcode-map.txt | 3 ++ tools/perf/tests/insn-x86-dat-32.c | 18 ++++++++++ tools/perf/tests/insn-x86-dat-64.c | 30 ++++++++++++++++ tools/perf/tests/insn-x86-dat-src.c | 42 ++++++++++++++++++++++ .../perf/util/intel-pt-decoder/x86-opcode-map.txt | 3 ++ 5 files changed, 96 insertions(+)
arch/x86/lib/x86-opcode-map.txt +3 -0
@@ -899,6 +899,9 @@ EndTable GrpTable: Grp9 1: CMPXCHG8B/16B Mq/Mdq +3: xrstors +4: xsavec +5: xsaves 6: VMPTRLD Mq | VMCLEAR Mq (66) | VMXON Mq (F3) | RDRAND Rv (11B) 7: VMPTRST Mq | VMPTRST Mq (F3) | RDSEED Rv (11B) EndTable
tools/perf/tests/insn-x86-dat-32.c +18 -0
@@ -636,5 +636,23 @@ "0f ae 30 \txsaveopt (%eax)",}, {{0x0f, 0xae, 0xf0, }, 3, 0, "", "", "0f ae f0 \tmfence ",}, +{{0x0f, 0xc7, 0x20, }, 3, 0, "", "", +"0f c7 20 \txsavec (%eax)",}, +{{0x0f, 0xc7, 0x25, 0x78, 0x56, 0x34, 0x12, }, 7, 0, "", "", +"0f c7 25 78 56 34 12 \txsavec 0x12345678",}, +{{0x0f, 0xc7, 0xa4, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 a4 c8 78 56 34 12 \txsavec 0x12345678(%eax,%ecx,8)",}, +{{0x0f, 0xc7, 0x28, }, 3, 0, "", "", +"0f c7 28 \txsaves (%eax)",}, +{{0x0f, 0xc7, 0x2d, 0x78, 0x56, 0x34, 0x12, }, 7, 0, "", "", +"0f c7 2d 78 56 34 12 \txsaves 0x12345678",}, +{{0x0f, 0xc7, 0xac, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 ac c8 78 56 34 12 \txsaves 0x12345678(%eax,%ecx,8)",}, +{{0x0f, 0xc7, 0x18, }, 3, 0, "", "", +"0f c7 18 \txrstors (%eax)",}, +{{0x0f, 0xc7, 0x1d, 0x78, 0x56, 0x34, 0x12, }, 7, 0, "", "", +"0f c7 1d 78 56 34 12 \txrstors 0x12345678",}, +{{0x0f, 0xc7, 0x9c, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 9c c8 78 56 34 12 \txrstors 0x12345678(%eax,%ecx,8)",}, {{0x66, 0x0f, 0xae, 0xf8, }, 4, 0, "", "", "66 0f ae f8 \tpcommit ",},
tools/perf/tests/insn-x86-dat-64.c +30 -0
@@ -734,5 +734,35 @@ "41 0f ae 30 \txsaveopt (%r8)",}, {{0x0f, 0xae, 0xf0, }, 3, 0, "", "", "0f ae f0 \tmfence ",}, +{{0x0f, 0xc7, 0x20, }, 3, 0, "", "", +"0f c7 20 \txsavec (%rax)",}, +{{0x41, 0x0f, 0xc7, 0x20, }, 4, 0, "", "", +"41 0f c7 20 \txsavec (%r8)",}, +{{0x0f, 0xc7, 0x24, 0x25, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 24 25 78 56 34 12 \txsavec 0x12345678",}, +{{0x0f, 0xc7, 0xa4, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 a4 c8 78 56 34 12 \txsavec 0x12345678(%rax,%rcx,8)",}, +{{0x41, 0x0f, 0xc7, 0xa4, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"41 0f c7 a4 c8 78 56 34 12 \txsavec 0x12345678(%r8,%rcx,8)",}, +{{0x0f, 0xc7, 0x28, }, 3, 0, "", "", +"0f c7 28 \txsaves (%rax)",}, +{{0x41, 0x0f, 0xc7, 0x28, }, 4, 0, "", "", +"41 0f c7 28 \txsaves (%r8)",}, +{{0x0f, 0xc7, 0x2c, 0x25, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 2c 25 78 56 34 12 \txsaves 0x12345678",}, +{{0x0f, 0xc7, 0xac, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 ac c8 78 56 34 12 \txsaves 0x12345678(%rax,%rcx,8)",}, +{{0x41, 0x0f, 0xc7, 0xac, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"41 0f c7 ac c8 78 56 34 12 \txsaves 0x12345678(%r8,%rcx,8)",}, +{{0x0f, 0xc7, 0x18, }, 3, 0, "", "", +"0f c7 18 \txrstors (%rax)",}, +{{0x41, 0x0f, 0xc7, 0x18, }, 4, 0, "", "", +"41 0f c7 18 \txrstors (%r8)",}, +{{0x0f, 0xc7, 0x1c, 0x25, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 1c 25 78 56 34 12 \txrstors 0x12345678",}, +{{0x0f, 0xc7, 0x9c, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 9c c8 78 56 34 12 \txrstors 0x12345678(%rax,%rcx,8)",}, +{{0x41, 0x0f, 0xc7, 0x9c, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"41 0f c7 9c c8 78 56 34 12 \txrstors 0x12345678(%r8,%rcx,8)",}, {{0x66, 0x0f, 0xae, 0xf8, }, 4, 0, "", "", "66 0f ae f8 \tpcommit ",},
tools/perf/tests/insn-x86-dat-src.c +42 -0
54 lines not on this page · raw message
tools/perf/util/intel-pt-decoder/x86-opcode-map.txt +3 -0
@@ -899,6 +899,9 @@ EndTable GrpTable: Grp9 1: CMPXCHG8B/16B Mq/Mdq +3: xrstors +4: xsavec +5: xsaves 6: VMPTRLD Mq | VMCLEAR Mq (66) | VMXON Mq (F3) | RDRAND Rv (11B) 7: VMPTRST Mq | VMPTRST Mq (F3) | RDSEED Rv (11B) EndTable
Signature · 1 line
2.1.0
Arnaldo Carvalho de Melo
maintainerHi Ingo,
Please consider pulling,
- Arnaldo
The following changes since commit 5b923564ccf43f92969c9e0fd199c8c5db657039:
Merge tag 'perf-urgent-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent (2015-09-02 09:22:53 +0200)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo
for you to fetch changes up to cf2f33a4e54096f90652cca3511fd6a456ea5abe:
perf trace: Add read/write to the file group (2015-09-04 13:22:06 -0300)
----------------------------------------------------------------
perf/core improvements and fixes:
User visible:
- Use PERF_RECORD_SWITCH when available in intel-pt, instead of "sched:sched_switch" events, enabling an unprivileged user to trace multi-threaded or multi-process workloads (Adrian Hunter)
- Always use non inlined file name for 'srcfile' sort key (Andi Kleen)
- Quieten failed to read counter message, helps in systems without backend-stalled-cycles (Andi Kleen)
Infrastructure:
- Add a 'perf test' entry for decoding of new x86 instructions (Adrian Hunter)
- Add new instructions (sha, clflushopt, clwb, pcommit, rdpkru, wrpkru, xsavec, xsaves, xrstors) to the x86 instruction decoder (Adrian Hunter)
- Add a build test to warn when source code drifts happen for the instruction decoder files in the kernel and in tools/perf (Adrian Hunter)
- Copy linux/filter.h to tools/include (He Kuang)
- Support function __get_dynamic_array_len in libtraceevent (He Kuanguuu)
- Tracing path finding/mounting/error reporting refactorings (Jiri Olsa)
- Store CPU socket and core IDs in perf.data (Kan Liang)
- Reorganize add/del probe insertion routines in 'perf probe' (Namhyung Kim, Wang Nan)
----------------------------------------------------------------
Adrian Hunter (8):
perf tools: Display build warning if x86 instruction decoder differs from kernel perf tools: Add a test for decoding of new x86 instructions x86/insn: perf tools: Pedantically tweak opcode map for MPX instructions x86/insn: perf tools: Add new SHA instructions
x86/insn: perf tools: Add new memory instructions
x86/insn: perf tools: Add new memory protection keys instructions x86/insn: perf tools: Add new xsave instructions
perf intel-pt: Add support for PERF_RECORD_SWITCH
Andi Kleen (2):
perf tools: Always use non inlined file name for 'srcfile' sort key perf stat: Quieten failed to read counter message
Arnaldo Carvalho de Melo (1):
perf trace: Add read/write to the file group
He Kuang (2):
perf tools: Copy linux/filter.h to tools/include tools lib traceevent: Support function __get_dynamic_array_len
Jiri Olsa (10):
perf tools: Remove mountpoint arg from perf_debugfs_mount perf tools: Move tracing_path stuff under same namespace tools lib api fs: Move tracing_path interface into api/fs/tracing_path.c tools lib api fs: Move debugfs__strerror_open into tracing_path.c object tools lib api fs: Add STR and PATH_MAX macros to fs object tools lib api fs: Move SYSFS_MAGIC PROC_SUPER_MAGIC into fs.c tools lib api fs: Add debugfs into fs.c object
tools lib api fs: Add tracefs into fs.c object
tools lib api fs: Add FSTYPE__mount() method
tools lib api fs: Add FSTYPE__configured() method
Kan Liang (3):
perf cpumap: Factor out functions to get core_id and socket_id perf tools: Store the cpu socket and core ids in the perf.data header perf session: Don't call dump_sample() when evsel is NULL
Namhyung Kim (4):
perf probe: Split add_perf_probe_events() perf probe: Move print logic into cmd_probe() perf probe: Split del_perf_probe_events() perf probe: Print deleted events in cmd_probe()
Wang Nan (1):
perf probe: Link trace_probe_event into perf_probe_event
arch/x86/lib/x86-opcode-map.txt | 24 +- tools/include/linux/filter.h | 231 ++++++ tools/lib/api/fs/Build | 1 + tools/lib/api/fs/debugfs.c | 52 -- tools/lib/api/fs/fs.c | 117 ++- tools/lib/api/fs/fs.h | 26 +- tools/lib/api/fs/tracing_path.c | 137 ++++ tools/lib/api/fs/tracing_path.h | 16 + tools/lib/traceevent/event-parse.c | 56 +- tools/lib/traceevent/event-parse.h | 1 + tools/perf/MANIFEST | 1 + tools/perf/arch/x86/util/intel-pt.c | 55 +- tools/perf/builtin-probe.c | 110 ++- tools/perf/builtin-stat.c | 2 +- tools/perf/builtin-trace.c | 5 +- tools/perf/perf.c | 12 +- tools/perf/tests/Build | 3 + tools/perf/tests/builtin-test.c | 8 + tools/perf/tests/gen-insn-x86-dat.awk | 75 ++ tools/perf/tests/gen-insn-x86-dat.sh | 43 + tools/perf/tests/insn-x86-dat-32.c | 658 ++++++++++++++++ tools/perf/tests/insn-x86-dat-64.c | 768 ++++++++++++++++++ tools/perf/tests/insn-x86-dat-src.c | 877 +++++++++++++++++++++ tools/perf/tests/insn-x86.c | 184 +++++ tools/perf/tests/tests.h | 1 + tools/perf/trace/strace/groups/file | 2 + tools/perf/util/cpumap.c | 51 +- tools/perf/util/cpumap.h | 2 + tools/perf/util/header.c | 94 ++- tools/perf/util/header.h | 6 + tools/perf/util/intel-pt-decoder/Build | 13 +- .../perf/util/intel-pt-decoder/x86-opcode-map.txt | 24 +- tools/perf/util/intel-pt.c | 129 ++- tools/perf/util/parse-events.c | 2 +- tools/perf/util/probe-event.c | 97 +-- tools/perf/util/probe-event.h | 9 + tools/perf/util/probe-file.c | 41 +- tools/perf/util/probe-file.h | 4 + .../perf/util/scripting-engines/trace-event-perl.c | 1 + .../util/scripting-engines/trace-event-python.c | 1 + tools/perf/util/session.c | 3 +- tools/perf/util/sort.c | 4 +- tools/perf/util/srcline.c | 29 +- tools/perf/util/trace-event-info.c | 2 +- tools/perf/util/trace-event.c | 1 + tools/perf/util/util.c | 70 -- tools/perf/util/util.h | 8 +- 47 files changed, 3762 insertions(+), 294 deletions(-) create mode 100644 tools/include/linux/filter.h create mode 100644 tools/lib/api/fs/tracing_path.c create mode 100644 tools/lib/api/fs/tracing_path.h create mode 100644 tools/perf/tests/gen-insn-x86-dat.awk create mode 100755 tools/perf/tests/gen-insn-x86-dat.sh create mode 100644 tools/perf/tests/insn-x86-dat-32.c create mode 100644 tools/perf/tests/insn-x86-dat-64.c create mode 100644 tools/perf/tests/insn-x86-dat-src.c create mode 100644 tools/perf/tests/insn-x86.c
Arnaldo Carvalho de Melo
maintainerPATCH 18/31 perf tools: Add a test for decoding of new x86 instructions
From: Adrian Hunter <[email protected]>
Add a new test titled:
Test x86 instruction decoder - new instructions
The purpose of this test is to check the instruction decoder after new instructions have been added. Initially, MPX instructions are tested which are already supported, but the definitions in x86-opcode-map.txt will be tweaked in a subsequent patch, after which this test can be run to verify those changes.
The data for the test comes from assembly language instructions in insn-x86-dat-src.c which is converted into bytes by the scripts gen-insn-x86-dat.sh and gen-insn-x86-dat.awk, and included into the test program insn-x86.c as insn-x86-dat-32.c and insn-x86-dat-64.c.
The conversion is not done as part of the perf tools build because the test data must be under (git) change control in order for the test to be repeatably-correct. Also it may require a recent version of binutils.
Commiter notes:
Using it:
# perf test decoder 39: Test x86 instruction decoder - new instructions : Ok # perf test -v decoder 39: Test x86 instruction decoder - new instructions : --- start --- test child forked, pid 21970 Decoded ok: 0f 31 rdtsc Decoded ok: f3 0f 1b 00 bndmk (%eax),%bnd0 Decoded ok: f3 0f 1b 05 78 56 34 12 bndmk 0x12345678,%bnd0 Decoded ok: f3 0f 1b 18 bndmk (%eax),%bnd3 <SNIP> Decoded ok: f2 e9 00 00 00 00 bnd jmpq 402 <main+0x402> Decoded ok: f2 e9 00 00 00 00 bnd jmpq 408 <main+0x408> Decoded ok: 67 f2 ff 21 bnd jmpq *(%ecx) Decoded ok: f2 0f 85 00 00 00 00 bnd jne 413 <main+0x413> test child finished with 0 ---- end ---- Test x86 instruction decoder - new instructions: Ok #
--- tools/perf/tests/Build | 3 + tools/perf/tests/builtin-test.c | 8 + tools/perf/tests/gen-insn-x86-dat.awk | 75 ++++++ tools/perf/tests/gen-insn-x86-dat.sh | 43 ++++ tools/perf/tests/insn-x86-dat-32.c | 324 ++++++++++++++++++++++++++ tools/perf/tests/insn-x86-dat-64.c | 340 +++++++++++++++++++++++++++ tools/perf/tests/insn-x86-dat-src.c | 416 ++++++++++++++++++++++++++++++++++ tools/perf/tests/insn-x86.c | 180 +++++++++++++++ tools/perf/tests/tests.h | 1 + 9 files changed, 1390 insertions(+) create mode 100644 tools/perf/tests/gen-insn-x86-dat.awk create mode 100755 tools/perf/tests/gen-insn-x86-dat.sh create mode 100644 tools/perf/tests/insn-x86-dat-32.c create mode 100644 tools/perf/tests/insn-x86-dat-64.c create mode 100644 tools/perf/tests/insn-x86-dat-src.c create mode 100644 tools/perf/tests/insn-x86.c
tools/perf/tests/Build +3 -0
@@ -35,6 +35,9 @@ perf-y += thread-map.o perf-y += llvm.o perf-$(CONFIG_X86) += perf-time-to-tsc.o +ifdef CONFIG_AUXTRACE +perf-$(CONFIG_X86) += insn-x86.o +endif ifeq ($(ARCH),$(filter $(ARCH),x86 arm arm64)) perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o
tools/perf/tests/builtin-test.c +8 -0
@@ -178,6 +178,14 @@ static struct test { .desc = "Test LLVM searching and compiling", .func = test__llvm, }, +#ifdef HAVE_AUXTRACE_SUPPORT +#if defined(__x86_64__) || defined(__i386__) + { + .desc = "Test x86 instruction decoder - new instructions", + .func = test__insn_x86, + }, +#endif +#endif { .func = NULL, },
tools/perf/tests/gen-insn-x86-dat.awk new file +75 -0
75 lines not on this page · raw message
tools/perf/tests/gen-insn-x86-dat.sh new file +43 -0
43 lines not on this page · raw message
tools/perf/tests/insn-x86-dat-32.c new file +324 -0
324 lines not on this page · raw message
tools/perf/tests/insn-x86-dat-64.c new file +340 -0
340 lines not on this page · raw message
tools/perf/tests/insn-x86-dat-src.c new file +416 -0
416 lines not on this page · raw message
tools/perf/tests/insn-x86.c new file +180 -0
180 lines not on this page · raw message
tools/perf/tests/tests.h +1 -0
@@ -63,6 +63,7 @@ int test__fdarray__add(void);int test__kmod_path__parse (void );int test__thread_map (void );int test__llvm (void ); +int test__insn_x86 (void );#if defined(__x86_64__) || defined(__i386__) || defined(__arm__) || defined(__aarch64__)#ifdef HAVE_DWARF_UNWIND_SUPPORT
Signature · 1 line
2.1.0
Arnaldo Carvalho de Melo
maintainerPATCH 6/31 perf stat: Quieten failed to read counter message
In reply to Arnaldo Carvalho de MeloFrom: Andi Kleen <[email protected]>
Since 3b3eb0445 running perf stat on a system without backend-stalled-cycles spits out ugly warnings by default.
Since that is quite common, make the message a debug message only.
We know anyways that the counter wasn't read by the normal <unsupported> output.
--- tools/perf/builtin-stat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-stat.c +1 -1
@@ -215,7 +215,7 @@ static void read_counters(bool close_counters)evlist__for_each (evsel_list, counter) {if (read_counter (counter)) -pr_warning ("failed to read counter %s\n" , counter->name); +pr_debug ("failed to read counter %s\n" , counter->name);if (perf_stat_process_counter (&stat_config, counter))pr_warning ("failed to process counter %s\n" , counter->name);
Signature · 1 line
2.1.0
Arnaldo Carvalho de Melo
maintainerPATCH 24/31 perf session: Don't call dump_sample() when evsel is NULL
In reply to Arnaldo Carvalho de MeloFrom: Kan Liang <[email protected]>
Need to check evsel before passing it to dump_sample().
--- tools/perf/util/session.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/session.c +1 -1
@@ -1080,11 +1080,11 @@ static int machines__deliver_event(struct machines *machines,switch (event->header.type) {case PERF_RECORD_SAMPLE : -dump_sample (evsel, event, sample);if (evsel ==NULL ) { ++evlist->stats.nr_unknown_id;return 0 ; } +dump_sample (evsel, event, sample);if (machine ==NULL ) { ++evlist->stats.nr_unprocessable_samples;return 0 ;
Signature · 1 line
2.1.0
Arnaldo Carvalho de Melo
maintainerPATCH 22/31 x86/insn: perf tools: Add new memory protection keys instructions
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
Add rdpkru and wrpkru to the op code map and the perf tools new instructions test. In the case of the test, only the bytes can be tested at the moment since binutils doesn't support the instructions yet. To run the test:
$ tools/perf/perf test "x86 ins" 39: Test x86 instruction decoder - new instructions : Ok
Or to see the details:
$ tools/perf/perf test -v "x86 ins" 2>&1 | grep pkru
For information about rdpkru and wrpkru, refer the Intel SDM.
--- arch/x86/lib/x86-opcode-map.txt | 2 +- tools/perf/tests/insn-x86.c | 4 ++++ tools/perf/util/intel-pt-decoder/x86-opcode-map.txt | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-)
arch/x86/lib/x86-opcode-map.txt +1 -1
@@ -885,7 +885,7 @@ GrpTable: Grp7 2: LGDT Ms | XGETBV (000),(11B) | XSETBV (001),(11B) | VMFUNC (100),(11B) | XEND (101)(11B) | XTEST (110)(11B) 3: LIDT Ms 4: SMSW Mw/Rv -5: +5: rdpkru (110),(11B) | wrpkru (111),(11B) 6: LMSW Ew 7: INVLPG Mb | SWAPGS (o64),(000),(11B) | RDTSCP (001),(11B) EndTable
tools/perf/tests/insn-x86.c +4 -0
@@ -17,11 +17,15 @@ struct test_data {struct test_data test_data_32[] = { #include "insn-x86-dat-32.c" + {{0x0f ,0x01 ,0xee },3 ,0 ,NULL ,NULL ,"0f 01 ee \trdpkru" }, + {{0x0f ,0x01 ,0xef },3 ,0 ,NULL ,NULL ,"0f 01 ef \twrpkru" }, {{0 },0 ,0 ,NULL ,NULL ,NULL }, };struct test_data test_data_64[] = { #include "insn-x86-dat-64.c" + {{0x0f ,0x01 ,0xee },3 ,0 ,NULL ,NULL ,"0f 01 ee \trdpkru" }, + {{0x0f ,0x01 ,0xef },3 ,0 ,NULL ,NULL ,"0f 01 ef \twrpkru" }, {{0 },0 ,0 ,NULL ,NULL ,NULL }, };
tools/perf/util/intel-pt-decoder/x86-opcode-map.txt +1 -1
@@ -885,7 +885,7 @@ GrpTable: Grp7 2: LGDT Ms | XGETBV (000),(11B) | XSETBV (001),(11B) | VMFUNC (100),(11B) | XEND (101)(11B) | XTEST (110)(11B) 3: LIDT Ms 4: SMSW Mw/Rv -5: +5: rdpkru (110),(11B) | wrpkru (111),(11B) 6: LMSW Ew 7: INVLPG Mb | SWAPGS (o64),(000),(11B) | RDTSCP (001),(11B) EndTable
Signature · 1 line
2.1.0
Arnaldo Carvalho de Melo
maintainerPATCH 9/31 tools lib api fs: Move tracing_path interface into api/fs/tracing_path.c
In reply to Arnaldo Carvalho de MeloFrom: Jiri Olsa <[email protected]>
Moving tracing_path interface into api/fs/tracing_path.c out of util.c. It seems generic enough to be used by others, and I couldn't think of better place.
--- tools/lib/api/fs/Build | 1 + tools/lib/api/fs/tracing_path.c | 83 ++++++++++++++++++++++++++++++++++++++ tools/lib/api/fs/tracing_path.h | 13 ++++++ tools/perf/perf.c | 2 +- tools/perf/util/parse-events.c | 2 +- tools/perf/util/trace-event-info.c | 2 +- tools/perf/util/trace-event.c | 1 + tools/perf/util/util.c | 70 -------------------------------- tools/perf/util/util.h | 6 --- 9 files changed, 101 insertions(+), 79 deletions(-) create mode 100644 tools/lib/api/fs/tracing_path.c create mode 100644 tools/lib/api/fs/tracing_path.h
tools/lib/api/fs/Build +1 -0
@@ -1,4 +1,5 @@ libapi-y += fs.o +libapi-y += tracing_path.o libapi-y += debugfs.o libapi-y += findfs.o libapi-y += tracefs.o
tools/lib/api/fs/tracing_path.c new file +83 -0
83 lines not on this page · raw message
tools/lib/api/fs/tracing_path.h new file +13 -0
@@ -0,0 +1,13 @@ +#ifndef __API_FS_TRACING_PATH_H +#define __API_FS_TRACING_PATH_H + +extern char tracing_path[]; +extern char tracing_events_path[]; + +void tracing_path_set (const char *mountpoint); +const char *tracing_path_mount (void ); + +char *get_tracing_file (const char *name); +void put_tracing_file (char *file); + +#endif /* __API_FS_TRACING_PATH_H */
tools/perf/perf.c +1 -1
@@ -15,7 +15,7 @@#include "util/parse-events.h" #include "util/parse-options.h" #include "util/debug.h" -#include <api/fs/debugfs.h> +#include <api/fs/tracing_path.h> #include <pthread.h> const char perf_usage_string[] =
tools/perf/util/parse-events.c +1 -1
@@ -11,7 +11,7 @@#include "cache.h" #include "header.h" #include "debug.h" -#include <api/fs/debugfs.h> +#include <api/fs/tracing_path.h> #include "parse-events-bison.h" #define YY_EXTRA_TYPE int#include "parse-events-flex.h"
tools/perf/util/trace-event-info.c +1 -1
@@ -38,7 +38,7 @@#include "../perf.h" #include "trace-event.h" -#include <api/fs/debugfs.h> +#include <api/fs/tracing_path.h> #include "evsel.h" #include "debug.h"
tools/perf/util/trace-event.c +1 -0
@@ -8,6 +8,7 @@#include <fcntl.h> #include <linux/kernel.h> #include <traceevent/event-parse.h> +#include <api/fs/tracing_path.h> #include "trace-event.h" #include "machine.h" #include "util.h"
tools/perf/util/util.c +0 -70
82 lines not on this page · raw message
tools/perf/util/util.h +0 -6
@@ -83,12 +83,6 @@extern const char *graph_line;extern const char *graph_dotted_line;extern char buildid_dir[]; -extern char tracing_path[]; -extern char tracing_events_path[]; -extern void tracing_path_set (const char *mountpoint); -const char *tracing_path_mount (void ); -char *get_tracing_file (const char *name); -void put_tracing_file (char *file);/* On most systems <limits.h> would have given us this, but * not on some systems (e.g. GNU/Hurd).
Signature · 1 line
2.1.0
Arnaldo Carvalho de Melo
maintainerPATCH 12/31 tools lib api fs: Move SYSFS_MAGIC PROC_SUPER_MAGIC into fs.c
In reply to Arnaldo Carvalho de MeloFrom: Jiri Olsa <[email protected]>
There's no need to export SYSFS_MAGIC PROC_SUPER_MAGIC in fs.h. Leave them in the fs.c.
--- tools/lib/api/fs/fs.c | 8 ++++++++ tools/lib/api/fs/fs.h | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-)
tools/lib/api/fs/fs.c +8 -0
@@ -18,6 +18,14 @@#define _STR (x) #x#define STR (x) _STR(x) +#ifndef SYSFS_MAGIC +#define SYSFS_MAGIC 0x62656572 +#endif + +#ifndef PROC_SUPER_MAGIC +#define PROC_SUPER_MAGIC 0x9fa0 +#endif +static const char *const sysfs__fs_known_mountpoints[] = {"/sys" ,0 ,
tools/lib/api/fs/fs.h +0 -8
@@ -9,14 +9,6 @@#define PATH_MAX 4096#endif -#ifndef SYSFS_MAGIC -#define SYSFS_MAGIC 0x62656572 -#endif - -#ifndef PROC_SUPER_MAGIC -#define PROC_SUPER_MAGIC 0x9fa0 -#endif -const char *sysfs__mountpoint (void );const char *procfs__mountpoint (void );
Signature · 1 line
2.1.0
Arnaldo Carvalho de Melo
maintainerPATCH 31/31 perf trace: Add read/write to the file group
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
--- tools/perf/trace/strace/groups/file | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/trace/strace/groups/file +2 -0
@@ -9,6 +9,7 @@ mkdir open openat quotactl +read readlink rename rmdir
@@ -16,3 +17,4 @@ stat statfs symlink unlink +write
Signature · 1 line
2.1.0
Arnaldo Carvalho de Melo
maintainerPATCH 15/31 tools lib api fs: Add FSTYPE__mount() method
In reply to Arnaldo Carvalho de MeloFrom: Jiri Olsa <[email protected]>
Adding FSTYPE__mount (where FSTYPE is, as of now, one of sysfs, procfs, debugfs, tracefs) method that tries to mount the filesystem in case no mount of FSTYPE is found.
--- tools/lib/api/fs/fs.c | 44 +++++++++++++++++++++++++++++++++++++++----- tools/lib/api/fs/fs.h | 15 +++++++++++---- 2 files changed, 50 insertions(+), 9 deletions(-)
tools/lib/api/fs/fs.c +39 -5
@@ -9,6 +9,7 @@#include <sys/stat.h> #include <fcntl.h> #include <unistd.h> +#include <sys/mount.h> #include "debugfs.h" #include "fs.h"
@@ -215,16 +216,49 @@ static const char *fs__mountpoint(int idx)return fs__get_mountpoint (fs); } -#define FS__MOUNTPOINT (name, idx) \ +static const char *mount_overload (struct fs *fs) +{ +size_t name_len =strlen (fs->name); +/* "PERF_" + name + "_ENVIRONMENT" + '\0' */ +char upper_name[5 + name_len +12 +1 ]; + +snprintf (upper_name, name_len,"PERF_%s_ENVIRONMENT" , fs->name); +mem_toupper (upper_name, name_len); + +return getenv (upper_name) ?: *fs->mounts; +} + +static const char *fs__mount (int idx) +{ +struct fs *fs = &fs__entries[idx]; +const char *mountpoint; + +if (fs__mountpoint (idx)) +return (const char *)fs->path; + + mountpoint =mount_overload (fs); + +if (mount (NULL , mountpoint, fs->name,0 ,NULL ) <0 ) +return NULL ; + +return fs__check_mounts (fs) ? fs->path :NULL ; +} + +#define FS (name, idx) \ const char *name##__mountpoint(void) \ { \ return fs__mountpoint(idx); \ +} \ + \ +const char *name##__mount(void) \ +{ \ + return fs__mount(idx); \ } -FS__MOUNTPOINT (sysfs,FS__SYSFS ); -FS__MOUNTPOINT (procfs,FS__PROCFS ); -FS__MOUNTPOINT (debugfs,FS__DEBUGFS ); -FS__MOUNTPOINT (tracefs,FS__TRACEFS ); +FS (sysfs,FS__SYSFS ); +FS (procfs,FS__PROCFS ); +FS (debugfs,FS__DEBUGFS ); +FS (tracefs,FS__TRACEFS );int filename__read_int (const char *filename,int *value) {
tools/lib/api/fs/fs.h +11 -4
@@ -9,10 +9,17 @@#define PATH_MAX 4096#endif -const char *sysfs__mountpoint (void ); -const char *procfs__mountpoint (void ); -const char *debugfs__mountpoint (void ); -const char *tracefs__mountpoint (void ); +#define FS (name) \ + const char *name##__mountpoint(void); \ + const char *name##__mount(void); + +FS(sysfs) +FS(procfs) +FS(debugfs) +FS(tracefs) + +#undef FS +int filename__read_int (const char *filename,int *value);int sysctl__read_int (const char *sysctl,int *value);
Signature · 1 line
2.1.0
Arnaldo Carvalho de Melo
maintainerPATCH 16/31 tools lib api fs: Add FSTYPE__configured() method
In reply to Arnaldo Carvalho de MeloFrom: Jiri Olsa <[email protected]>
Add FSTYPE__configured() (where FSTYPE is one of sysfs, procfs, debugfs, tracefs) interface that returns bool state of the filesystem mount:
true - mounted, false - not mounted
It will not try to mount the filesystem.
--- tools/lib/api/fs/fs.c | 23 ++++++++++++++--------- tools/lib/api/fs/fs.h | 5 ++++- 2 files changed, 18 insertions(+), 10 deletions(-)
tools/lib/api/fs/fs.c +14 -9
@@ -244,15 +244,20 @@ static const char *fs__mount(int idx)return fs__check_mounts (fs) ? fs->path :NULL ; } -#define FS (name, idx) \ -const char *name##__mountpoint(void) \ -{ \ - return fs__mountpoint(idx); \ -} \ - \ -const char *name##__mount(void) \ -{ \ - return fs__mount(idx); \ +#define FS (name, idx) \ +const char *name##__mountpoint(void) \ +{ \ + return fs__mountpoint(idx); \ +} \ + \ +const char *name##__mount(void) \ +{ \ + return fs__mount(idx); \ +} \ + \ +bool name##__configured(void) \ +{ \ + return name##__mountpoint() != NULL; \ }FS (sysfs,FS__SYSFS );
tools/lib/api/fs/fs.h +4 -1
@@ -1,6 +1,8 @@#ifndef __API_FS__#define __API_FS__ +#include <stdbool.h> +/* * On most systems <limits.h> would have given us this, but not on some systems * (e.g. GNU/Hurd).
@@ -11,7 +13,8 @@#define FS (name) \ const char *name##__mountpoint(void); \ - const char *name##__mount(void); + const char *name##__mount(void); \ + bool name##__configured(void); \FS (sysfs)FS (procfs)
Signature · 1 line
2.1.0
Arnaldo Carvalho de Melo
maintainerPATCH 13/31 tools lib api fs: Add debugfs into fs.c object
In reply to Arnaldo Carvalho de MeloFrom: Jiri Olsa <[email protected]>
Adding debugfs support into fs.c framework. It'll replace the debugfs object functionality in following patches.
--- tools/lib/api/fs/fs.c | 31 +++++++++++++++++++++++++------ tools/lib/api/fs/fs.h | 1 + 2 files changed, 26 insertions(+), 6 deletions(-)
tools/lib/api/fs/fs.c +25 -6
@@ -1,5 +1,3 @@ -/* TODO merge/factor in debugfs.c here */ -#include <ctype.h> #include <errno.h> #include <stdbool.h>
@@ -26,6 +24,10 @@#define PROC_SUPER_MAGIC 0x9fa0#endif +#ifndef DEBUGFS_MAGIC +#define DEBUGFS_MAGIC 0x64626720 +#endif +static const char *const sysfs__fs_known_mountpoints[] = {"/sys" ,0 ,
@@ -36,6 +38,16 @@ static const char * const procfs__known_mountpoints[] = { 0, }; +#ifndef DEBUGFS_DEFAULT_PATH +#define DEBUGFS_DEFAULT_PATH "/sys/kernel/debug" +#endif + +static const char *const debugfs__known_mountpoints[] = { +DEBUGFS_DEFAULT_PATH , +"/debug" , +0 , +}; +struct fs {const char *name;const char *const *mounts;
@@ -45,8 +57,9 @@ struct fs { };enum { -FS__SYSFS =0 , -FS__PROCFS =1 , +FS__SYSFS =0 , +FS__PROCFS =1 , +FS__DEBUGFS =2 , };static struct fs fs__entries[] = {
@@ -60,6 +73,11 @@ static struct fs fs__entries[] = { .mounts = procfs__known_mountpoints, .magic = PROC_SUPER_MAGIC, }, + [FS__DEBUGFS] = { + .name = "debugfs", + .mounts = debugfs__known_mountpoints, + .magic = DEBUGFS_MAGIC, + }, };static bool fs__read_mounts (struct fs *fs)
@@ -176,8 +194,9 @@ const char *name##__mountpoint(void) \return fs__mountpoint (idx); \ } -FS__MOUNTPOINT (sysfs,FS__SYSFS ); -FS__MOUNTPOINT (procfs,FS__PROCFS ); +FS__MOUNTPOINT (sysfs,FS__SYSFS ); +FS__MOUNTPOINT (procfs,FS__PROCFS ); +FS__MOUNTPOINT (debugfs,FS__DEBUGFS );int filename__read_int (const char *filename,int *value) {
tools/lib/api/fs/fs.h +1 -0
@@ -11,6 +11,7 @@const char *sysfs__mountpoint (void );const char *procfs__mountpoint (void ); +const char *debugfs__mountpoint (void );int filename__read_int (const char *filename,int *value);int sysctl__read_int (const char *sysctl,int *value);
Signature · 1 line
2.1.0
Arnaldo Carvalho de Melo
maintainerPATCH 10/31 tools lib api fs: Move debugfs__strerror_open into tracing_path.c object
In reply to Arnaldo Carvalho de MeloFrom: Jiri Olsa <[email protected]>
Moving debugfs__strerror_open out of api/fs/debugfs.c, because it's not debugfs specific. It'll be changed to consider tracefs mount as well in following patches.
Renaming it into tracing_path__strerror_open_tp to fit into the namespace. No functional change is intended.
--- tools/lib/api/fs/debugfs.c | 52 --------------------------------------- tools/lib/api/fs/tracing_path.c | 54 +++++++++++++++++++++++++++++++++++++++++ tools/lib/api/fs/tracing_path.h | 3 +++ tools/perf/builtin-trace.c | 5 ++-- 4 files changed, 60 insertions(+), 54 deletions(-)
tools/lib/api/fs/debugfs.c +0 -52
@@ -75,55 +75,3 @@ char *debugfs_mount(const char *mountpoint) out:return debugfs_mountpoint; } - -int debugfs__strerror_open (int err,char *buf,size_t size,const char *filename) -{ -char sbuf[128 ]; - -switch (err) { -case ENOENT : -if (debugfs_found) { -snprintf (buf, size, -"Error:\tFile %s/%s not found.\n" -"Hint:\tPerhaps this kernel misses some CONFIG_ setting to enable this feature?.\n" , - debugfs_mountpoint, filename); -break ; - } -snprintf (buf, size,"%s" , -"Error:\tUnable to find debugfs\n" -"Hint:\tWas your kernel compiled with debugfs support?\n" -"Hint:\tIs the debugfs filesystem mounted?\n" -"Hint:\tTry 'sudo mount -t debugfs nodev /sys/kernel/debug'" ); -break ; -case EACCES : { -const char *mountpoint = debugfs_mountpoint; - -if (!access (debugfs_mountpoint,R_OK ) &&strncmp (filename,"tracing/" ,8 ) ==0 ) { -const char *tracefs_mntpoint =tracefs_find_mountpoint (); - -if (tracefs_mntpoint) - mountpoint = tracefs_mntpoint; - } - -snprintf (buf, size, -"Error:\tNo permissions to read %s/%s\n" -"Hint:\tTry 'sudo mount -o remount,mode=755 %s'\n" , - debugfs_mountpoint, filename, mountpoint); - } -break ; -default : -snprintf (buf, size,"%s" ,strerror_r (err, sbuf,sizeof (sbuf))); -break ; - } - -return 0 ; -} - -int debugfs__strerror_open_tp (int err,char *buf,size_t size,const char *sys,const char *name) -{ -char path[PATH_MAX ]; - -snprintf (path,PATH_MAX ,"tracing/events/%s/%s" , sys, name ?:"*" ); - -return debugfs__strerror_open (err, buf, size, path); -}
tools/lib/api/fs/tracing_path.c +54 -0
63 lines not on this page · raw message
tools/lib/api/fs/tracing_path.h +3 -0
@@ -1,6 +1,8 @@#ifndef __API_FS_TRACING_PATH_H#define __API_FS_TRACING_PATH_H +#include <linux/types.h> +extern char tracing_path[];extern char tracing_events_path[];
@@ -10,4 +12,5 @@ const char *tracing_path_mount(void);char *get_tracing_file (const char *name);void put_tracing_file (char *file); +int tracing_path__strerror_open_tp (int err,char *buf,size_t size,const char *sys,const char *name);#endif /* __API_FS_TRACING_PATH_H */
tools/perf/builtin-trace.c +3 -2
@@ -17,6 +17,7 @@*/ #include <traceevent/event-parse.h> +#include <api/fs/tracing_path.h> #include "builtin.h" #include "util/color.h" #include "util/debug.h"
@@ -2686,11 +2687,11 @@ out_delete_evlist:char errbuf[BUFSIZ ]; out_error_sched_stat_runtime: -debugfs__strerror_open_tp (errno, errbuf,sizeof (errbuf),"sched" ,"sched_stat_runtime" ); +tracing_path__strerror_open_tp (errno, errbuf,sizeof (errbuf),"sched" ,"sched_stat_runtime" ); goto out_error; out_error_raw_syscalls: -debugfs__strerror_open_tp (errno, errbuf,sizeof (errbuf),"raw_syscalls" ,"sys_(enter|exit)" ); +tracing_path__strerror_open_tp (errno, errbuf,sizeof (errbuf),"raw_syscalls" ,"sys_(enter|exit)" ); goto out_error; out_error_mmap:
Signature · 1 line
2.1.0
Arnaldo Carvalho de Melo
maintainerPATCH 5/31 perf tools: Store the cpu socket and core ids in the perf.data header
In reply to Arnaldo Carvalho de MeloFrom: Kan Liang <[email protected]>
This patch stores the cpu socket_id and core_id in a perf.data header, and reads them into the perf_env struct when processing perf.data files.
The changes modifies the CPU_TOPOLOGY section, making sure it is backward/forward compatible.
The patch checks the section size before reading the core and socket ids.
It never reads data crossing the section boundary. An old perf binary without this patch can also correctly read the perf.data from a new perf with this patch.
Because the new info is added at the end of the cpu_topology section, an old perf tool ignores the extra data.
Examples:
1. New perf with this patch read perf.data from an old perf without the patch:
$ perf_new report -i perf_old.data --header-only -I ...... # sibling threads : 33 # sibling threads : 34 # sibling threads : 35 # Core ID and Socket ID information is not available # node0 meminfo : total = 32823872 kB, free = 29315548 kB # node0 cpu list : 0-17,36-53 ......
2. Old perf without the patch reads perf.data from a new perf with the patch:
$ perf_old report -i perf_new.data --header-only -I ...... # sibling threads : 33 # sibling threads : 34 # sibling threads : 35 # node0 meminfo : total = 32823872 kB, free = 29190932 kB # node0 cpu list : 0-17,36-53 ......
3. New perf read new perf.data:
$ perf_new report -i perf_new.data --header-only -I ...... # sibling threads : 33 # sibling threads : 34 # sibling threads : 35 # CPU 0: Core ID 0, Socket ID 0 # CPU 1: Core ID 1, Socket ID 0 ...... # CPU 61: Core ID 10, Socket ID 1 # CPU 62: Core ID 11, Socket ID 1 # CPU 63: Core ID 16, Socket ID 1 # node0 meminfo : total = 32823872 kB, free = 29190932 kB # node0 cpu list : 0-17,36-53
--- tools/perf/util/header.c | 94 ++++++++++++++++++++++++++++++++++++++++++++--- tools/perf/util/header.h | 6 +++ tools/perf/util/session.c | 1 + 3 files changed, 96 insertions(+), 5 deletions(-)
tools/perf/util/header.c +89 -5
@@ -88,6 +88,9 @@ int write_padded(int fd, const void *bf, size_t count, size_t count_aligned)return err; } +#define string_size (str) \ + (PERF_ALIGN((strlen(str) + 1), NAME_ALIGN) + sizeof(u32)) +static int do_write_string (int fd,const char *str) {u32 len, olen;
@@ -441,10 +444,13 @@ static int write_cmdline(int fd, struct perf_header *h __maybe_unused,"/sys/devices/system/cpu/cpu%d/topology/thread_siblings_list" struct cpu_topo { +u32 cpu_nr;u32 core_sib;u32 thread_sib;char **core_siblings;char **thread_siblings; +int *core_id; +int *phy_pkg_id; };static int build_cpu_topo (struct cpu_topo *tp,int cpu)
@@ -507,6 +513,9 @@ try_threads: } ret =0 ; done: + tp->core_id[cpu] =cpu_map__get_core_id (cpu); + tp->phy_pkg_id[cpu] =cpu_map__get_socket_id (cpu); +if (fp)fclose (fp);free (buf);
@@ -534,7 +543,7 @@ static struct cpu_topo *build_cpu_topology(void)struct cpu_topo *tp;void *addr;u32 nr, i; -size_t sz; +size_t sz, sz_id;long ncpus;int ret =-1 ;
@@ -545,17 +554,22 @@ static struct cpu_topo *build_cpu_topology(void) nr = (u32)(ncpus &UINT_MAX ); sz = nr *sizeof (char *); + sz_id = nr *sizeof (int ); - addr =calloc (1 ,sizeof (*tp) +2 * sz); + addr =calloc (1 ,sizeof (*tp) +2 * sz +2 * sz_id);if (!addr)return NULL ; tp = addr; - + tp->cpu_nr = nr; addr +=sizeof (*tp); tp->core_siblings = addr; addr += sz; tp->thread_siblings = addr; + addr += sz; + tp->core_id = addr; + addr += sz_id; + tp->phy_pkg_id = addr;for (i =0 ; i < nr; i++) { ret =build_cpu_topo (tp, i);
@@ -598,6 +612,15 @@ static int write_cpu_topology(int fd, struct perf_header *h __maybe_unused,if (ret <0 )break ; } + +for (i =0 ; i < tp->cpu_nr; i++) { + ret =do_write (fd, &tp->core_id[i],sizeof (int )); +if (ret <0 ) +return ret; + ret =do_write (fd, &tp->phy_pkg_id[i],sizeof (int )); +if (ret <0 ) +return ret; + } done:free_cpu_topo (tp);return ret;
@@ -938,6 +961,7 @@ static void print_cpu_topology(struct perf_header *ph, int fd __maybe_unused, {int nr, i;char *str; +int cpu_nr = ph->env.nr_cpus_online; nr = ph->env.nr_sibling_cores; str = ph->env.sibling_cores;
@@ -954,6 +978,13 @@ static void print_cpu_topology(struct perf_header *ph, int fd __maybe_unused,fprintf (fp,"# sibling threads : %s\n" , str); str +=strlen (str) +1 ; } + +if (ph->env.cpu !=NULL ) { +for (i =0 ; i < cpu_nr; i++) +fprintf (fp,"# CPU %d: Core ID %d, Socket ID %d\n" , i, + ph->env.cpu[i].core_id, ph->env.cpu[i].socket_id); + }else +fprintf (fp,"# Core ID and Socket ID information is not available\n" ); }static void free_event_desc (struct perf_evsel *events)
@@ -1582,7 +1613,7 @@ error:return -1 ; } -static int process_cpu_topology (struct perf_file_section *section__maybe_unused , +static int process_cpu_topology (struct perf_file_section *section,struct perf_header *ph,int fd,void *data__maybe_unused ) {
@@ -1590,15 +1621,22 @@ static int process_cpu_topology(struct perf_file_section *section __maybe_unusedu32 nr, i;char *str;struct strbuf sb; +int cpu_nr = ph->env.nr_cpus_online; +u64 size =0 ; + + ph->env.cpu =calloc (cpu_nr,sizeof (*ph->env.cpu)); +if (!ph->env.cpu) +return -1 ; ret =readn (fd, &nr,sizeof (nr));if (ret !=sizeof (nr)) -return -1 ; + goto free_cpu;if (ph->needs_swap) nr =bswap_32 (nr); ph->env.nr_sibling_cores = nr; + size +=sizeof (u32);strbuf_init (&sb,128 );for (i =0 ; i < nr; i++) {
@@ -1608,6 +1646,7 @@ static int process_cpu_topology(struct perf_file_section *section __maybe_unused/* include a NULL character at the end */ strbuf_add (&sb, str,strlen (str) +1 ); + size +=string_size (str);free (str); } ph->env.sibling_cores =strbuf_detach (&sb,NULL );
@@ -1620,6 +1659,7 @@ static int process_cpu_topology(struct perf_file_section *section __maybe_unused nr =bswap_32 (nr); ph->env.nr_sibling_threads = nr; + size +=sizeof (u32);for (i =0 ; i < nr; i++) { str =do_read_string (fd, ph);
@@ -1628,13 +1668,57 @@ static int process_cpu_topology(struct perf_file_section *section __maybe_unused/* include a NULL character at the end */ strbuf_add (&sb, str,strlen (str) +1 ); + size +=string_size (str);free (str); } ph->env.sibling_threads =strbuf_detach (&sb,NULL ); + +/* +* The header may be from old perf, +* which doesn't include core id and socket id information. +*/ +if (section->size <= size) { +zfree (&ph->env.cpu); +return 0 ; + } + +for (i =0 ; i < (u32 )cpu_nr; i++) { + ret =readn (fd, &nr,sizeof (nr)); +if (ret !=sizeof (nr)) + goto free_cpu; + +if (ph->needs_swap) + nr =bswap_32 (nr); + +if (nr > (u32 )cpu_nr) { +pr_debug ("core_id number is too big." +"You may need to upgrade the perf tool.\n" ); + goto free_cpu; + } + ph->env.cpu[i].core_id = nr; + + ret =readn (fd, &nr,sizeof (nr)); +if (ret !=sizeof (nr)) + goto free_cpu; + +if (ph->needs_swap) + nr =bswap_32 (nr); + +if (nr > (u32 )cpu_nr) { +pr_debug ("socket_id number is too big." +"You may need to upgrade the perf tool.\n" ); + goto free_cpu; + } + + ph->env.cpu[i].socket_id = nr; + } +return 0 ; error:strbuf_release (&sb); +free_cpu: +zfree (&ph->env.cpu);return -1 ; }
tools/perf/util/header.h +6 -0
@@ -66,6 +66,11 @@ struct perf_header;int perf_file_header__read (struct perf_file_header *header,struct perf_header *ph,int fd); +struct cpu_topology_map { +int socket_id; +int core_id; +}; +struct perf_env {char *hostname;char *os_release;
@@ -89,6 +94,7 @@ struct perf_env {char *sibling_threads;char *numa_nodes;char *pmu_mappings; +struct cpu_topology_map *cpu; };struct perf_header {
tools/perf/util/session.c +1 -0
@@ -185,6 +185,7 @@ static void perf_session_env__exit(struct perf_env *env)zfree (&env->sibling_threads);zfree (&env->numa_nodes);zfree (&env->pmu_mappings); +zfree (&env->cpu); }void perf_session__delete (struct perf_session *session)
Signature · 1 line
2.1.0
Re: [PATCH 10/31] tools lib api fs: Move debugfs__strerror_open into tracing_path.c object
In reply to Arnaldo Carvalho de Melo2015-09-04 12:44 GMT-04:00 Arnaldo Carvalho de Melo <[email protected]>:
Quoted 18 lines
From: Jiri Olsa <[email protected]>
Moving
debugfs__strerror_openout ofapi/fs/debugfs.c, because it's not debugfs specific. It'll be changed to consider tracefs mount as well in following patches.Renaming it into
tracing_path__strerror_open_tpto fit into the namespace. No functional change is intended.Signed-off-by Jiri Olsa <[email protected]>Reviewed-by Matt Fleming <[email protected]>Cc Raphael Beamonte <[email protected]>Cc David Ahern <[email protected]>Cc Namhyung Kim <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Steven Rostedt <[email protected]>Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
Quoted 6 lines
--- tools/lib/api/fs/debugfs.c | 52 --------------------------------------- tools/lib/api/fs/tracing_path.c | 54 +++++++++++++++++++++++++++++++++++++++++ tools/lib/api/fs/tracing_path.h | 3 +++ tools/perf/builtin-trace.c | 5 ++-- 4 files changed, 60 insertions(+), 54 deletions(-)
I perhaps sent it a bit late, but my Reviewed-by can be used here also.
Quoted 177 lines
tools/lib/api/fs/debugfs.c +0
-52@@ -75,55 +75,3 @@ char *debugfs_mount(const char *mountpoint) out:return debugfs_mountpoint; } - -int debugfs__strerror_open (int err,char *buf,size_t size,const char *filename) -{ -char sbuf[128 ]; - -switch (err) { -case ENOENT : -if (debugfs_found) { -snprintf (buf, size, -"Error:\tFile %s/%s not found.\n" -"Hint:\tPerhaps this kernel misses some CONFIG_ setting to enable this feature?.\n" , - debugfs_mountpoint, filename); -break ; - } -snprintf (buf, size,"%s" , -"Error:\tUnable to find debugfs\n" -"Hint:\tWas your kernel compiled with debugfs support?\n" -"Hint:\tIs the debugfs filesystem mounted?\n" -"Hint:\tTry 'sudo mount -t debugfs nodev /sys/kernel/debug'" ); -break ; -case EACCES : { -const char *mountpoint = debugfs_mountpoint; - -if (!access (debugfs_mountpoint,R_OK ) &&strncmp (filename,"tracing/" ,8 ) ==0 ) { -const char *tracefs_mntpoint =tracefs_find_mountpoint (); - -if (tracefs_mntpoint) - mountpoint = tracefs_mntpoint; - } - -snprintf (buf, size, -"Error:\tNo permissions to read %s/%s\n" -"Hint:\tTry 'sudo mount -o remount,mode=755 %s'\n" , - debugfs_mountpoint, filename, mountpoint); - } -break ; -default : -snprintf (buf, size,"%s" ,strerror_r (err, sbuf,sizeof (sbuf))); -break ; - } - -return 0 ; -} - -int debugfs__strerror_open_tp (int err,char *buf,size_t size,const char *sys,const char *name) -{ -char path[PATH_MAX ]; - -snprintf (path,PATH_MAX ,"tracing/events/%s/%s" , sys, name ?:"*" ); - -return debugfs__strerror_open (err, buf, size, path); -}tools/lib/api/fs/tracing_path.c +54
-0@@ -5,6 +5,8 @@#include <stdio.h> #include <stdlib.h> #include <string.h> +#include <errno.h> +#include <unistd.h> #include "debugfs.h" #include "tracefs.h" @@ -81,3 +83,55 @@ void put_tracing_file(char *file) {free (file); } + +static int strerror_open (int err,char *buf,size_t size,const char *filename) +{ +char sbuf[128 ]; + +switch (err) { +case ENOENT : +if (debugfs_configured ()) { +snprintf (buf, size, +"Error:\tFile %s/%s not found.\n" +"Hint:\tPerhaps this kernel misses some CONFIG_ setting to enable this feature?.\n" , + debugfs_mountpoint, filename); +break ; + } +snprintf (buf, size,"%s" , +"Error:\tUnable to find debugfs\n" +"Hint:\tWas your kernel compiled with debugfs support?\n" +"Hint:\tIs the debugfs filesystem mounted?\n" +"Hint:\tTry 'sudo mount -t debugfs nodev /sys/kernel/debug'" ); +break ; +case EACCES : { +const char *mountpoint = debugfs_mountpoint; + +if (!access (debugfs_mountpoint,R_OK ) &&strncmp (filename,"tracing/" ,8 ) ==0 ) { +const char *tracefs_mntpoint =tracefs_find_mountpoint (); + +if (tracefs_mntpoint) + mountpoint = tracefs_mntpoint; + } + +snprintf (buf, size, +"Error:\tNo permissions to read %s/%s\n" +"Hint:\tTry 'sudo mount -o remount,mode=755 %s'\n" , + debugfs_mountpoint, filename, mountpoint); + } +break ; +default : +snprintf (buf, size,"%s" ,strerror_r (err, sbuf,sizeof (sbuf))); +break ; + } + +return 0 ; +} + +int tracing_path__strerror_open_tp (int err,char *buf,size_t size,const char *sys,const char *name) +{ +char path[PATH_MAX ]; + +snprintf (path,PATH_MAX ,"tracing/events/%s/%s" , sys, name ?:"*" ); + +return strerror_open (err, buf, size, path); +}tools/lib/api/fs/tracing_path.h +3
-0@@ -1,6 +1,8 @@#ifndef __API_FS_TRACING_PATH_H#define __API_FS_TRACING_PATH_H +#include <linux/types.h> +extern char tracing_path[];extern char tracing_events_path[];@@ -10,4 +12,5 @@ const char *tracing_path_mount(void);char *get_tracing_file (const char *name);void put_tracing_file (char *file); +int tracing_path__strerror_open_tp (int err,char *buf,size_t size,const char *sys,const char *name);#endif /* __API_FS_TRACING_PATH_H */ tools/perf/builtin-trace.c +3
-3@@ -17,6 +17,7 @@*/ #include <traceevent/event-parse.h> +#include <api/fs/tracing_path.h> #include "builtin.h" #include "util/color.h" #include "util/debug.h" @@ -2686,11 +2687,11 @@ out_delete_evlist:char errbuf[BUFSIZ ]; out_error_sched_stat_runtime: -debugfs__strerror_open_tp (errno, errbuf,sizeof (errbuf),"sched" ,"sched_stat_runtime" ); +tracing_path__strerror_open_tp (errno, errbuf,sizeof (errbuf),"sched" ,"sched_stat_runtime" ); goto out_error; out_error_raw_syscalls: -debugfs__strerror_open_tp (errno, errbuf,sizeof (errbuf),"raw_syscalls" ,"sys_(enter|exit)" ); +tracing_path__strerror_open_tp (errno, errbuf,sizeof (errbuf),"raw_syscalls" ,"sys_(enter|exit)" ); goto out_error; out_error_mmap: --2.1.0
Re: [PATCH 15/31] tools lib api fs: Add FSTYPE__mount() method
In reply to Arnaldo Carvalho de Melo2015-09-04 12:44 GMT-04:00 Arnaldo Carvalho de Melo <[email protected]>:
Quoted 15 lines
From: Jiri Olsa <[email protected]>
Adding
FSTYPE__mount(where FSTYPE is, as of now, one of sysfs, procfs, debugfs, tracefs) method that tries to mount the filesystem in case no mount of FSTYPE is found.Signed-off-by Jiri Olsa <[email protected]>Cc Raphael Beamonte <[email protected]>Cc David Ahern <[email protected]>Cc Matt Fleming <[email protected]>Cc Namhyung Kim <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Steven Rostedt <[email protected]>Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
Quoted 4 lines
--- tools/lib/api/fs/fs.c | 44 +++++++++++++++++++++++++++++++++++++++----- tools/lib/api/fs/fs.h | 15 +++++++++++---- 2 files changed, 50 insertions(+), 9 deletions(-)
Same thing here. I think I sent it to a reply of reply, should have sent it directly in reply to the patch.
Quoted 96 lines
tools/lib/api/fs/fs.c +39
-5@@ -9,6 +9,7 @@#include <sys/stat.h> #include <fcntl.h> #include <unistd.h> +#include <sys/mount.h> #include "debugfs.h" #include "fs.h" @@ -215,16 +216,49 @@ static const char *fs__mountpoint(int idx)return fs__get_mountpoint (fs); } -#define FS__MOUNTPOINT (name, idx) \ +static const char *mount_overload (struct fs *fs) +{ +size_t name_len =strlen (fs->name); +/* "PERF_" + name + "_ENVIRONMENT" + '\0' */ +char upper_name[5 + name_len +12 +1 ]; + +snprintf (upper_name, name_len,"PERF_%s_ENVIRONMENT" , fs->name); +mem_toupper (upper_name, name_len); + +return getenv (upper_name) ?: *fs->mounts; +} + +static const char *fs__mount (int idx) +{ +struct fs *fs = &fs__entries[idx]; +const char *mountpoint; + +if (fs__mountpoint (idx)) +return (const char *)fs->path; + + mountpoint =mount_overload (fs); + +if (mount (NULL , mountpoint, fs->name,0 ,NULL ) <0 ) +return NULL ; + +return fs__check_mounts (fs) ? fs->path :NULL ; +} + +#define FS (name, idx) \ const char *name##__mountpoint(void) \ { \ return fs__mountpoint(idx); \ +} \ + \ +const char *name##__mount(void) \ +{ \ + return fs__mount(idx); \ } -FS__MOUNTPOINT (sysfs,FS__SYSFS ); -FS__MOUNTPOINT (procfs,FS__PROCFS ); -FS__MOUNTPOINT (debugfs,FS__DEBUGFS ); -FS__MOUNTPOINT (tracefs,FS__TRACEFS ); +FS (sysfs,FS__SYSFS ); +FS (procfs,FS__PROCFS ); +FS (debugfs,FS__DEBUGFS ); +FS (tracefs,FS__TRACEFS );int filename__read_int (const char *filename,int *value) {tools/lib/api/fs/fs.h +11
-5@@ -9,10 +9,17 @@#define PATH_MAX 4096#endif -const char *sysfs__mountpoint (void ); -const char *procfs__mountpoint (void ); -const char *debugfs__mountpoint (void ); -const char *tracefs__mountpoint (void ); +#define FS (name) \ + const char *name##__mountpoint(void); \ + const char *name##__mount(void); + +FS(sysfs) +FS(procfs) +FS(debugfs) +FS(tracefs) + +#undef FS +int filename__read_int (const char *filename,int *value);int sysctl__read_int (const char *sysctl,int *value); --2.1.0
Re: [PATCH 10/31] tools lib api fs: Move debugfs__strerror_open into tracing_path.c object
In reply to Raphaël BeamonteEm Fri, Sep 04, 2015 at 12:57:10PM -0400, Raphaël Beamonte escreveu:
Quoted 3 lines
I perhaps sent it a bit late, but my Reviewed-by can be used here also.
Reviewed-by Raphael Beamonte <[email protected]>
Too late for this one, but to augment your chances of having your reviewed-by tags applied, please reply-to the original message... So that when I switch to threaded view in my MUA I can see the acks/reviewed-by tags.
If you do like on this one, I will not easily match tags to patches.
And we want those tags, if you took the time to review the patches thoroughly :-)
- Arnaldo
Quoted 151 lines · Arnaldo Carvalho de Melo
Hi Ingo,
Please consider pulling,
- Arnaldo
The following changes since commit
5b923564ccf43f92969c9e0fd199c8c5db657039:Merge tag 'perf-urgent-for-mingo' of
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linuxinto perf/urgent (2015-09-02 09:22:53 +0200)are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.gittags/perf-core-for-mingofor you to fetch changes up to
cf2f33a4e54096f90652cca3511fd6a456ea5abe:perf trace: Add read/write to the file group (2015-09-04 13:22:06 -0300)
----------------------------------------------------------------
perf/core improvements and fixes:User visible:
- Use
PERF_RECORD_SWITCHwhen available in intel-pt, instead of "sched:sched_switch" events, enabling an unprivileged user to trace multi-threaded or multi-process workloads (Adrian Hunter)- Always use non inlined file name for 'srcfile' sort key (Andi Kleen)
- Quieten failed to read counter message, helps in systems without backend-stalled-cycles (Andi Kleen)
Infrastructure:
- Add a 'perf test' entry for decoding of new x86 instructions (Adrian Hunter)
- Add new instructions (sha, clflushopt, clwb, pcommit, rdpkru, wrpkru, xsavec, xsaves, xrstors) to the x86 instruction decoder (Adrian Hunter)
- Add a build test to warn when source code drifts happen for the instruction decoder files in the kernel and in
tools/perf(Adrian Hunter)- Copy
linux/filter.htotools/include(He Kuang)- Support function
__get_dynamic_array_lenin libtraceevent (He Kuanguuu)- Tracing path finding/mounting/error reporting refactorings (Jiri Olsa)
- Store CPU socket and core IDs in perf.data (Kan Liang)
- Reorganize add/del probe insertion routines in 'perf probe' (Namhyung Kim, Wang Nan)
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>----------------------------------------------------------------
Adrian Hunter (8):
perf tools: Display build warning if x86 instruction decoder differs from kernel perf tools: Add a test for decoding of new x86 instructions x86/insn: perf tools: Pedantically tweak opcode map for MPX instructions x86/insn: perf tools: Add new SHA instructions
x86/insn: perf tools: Add new memory instructions
x86/insn: perf tools: Add new memory protection keys instructions x86/insn: perf tools: Add new xsave instructions
perf intel-pt: Add support forPERF_RECORD_SWITCHAndi Kleen (2):
perf tools: Always use non inlined file name for 'srcfile' sort key perf stat: Quieten failed to read counter messageArnaldo Carvalho de Melo (1):
perf trace: Add read/write to the file groupHe Kuang (2):
perf tools: Copylinux/filter.htotools/includetools lib traceevent: Support function__get_dynamic_array_lenJiri Olsa (10):
perf tools: Remove mountpoint arg fromperf_debugfs_mountperf tools: Movetracing_pathstuff under same namespace tools lib api fs: Movetracing_pathinterface intoapi/fs/tracing_path.ctools lib api fs: Movedebugfs__strerror_openintotracing_path.cobject tools lib api fs: Add STR andPATH_MAXmacros to fs object tools lib api fs: MoveSYSFS_MAGICPROC_SUPER_MAGICintofs.ctools lib api fs: Add debugfs intofs.cobject
tools lib api fs: Add tracefs intofs.cobject
tools lib api fs: AddFSTYPE__mount()method
tools lib api fs: AddFSTYPE__configured()methodKan Liang (3):
perf cpumap: Factor out functions to getcore_idandsocket_idperf tools: Store the cpu socket and core ids in the perf.data header perf session: Don't calldump_sample()when evsel is NULLNamhyung Kim (4):
perf probe: Splitadd_perf_probe_events()perf probe: Move print logic intocmd_probe()perf probe: Splitdel_perf_probe_events()perf probe: Print deleted events incmd_probe()Wang Nan (1):
perf probe: Linktrace_probe_eventintoperf_probe_eventarch/x86/lib/x86-opcode-map.txt | 24 +- tools/include/linux/filter.h | 231 ++++++ tools/lib/api/fs/Build | 1 + tools/lib/api/fs/debugfs.c | 52 -- tools/lib/api/fs/fs.c | 117 ++- tools/lib/api/fs/fs.h | 26 +- tools/lib/api/fs/tracing_path.c | 137 ++++ tools/lib/api/fs/tracing_path.h | 16 + tools/lib/traceevent/event-parse.c | 56 +- tools/lib/traceevent/event-parse.h | 1 + tools/perf/MANIFEST | 1 + tools/perf/arch/x86/util/intel-pt.c | 55 +- tools/perf/builtin-probe.c | 110 ++- tools/perf/builtin-stat.c | 2 +- tools/perf/builtin-trace.c | 5 +- tools/perf/perf.c | 12 +- tools/perf/tests/Build | 3 + tools/perf/tests/builtin-test.c | 8 + tools/perf/tests/gen-insn-x86-dat.awk | 75 ++ tools/perf/tests/gen-insn-x86-dat.sh | 43 + tools/perf/tests/insn-x86-dat-32.c | 658 ++++++++++++++++ tools/perf/tests/insn-x86-dat-64.c | 768 ++++++++++++++++++ tools/perf/tests/insn-x86-dat-src.c | 877 +++++++++++++++++++++ tools/perf/tests/insn-x86.c | 184 +++++ tools/perf/tests/tests.h | 1 + tools/perf/trace/strace/groups/file | 2 + tools/perf/util/cpumap.c | 51 +- tools/perf/util/cpumap.h | 2 + tools/perf/util/header.c | 94 ++- tools/perf/util/header.h | 6 + tools/perf/util/intel-pt-decoder/Build | 13 +- .../perf/util/intel-pt-decoder/x86-opcode-map.txt | 24 +- tools/perf/util/intel-pt.c | 129 ++- tools/perf/util/parse-events.c | 2 +- tools/perf/util/probe-event.c | 97 +-- tools/perf/util/probe-event.h | 9 + tools/perf/util/probe-file.c | 41 +- tools/perf/util/probe-file.h | 4 + .../perf/util/scripting-engines/trace-event-perl.c | 1 + .../util/scripting-engines/trace-event-python.c | 1 + tools/perf/util/session.c | 3 +- tools/perf/util/sort.c | 4 +- tools/perf/util/srcline.c | 29 +- tools/perf/util/trace-event-info.c | 2 +- tools/perf/util/trace-event.c | 1 + tools/perf/util/util.c | 70 -- tools/perf/util/util.h | 8 +- 47 files changed, 3762 insertions(+), 294 deletions(-) create mode 100644 tools/include/linux/filter.h
Quoted 8 lines
create mode 100644 tools/lib/api/fs/tracing_path.c create mode 100644 tools/lib/api/fs/tracing_path.h create mode 100644 tools/perf/tests/gen-insn-x86-dat.awk create mode 100755 tools/perf/tests/gen-insn-x86-dat.sh create mode 100644 tools/perf/tests/insn-x86-dat-32.c create mode 100644 tools/perf/tests/insn-x86-dat-64.c create mode 100644 tools/perf/tests/insn-x86-dat-src.c create mode 100644 tools/perf/tests/insn-x86.c
Pulled into tip:perf/core, thanks a lot Arnaldo!
Ingo