Skip to contentSkip to conversation

perf/core improvements and fixes

GIT PULL New Arnaldo Carvalho de Melo 4 participants 25 messages Sep 8, 2014 – Sep 10, 2014 perf events

lore
Share & tools
lore

Arnaldo Carvalho de Melo

author maintainer
#0 lore raw

Hi Ingo,

Please consider pulling,

- Arnaldo

The following changes since commit 39b5a56ec0be5effe9b7d0f18cb27724bf2e5d47:

Merge branch 'rfc/perf' into perf/core, because it's ready for inclusion (2014-08-24 22:35:42 +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 fa3480cb0a96c8af9ded1a8c836c91bd5704bda1:

perf tools: Add perf_pmu__scan_file() (2014-09-08 17:16:06 -0300)

----------------------------------------------------------------
perf/core improvements and fixes:

User visible:

o Add +field argument support for --sort option (Jiri Olsa)

Infrastructure:

o More intel PT prep work, from Adrian Hunter, including:

- Let a user specify a PMU event without any config terms
- Add perf-with-kcore script
- Build programs to copy 32-bit compatibility VDSOs
- Add support for 32-bit compatibility VDSOs
- Let default config be defined for a PMU
- Add perf_pmu__scan_file()

o Add feature checks to .gitignore (Alexander Shishkin)

o "perf kvm stat report" improvements by Alexander Yarygin:

  o  Save pid string in opts.target.pid
  o  Enable the target.system_wide flag
  o  Unify the title bar output

o Fix build issue on powerpc when DWARF support is disabled (Anton Blanchard)

o Allow to specify lib compile variable for spec usage (Jiri Olsa)

----------------------------------------------------------------
Adrian Hunter (6):
perf tools: Let a user specify a PMU event without any config terms perf tools: Add perf-with-kcore script
perf tools: Build programs to copy 32-bit compatibility VDSOs perf tools: Add support for 32-bit compatibility VDSOs perf tools: Let default config be defined for a PMU perf tools: Add perf_pmu__scan_file()

Alexander Shishkin (1):
perf tools: Add feature checks to .gitignore

Alexander Yarygin (3):
perf kvm stat report: Save pid string in opts.target.pid perf kvm stat report: Enable the target.system_wide flag perf kvm stat report: Unify the title bar output

Anton Blanchard (1):
perf tools powerpc: Fix build issue when DWARF support is disabled

Jiri Olsa (2):
perf tools: Add +field argument support for --sort option perf tools: Allow to specify lib compile variable for spec usage

 tools/perf/.gitignore            |   2 +
 tools/perf/Makefile.perf         |  42 ++++++-
 tools/perf/arch/powerpc/Makefile |   2 +-
 tools/perf/builtin-kvm.c         |  23 ++--
 tools/perf/config/Makefile       |  33 ++++-
 tools/perf/config/Makefile.arch  |   8 ++
 tools/perf/perf-read-vdso.c      |  59 +++++++++
 tools/perf/perf-with-kcore.sh    | 259 +++++++++++++++++++++++++++++++++++++++
 tools/perf/tests/pmu.c           |   2 +-
 tools/perf/util/kvm-stat.h       |   1 -
 tools/perf/util/parse-events.c   |  13 +-
 tools/perf/util/parse-events.y   |  10 ++
 tools/perf/util/pmu.c            |  79 +++++++++---
 tools/perf/util/pmu.h            |  12 +-
 tools/perf/util/sort.c           |  37 +++++-
 tools/perf/util/vdso.c           | 170 ++++++++++++++++++++++++-
 tools/perf/util/vdso.h           |   4 +-
 17 files changed, 712 insertions(+), 44 deletions(-)
 create mode 100644 tools/perf/perf-read-vdso.c
 create mode 100644 tools/perf/perf-with-kcore.sh
author maintainer
#1 lore raw

PATCH 1/13 perf tools: Add +field argument support for --sort option

From: Jiri Olsa <[email protected]>

Adding support to add field(s) to default sort order via using the '+' prefix, like for report:

  $ perf report
  Samples: 2K of event 'cycles', Event count (approx.): 882172583
  Overhead  Command  Shared Object        Symbol
     7.39%  swapper  [kernel.kallsyms]    [k] intel_idle
     1.97%  firefox  libpthread-2.17.so   [.] pthread_mutex_lock
     1.39%  firefox  [snd_hda_intel]      [k] azx_get_position
     1.11%  firefox  libpthread-2.17.so   [.] pthread_mutex_unlock
  $ perf report -s +cpu
  Samples: 2K of event 'cycles', Event count (approx.): 882172583
  Overhead  Command  Shared Object        Symbol                  CPU
     2.89%  swapper  [kernel.kallsyms]    [k] intel_idle          000
     2.61%  swapper  [kernel.kallsyms]    [k] intel_idle          002
     1.20%  swapper  [kernel.kallsyms]    [k] intel_idle          001
     0.82%  firefox  libpthread-2.17.so   [.] pthread_mutex_lock  002

Works in general for commands using --sort option.

v2 with changes suggested:
- Use dynamic memory instead static buffer
- Fix error message typo

---
 tools/perf/util/sort.c | 37 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)
tools/perf/util/sort.c +36 -1
index 1958637cf136..289df9d1e65a 100644
@@ -1446,12 +1446,47 @@ static const char *get_default_sort_order(void)
 	return default_sort_orders[sort__mode];
 }
 
+static int setup_sort_order(void)
+{
+	char *new_sort_order;
+
+	/*
+	 * Append '+'-prefixed sort order to the default sort
+	 * order string.
+	 */
+	if (!sort_order || is_strict_order(sort_order))
+		return 0;
+
+	if (sort_order[1] == '\0') {
+		error("Invalid --sort key: `+'");
+		return -EINVAL;
+	}
+
+	/*
+	 * We allocate new sort_order string, but we never free it,
+	 * because it's checked over the rest of the code.
+	 */
+	if (asprintf(&new_sort_order, "%s,%s",
+		     get_default_sort_order(), sort_order + 1) < 0) {
+		error("Not enough memory to set up --sort");
+		return -ENOMEM;
+	}
+
+	sort_order = new_sort_order;
+	return 0;
+}
+
 static int __setup_sorting(void)
 {
 	char *tmp, *tok, *str;
-	const char *sort_keys = sort_order;
+	const char *sort_keys;
 	int ret = 0;
 
+	ret = setup_sort_order();
+	if (ret)
+		return ret;
+
+	sort_keys = sort_order;
 	if (sort_keys == NULL) {
 		if (is_strict_order(field_order)) {
 			/*
Signature · 1 line
1.9.3
author maintainer
#2 lore raw

PATCH 2/13 perf tools powerpc: Fix build issue when DWARF support is disabled

In reply to Arnaldo Carvalho de Melo

From: Anton Blanchard <[email protected]>

The powerpc skip callchain code uses DWARF, so we must disable it if DWARF is disabled.

---
 tools/perf/arch/powerpc/Makefile |  2 +-
 tools/perf/config/Makefile       | 10 ++++++----
 2 files changed, 7 insertions(+), 5 deletions(-)
tools/perf/arch/powerpc/Makefile +1 -1
index b92219b1900d..6f7782bea5dd 100644
@@ -1,6 +1,6 @@
 ifndef NO_DWARF
 PERF_HAVE_DWARF_REGS := 1
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
+LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/skip-callchain-idx.o
 endif
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/header.o
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/skip-callchain-idx.o
tools/perf/config/Makefile +6 -4
index 75d4c237b03d..98c9fd174e98 100644
@@ -48,10 +48,6 @@ ifneq ($(ARCH),$(filter $(ARCH),x86 arm))
   NO_LIBDW_DWARF_UNWIND := 1
 endif
 
-ifeq ($(ARCH),powerpc)
-  CFLAGS += -DHAVE_SKIP_CALLCHAIN_IDX
-endif
-
 ifeq ($(LIBUNWIND_LIBS),)
   NO_LIBUNWIND := 1
 else
@@ -378,6 +374,12 @@ ifndef NO_LIBELF
   endif # NO_DWARF
 endif # NO_LIBELF
 
+ifeq ($(ARCH),powerpc)
+  ifndef NO_DWARF
+    CFLAGS += -DHAVE_SKIP_CALLCHAIN_IDX
+  endif
+endif
+
 ifndef NO_LIBUNWIND
   ifneq ($(feature-libunwind), 1)
     msg := $(warning No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR);
Signature · 1 line
1.9.3
author maintainer
#3 lore raw

PATCH 3/13 perf kvm stat report: Save pid string in opts.target.pid

In reply to Arnaldo Carvalho de Melo

From: Alexander Yarygin <[email protected]>

The 'perf kvm stat report' command uses the kvm->pid_str field to keep the value of the --pid option. Let's use kvm->opts.target.pid instead.

---
 tools/perf/builtin-kvm.c   | 6 +++---
 tools/perf/util/kvm-stat.h | 1 -
 2 files changed, 3 insertions(+), 4 deletions(-)
tools/perf/builtin-kvm.c +3 -3
index 1a4ef9cd9d5f..646ec5d5de80 100644
@@ -1085,8 +1085,8 @@ static int read_events(struct perf_kvm_stat *kvm)
 
 static int parse_target_str(struct perf_kvm_stat *kvm)
 {
-	if (kvm->pid_str) {
-		kvm->pid_list = intlist__new(kvm->pid_str);
+	if (kvm->opts.target.pid) {
+		kvm->pid_list = intlist__new(kvm->opts.target.pid);
 		if (kvm->pid_list == NULL) {
 			pr_err("Error parsing process id string\n");
 			return -EINVAL;
@@ -1188,7 +1188,7 @@ kvm_events_report(struct perf_kvm_stat *kvm, int argc, const char **argv)
 		OPT_STRING('k', "key", &kvm->sort_key, "sort-key",
 			    "key for sorting: sample(sort by samples number)"
 			    " time (sort by avg time)"),
-		OPT_STRING('p', "pid", &kvm->pid_str, "pid",
+		OPT_STRING('p', "pid", &kvm->opts.target.pid, "pid",
 			   "analyze events only for given process id(s)"),
 		OPT_END()
 	};
tools/perf/util/kvm-stat.h +0 -1
index 0b5a8cd2ee79..cf1d7913783b 100644
@@ -92,7 +92,6 @@ struct perf_kvm_stat {
 	u64 lost_events;
 	u64 duration;
 
-	const char *pid_str;
 	struct intlist *pid_list;
 
 	struct rb_root result;
Signature · 1 line
1.9.3
author maintainer
#4 lore raw

PATCH 4/13 perf kvm stat report: Enable the target.system_wide flag

In reply to Arnaldo Carvalho de Melo

From: Alexander Yarygin <[email protected]>

The 'perf kvm stat report' command can be used to analyze events either for system wide or for specific pids.

Let's enable kvm->opts.target.system_wide flag when 'report' command is running for system-wide analyzing. This helps to sync kvm->opts.target values in 'report' and 'live' commands.

---
 tools/perf/builtin-kvm.c | 3 +++
 1 file changed, 3 insertions(+)
tools/perf/builtin-kvm.c +3 -0
index 646ec5d5de80..84295ab6c4e1 100644
@@ -1207,6 +1207,9 @@ kvm_events_report(struct perf_kvm_stat *kvm, int argc, const char **argv)
 					   kvm_events_report_options);
 	}
 
+	if (!kvm->opts.target.pid)
+		kvm->opts.target.system_wide = true;
+
 	return kvm_events_report_vcpu(kvm);
 }
 
Signature · 1 line
1.9.3
author maintainer
#5 lore raw

PATCH 5/13 perf kvm stat report: Unify the title bar output

In reply to Arnaldo Carvalho de Melo

From: Alexander Yarygin <[email protected]>

The 'live' command prints additional information to the "Analyze events for " title bar about the current target. Let's print the same title for the 'report' command.

---
 tools/perf/builtin-kvm.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
tools/perf/builtin-kvm.c +6 -8
index 84295ab6c4e1..f5d3ae483110 100644
@@ -543,14 +543,12 @@ static void print_vcpu_info(struct perf_kvm_stat *kvm)
 
 	pr_info("Analyze events for ");
 
-	if (kvm->live) {
-		if (kvm->opts.target.system_wide)
-			pr_info("all VMs, ");
-		else if (kvm->opts.target.pid)
-			pr_info("pid(s) %s, ", kvm->opts.target.pid);
-		else
-			pr_info("dazed and confused on what is monitored, ");
-	}
+	if (kvm->opts.target.system_wide)
+		pr_info("all VMs, ");
+	else if (kvm->opts.target.pid)
+		pr_info("pid(s) %s, ", kvm->opts.target.pid);
+	else
+		pr_info("dazed and confused on what is monitored, ");
 
 	if (vcpu == -1)
 		pr_info("all VCPUs:\n\n");
Signature · 1 line
1.9.3
author maintainer
#6 lore raw

PATCH 6/13 perf tools: Allow to specify lib compile variable for spec usage

In reply to Arnaldo Carvalho de Melo

From: Jiri Olsa <[email protected]>

We need a way to specify $(lib) part of the installation path for traceevent plugin libraries. Currently we use 'lib64' for x86_64 and 'lib' otherwise.

Instead of listing all possible values, this change allows the rpm spec code to specify the correct $(lib) part based on processed architecture, like

  $ make ... lib=%{_lib}
---
 tools/perf/config/Makefile | 2 ++
 1 file changed, 2 insertions(+)
tools/perf/config/Makefile +2 -0
index 98c9fd174e98..58f609198c6d 100644
@@ -653,11 +653,13 @@ else
 sysconfdir = $(prefix)/etc
 ETC_PERFCONFIG = etc/perfconfig
 endif
+ifndef lib
 ifeq ($(IS_X86_64),1)
 lib = lib64
 else
 lib = lib
 endif
+endif # lib
 libdir = $(prefix)/$(lib)
 
 # Shell quote (do not use $(call) to accommodate ancient setups);
Signature · 1 line
1.9.3
author maintainer
#7 lore raw

PATCH 7/13 perf tools: Add feature checks to .gitignore

In reply to Arnaldo Carvalho de Melo

From: Alexander Shishkin <[email protected]>

---
 tools/perf/.gitignore | 1 +
 1 file changed, 1 insertion(+)
tools/perf/.gitignore +1 -0
index 782d86e961b9..0fc74cde02f0 100644
@@ -24,3 +24,4 @@ config.mak.autogen
 *-flex.*
 *.pyc
 *.pyo
+config/feature-checks/test-*
Signature · 1 line
1.9.3
author maintainer
#8 lore raw

PATCH 8/13 perf tools: Let a user specify a PMU event without any config terms

In reply to Arnaldo Carvalho de Melo

From: Adrian Hunter <[email protected]>

This enables a PMU event to be specified in the form:

	pmu//

which is effectively the same as:

	pmu/config=0/

This patch is a precursor to defining default config for a PMU.

Further explanation extracted from lkml thread:

Imagine that the 'tsc' term did not exist.

Intel PT trace data would not contain TSC packets, and the decoder would not know how to decode them.

Then imagine that a new version of the hardware adds 'tsc'.

It is such a useful feature that we want it by default, but older versions of the tools don't know how to decode it, so the kernel cannot turn it on by default.

It is similar to why the kernel does not select perf_event_attr.mmap2 by default.

The kernel doesn't know whether the tool supports it.

---
 tools/perf/util/parse-events.c |  6 ++++++
 tools/perf/util/parse-events.y | 10 ++++++++++
 2 files changed, 16 insertions(+)
tools/perf/util/parse-events.c +6 -0
index e34c81a0bcf3..e75628813968 100644
@@ -645,6 +645,12 @@ int parse_events_add_pmu(struct list_head *list, int *idx,
 
 	memset(&attr, 0, sizeof(attr));
 
+	if (!head_config) {
+		attr.type = pmu->type;
+		evsel = __add_event(list, idx, &attr, NULL, pmu->cpus);
+		return evsel ? 0 : -ENOMEM;
+	}
+
 	if (perf_pmu__check_alias(pmu, head_config, &unit, &scale))
 		return -EINVAL;
 
tools/perf/util/parse-events.y +10 -0
index 0bc87ba46bf3..55fab6ad609a 100644
@@ -210,6 +210,16 @@ PE_NAME '/' event_config '/'
 	parse_events__free_terms($3);
 	$$ = list;
 }
+|
+PE_NAME '/' '/'
+{
+	struct parse_events_evlist *data = _data;
+	struct list_head *list;
+
+	ALLOC_LIST(list);
+	ABORT_ON(parse_events_add_pmu(list, &data->idx, $1, NULL));
+	$$ = list;
+}
 
 value_sym:
 PE_VALUE_SYM_HW
Signature · 1 line
1.9.3
author maintainer
#9 lore raw

PATCH 9/13 perf tools: Add perf-with-kcore script

In reply to Arnaldo Carvalho de Melo

From: Adrian Hunter <[email protected]>

Decoding an Intel PT trace of the kernel requires an accurate kernel object image. This is provided by making a copy of kcore. However the copy needs to be made under the same conditions as the original recording, and then it needs to be associated with the perf.data file. The perf-with-kcore script does that.

The script also checks the permissions on the buildid cache and can be used to fix them. That is needed for distributions where root does not have a home directory and consequently writes to the same buildid cache as the user, resulting in cached files that the user does not have access to.

Example:

$ ./perf-with-kcore
Usage: perf-with-kcore <perf sub-command> <perf.data directory> [<sub-command options> [ -- <workload>]]
       <perf sub-command> can be record, script, report or inject
   or: perf-with-kcore fix_buildid_cache_permissions
$ ./perf-with-kcore record pt_uname -e intel_pt// -- uname
Recording
Using /home/ahunter/bin/perf
perf version 3.15.rc3.g4549ba
/home/ahunter/bin/perf record -o pt_uname/perf.data -e intel_pt//  -- uname
Linux
[ perf record: Woken up 3 times to write data ]
[ perf record: Captured and wrote 0.023 MB pt_uname/perf.data ]
Copying kcore
[sudo] password for ahunter:
Done
$ tools/perf/perf-with-kcore.sh script pt_uname | head
Using /home/ahunter/bin/perf
perf version 3.15.rc3.g4549ba
/home/ahunter/bin/perf script -i pt_uname/perf.data --kallsyms=pt_uname/kcore_dir/kallsyms
         swapper     0 [002] 161533.969666: sched:sched_switch: swapper/2:0 [120] R ==> perf:11316 [120]
          :11315 11315 [003] 161533.969704: sched:sched_switch: perf:11315 [120] S ==> swapper/3:0 [120]
          :11316 11316 [002] 161533.969783: sched:sched_switch: perf:11316 [120] R ==> migration/2:33 [0]
             :33    33 [002] 161533.969791: sched:sched_switch: migration/2:33 [0] S ==> swapper/2:0 [120]
         swapper     0 [003] 161533.969792: sched:sched_switch: swapper/3:0 [120] R ==> perf:11316 [120]
          :11316 11316 [003] 161533.970062: branches:                 0 [unknown] ([unknown]) => ffffffff810532fa native_write_msr_safe ([kernel.kallsyms])
          :11316 11316 [003] 161533.970062: branches:  ffffffff810532fd native_write_msr_safe ([kernel.kallsyms]) => ffffffff81035b31 pt_config_start ([kernel.kallsyms])
---
 tools/perf/.gitignore         |   1 +
 tools/perf/Makefile.perf      |   5 +-
 tools/perf/perf-with-kcore.sh | 259 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 264 insertions(+), 1 deletion(-)
 create mode 100644 tools/perf/perf-with-kcore.sh
tools/perf/.gitignore +1 -0
index 0fc74cde02f0..af50829409e6 100644
@@ -15,6 +15,7 @@ perf.data
 perf.data.old
 output.svg
 perf-archive
+perf-with-kcore
 tags
 TAGS
 cscope*
tools/perf/Makefile.perf +4 -1
index 95e832b1bc3c..171f4e65601b 100644
@@ -126,6 +126,7 @@ PYRF_OBJS =
 SCRIPT_SH =
 
 SCRIPT_SH += perf-archive.sh
+SCRIPT_SH += perf-with-kcore.sh
 
 grep-libs = $(filter -l%,$(1))
 strip-libs = $(filter-out -l%,$(1))
@@ -878,6 +879,8 @@ install-bin: all install-gtk
 		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
 	$(call QUIET_INSTALL, perf-archive) \
 		$(INSTALL) $(OUTPUT)perf-archive -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
+	$(call QUIET_INSTALL, perf-with-kcore) \
+		$(INSTALL) $(OUTPUT)perf-with-kcore -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
 ifndef NO_LIBPERL
 	$(call QUIET_INSTALL, perl-scripts) \
 		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'; \
@@ -923,7 +926,7 @@ config-clean:
 	@$(MAKE) -C config/feature-checks clean >/dev/null
 
 clean: $(LIBTRACEEVENT)-clean $(LIBAPIKFS)-clean config-clean
-	$(call QUIET_CLEAN, core-objs)  $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf.o $(LANG_BINDINGS) $(GTK_OBJS)
+	$(call QUIET_CLEAN, core-objs)  $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf-with-kcore $(OUTPUT)perf.o $(LANG_BINDINGS) $(GTK_OBJS)
 	$(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf
 	$(call QUIET_CLEAN, core-gen)   $(RM)  *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS $(OUTPUT)PERF-FEATURES $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex*
 	$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
tools/perf/perf-with-kcore.sh new file +259 -0

259 lines not on this page · raw message

Signature · 1 line
1.9.3
author maintainer
#10 lore raw

PATCH 10/13 perf tools: Build programs to copy 32-bit compatibility VDSOs

In reply to Arnaldo Carvalho de Melo

From: Adrian Hunter <[email protected]>

perf tools copy VDSO out of memory. However, on 64-bit machines there may be 32-bit compatibility VDOs also. To copy those requires separate 32-bit executables. This patch adds to the build additional programs perf-read-vdso32 and perf-read-vdsox32 for 32-bit and x32 respectively.

---
 tools/perf/Makefile.perf        | 37 +++++++++++++++++++++++---
 tools/perf/config/Makefile      | 21 +++++++++++++++
 tools/perf/config/Makefile.arch |  8 ++++++
 tools/perf/perf-read-vdso.c     | 59 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 121 insertions(+), 4 deletions(-)
 create mode 100644 tools/perf/perf-read-vdso.c
tools/perf/Makefile.perf +33 -4
index 171f4e65601b..8c57566205f0 100644
@@ -60,6 +60,12 @@ include config/utilities.mak
 #
 # Define NO_LIBDW_DWARF_UNWIND if you do not want libdw support
 # for dwarf backtrace post unwind.
+#
+# Define NO_PERF_READ_VDSO32 if you do not want to build perf-read-vdso32
+# for reading the 32-bit compatibility VDSO in 64-bit mode
+#
+# Define NO_PERF_READ_VDSOX32 if you do not want to build perf-read-vdsox32
+# for reading the x32 mode 32-bit compatibility VDSO in 64-bit mode
 
 ifeq ($(srctree),)
 srctree := $(patsubst %/,%,$(dir $(shell pwd)))
@@ -171,11 +177,16 @@ $(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS)
 
 SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH))
 
-#
-# Single 'perf' binary right now:
-#
 PROGRAMS += $(OUTPUT)perf
 
+ifndef NO_PERF_READ_VDSO32
+PROGRAMS += $(OUTPUT)perf-read-vdso32
+endif
+
+ifndef NO_PERF_READ_VDSOX32
+PROGRAMS += $(OUTPUT)perf-read-vdsox32
+endif
+
 # what 'all' will build and 'install' will install, in perfexecdir
 ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
 
@@ -731,6 +742,16 @@ $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o: scripts/python/Perf-Trace-Uti
 $(OUTPUT)perf-%: %.o $(PERFLIBS)
 	$(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $(filter %.o,$^) $(LIBS)
 
+ifndef NO_PERF_READ_VDSO32
+$(OUTPUT)perf-read-vdso32: perf-read-vdso.c
+	$(QUIET_CC)$(CC) -m32 -Wall -Werror -o $@ perf-read-vdso.c
+endif
+
+ifndef NO_PERF_READ_VDSOX32
+$(OUTPUT)perf-read-vdsox32: perf-read-vdso.c
+	$(QUIET_CC)$(CC) -mx32 -Wall -Werror -o $@ perf-read-vdso.c
+endif
+
 $(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)
 $(patsubst perf-%,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)
 
@@ -875,6 +896,14 @@ install-bin: all install-gtk
 		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'; \
 		$(INSTALL) $(OUTPUT)perf '$(DESTDIR_SQ)$(bindir_SQ)'; \
 		$(LN) '$(DESTDIR_SQ)$(bindir_SQ)/perf' '$(DESTDIR_SQ)$(bindir_SQ)/trace'
+ifndef NO_PERF_READ_VDSO32
+	$(call QUIET_INSTALL, perf-read-vdso32) \
+		$(INSTALL) $(OUTPUT)perf-read-vdso32 '$(DESTDIR_SQ)$(bindir_SQ)';
+endif
+ifndef NO_PERF_READ_VDSOX32
+	$(call QUIET_INSTALL, perf-read-vdsox32) \
+		$(INSTALL) $(OUTPUT)perf-read-vdsox32 '$(DESTDIR_SQ)$(bindir_SQ)';
+endif
 	$(call QUIET_INSTALL, libexec) \
 		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
 	$(call QUIET_INSTALL, perf-archive) \
@@ -927,7 +956,7 @@ config-clean:
 
 clean: $(LIBTRACEEVENT)-clean $(LIBAPIKFS)-clean config-clean
 	$(call QUIET_CLEAN, core-objs)  $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf-with-kcore $(OUTPUT)perf.o $(LANG_BINDINGS) $(GTK_OBJS)
-	$(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf
+	$(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf perf-read-vdso32 perf-read-vdsox32
 	$(call QUIET_CLEAN, core-gen)   $(RM)  *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS $(OUTPUT)PERF-FEATURES $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex*
 	$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
 	$(python-clean)
tools/perf/config/Makefile +21 -0
index 58f609198c6d..499601a49d8e 100644
@@ -622,6 +622,27 @@ ifdef HAVE_KVM_STAT_SUPPORT
     CFLAGS += -DHAVE_KVM_STAT_SUPPORT
 endif
 
+ifeq (${IS_64_BIT}, 1)
+  ifndef NO_PERF_READ_VDSO32
+    CAN_DO := $(shell echo "main() {}" | ${CC} -m32 -x c - >/dev/null 2>/dev/null && echo 1 || echo 0)
+    ifneq (${CAN_DO}, 1)
+      NO_PERF_READ_VDSO32 := 1
+    endif
+  endif
+  ifneq (${IS_X86_64}, 1)
+    NO_PERF_READ_VDSOX32 := 1
+  endif
+  ifndef NO_PERF_READ_VDSOX32
+    CAN_DO := $(shell echo 'main() {}' | ${CC} -mx32 -x c - >/dev/null 2>/dev/null && echo 1 || echo 0)
+    ifneq (${CAN_DO}, 1)
+      NO_PERF_READ_VDSOX32 := 1
+    endif
+  endif
+else
+  NO_PERF_READ_VDSO32 := 1
+  NO_PERF_READ_VDSOX32 := 1
+endif
+
 # Among the variables below, these:
 #   perfexecdir
 #   template_dir
tools/perf/config/Makefile.arch +8 -0
index 4b06719ee984..851cd0172a76 100644
@@ -21,3 +21,11 @@ ifeq ($(ARCH),x86_64)
     RAW_ARCH := x86_64
   endif
 endif
+
+ifeq (${IS_X86_64}, 1)
+  IS_64_BIT := 1
+else ifeq ($(ARCH),x86)
+  IS_64_BIT := 0
+else
+  IS_64_BIT := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1)
+endif
tools/perf/perf-read-vdso.c new file +59 -0

59 lines not on this page · raw message

Signature · 1 line
1.9.3
author maintainer
#11 lore raw

PATCH 11/13 perf tools: Add support for 32-bit compatibility VDSOs

In reply to Arnaldo Carvalho de Melo

From: Adrian Hunter <[email protected]>

'perf record' post-processes the event stream to create a list of build-ids for object files for which sample events have been recorded. That results in those object files being recorded in the build-id cache.

In the case of VDSO, perf tools reads it from memory and copies it into a temporary file, which as decribed above, gets added to the build-id cache.

Then when the perf.data file is processed by other tools, the build-id of VDSO is listed in the perf.data file and the VDSO can be read from the build-id cache. In that case the name of the map, the short name of the DSO, and the entry in the build-id cache are all "[vdso]".

However, in the 64-bit case, there also can be 32-bit compatibility VDSOs.

A previous patch added programs "perf-read-vdso32" and "perf read-vdsox32". This patch uses those programs to read the correct VDSO for a thread and create a temporary file just as for the 64-bit VDSO. The map name and the entry in the build-id cache are still "[vdso]" but the DSO short name becomes "[vdso32]" and "[vdsox32]" respectively.

---
 tools/perf/util/vdso.c | 170 ++++++++++++++++++++++++++++++++++++++++++++++++-
 tools/perf/util/vdso.h |   4 +-
 2 files changed, 172 insertions(+), 2 deletions(-)
tools/perf/util/vdso.c +169 -1
index adca69384fcc..b721f4caa208 100644
@@ -12,6 +12,7 @@
 #include "util.h"
 #include "symbol.h"
 #include "machine.h"
+#include "thread.h"
 #include "linux/string.h"
 #include "debug.h"
 
@@ -22,10 +23,15 @@ struct vdso_file {
 	bool error;
 	char temp_file_name[sizeof(VDSO__TEMP_FILE_NAME)];
 	const char *dso_name;
+	const char *read_prog;
 };
 
 struct vdso_info {
 	struct vdso_file vdso;
+#if BITS_PER_LONG == 64
+	struct vdso_file vdso32;
+	struct vdso_file vdsox32;
+#endif
 };
 
 static struct vdso_info *vdso_info__new(void)
@@ -35,6 +41,18 @@ static struct vdso_info *vdso_info__new(void)
 			.temp_file_name = VDSO__TEMP_FILE_NAME,
 			.dso_name = DSO__NAME_VDSO,
 		},
+#if BITS_PER_LONG == 64
+		.vdso32  = {
+			.temp_file_name = VDSO__TEMP_FILE_NAME,
+			.dso_name = DSO__NAME_VDSO32,
+			.read_prog = "perf-read-vdso32",
+		},
+		.vdsox32  = {
+			.temp_file_name = VDSO__TEMP_FILE_NAME,
+			.dso_name = DSO__NAME_VDSOX32,
+			.read_prog = "perf-read-vdsox32",
+		},
+#endif
 	};
 
 	return memdup(&vdso_info_init, sizeof(vdso_info_init));
@@ -117,6 +135,12 @@ void vdso__exit(struct machine *machine)
 
 	if (vdso_info->vdso.found)
 		unlink(vdso_info->vdso.temp_file_name);
+#if BITS_PER_LONG == 64
+	if (vdso_info->vdso32.found)
+		unlink(vdso_info->vdso.temp_file_name);
+	if (vdso_info->vdsox32.found)
+		unlink(vdso_info->vdso.temp_file_name);
+#endif
 
 	zfree(&machine->vdso_info);
 }
@@ -135,6 +159,143 @@ static struct dso *vdso__new(struct machine *machine, const char *short_name,
 	return dso;
 }
 
+#if BITS_PER_LONG == 64
+
+static enum dso_type machine__thread_dso_type(struct machine *machine,
+					      struct thread *thread)
+{
+	enum dso_type dso_type = DSO__TYPE_UNKNOWN;
+	struct map *map;
+	struct dso *dso;
+
+	map = map_groups__first(thread->mg, MAP__FUNCTION);
+	for (; map ; map = map_groups__next(map)) {
+		dso = map->dso;
+		if (!dso || dso->long_name[0] != '/')
+			continue;
+		dso_type = dso__type(dso, machine);
+		if (dso_type != DSO__TYPE_UNKNOWN)
+			break;
+	}
+
+	return dso_type;
+}
+
+static int vdso__do_copy_compat(FILE *f, int fd)
+{
+	char buf[4096];
+	size_t count;
+
+	while (1) {
+		count = fread(buf, 1, sizeof(buf), f);
+		if (ferror(f))
+			return -errno;
+		if (feof(f))
+			break;
+		if (count && writen(fd, buf, count) != (ssize_t)count)
+			return -errno;
+	}
+
+	return 0;
+}
+
+static int vdso__copy_compat(const char *prog, int fd)
+{
+	FILE *f;
+	int err;
+
+	f = popen(prog, "r");
+	if (!f)
+		return -errno;
+
+	err = vdso__do_copy_compat(f, fd);
+
+	if (pclose(f) == -1)
+		return -errno;
+
+	return err;
+}
+
+static int vdso__create_compat_file(const char *prog, char *temp_name)
+{
+	int fd, err;
+
+	fd = mkstemp(temp_name);
+	if (fd < 0)
+		return -errno;
+
+	err = vdso__copy_compat(prog, fd);
+
+	if (close(fd) == -1)
+		return -errno;
+
+	return err;
+}
+
+static const char *vdso__get_compat_file(struct vdso_file *vdso_file)
+{
+	int err;
+
+	if (vdso_file->found)
+		return vdso_file->temp_file_name;
+
+	if (vdso_file->error)
+		return NULL;
+
+	err = vdso__create_compat_file(vdso_file->read_prog,
+				       vdso_file->temp_file_name);
+	if (err) {
+		pr_err("%s failed, error %d\n", vdso_file->read_prog, err);
+		vdso_file->error = true;
+		return NULL;
+	}
+
+	vdso_file->found = true;
+
+	return vdso_file->temp_file_name;
+}
+
+static struct dso *vdso__findnew_compat(struct machine *machine,
+					struct vdso_file *vdso_file)
+{
+	const char *file_name;
+	struct dso *dso;
+
+	dso = dsos__find(&machine->user_dsos, vdso_file->dso_name, true);
+	if (dso)
+		return dso;
+
+	file_name = vdso__get_compat_file(vdso_file);
+	if (!file_name)
+		return NULL;
+
+	return vdso__new(machine, vdso_file->dso_name, file_name);
+}
+
+static int vdso__dso_findnew_compat(struct machine *machine,
+				    struct thread *thread,
+				    struct vdso_info *vdso_info,
+				    struct dso **dso)
+{
+	enum dso_type dso_type;
+
+	dso_type = machine__thread_dso_type(machine, thread);
+	switch (dso_type) {
+	case DSO__TYPE_32BIT:
+		*dso = vdso__findnew_compat(machine, &vdso_info->vdso32);
+		return 1;
+	case DSO__TYPE_X32BIT:
+		*dso = vdso__findnew_compat(machine, &vdso_info->vdsox32);
+		return 1;
+	case DSO__TYPE_UNKNOWN:
+	case DSO__TYPE_64BIT:
+	default:
+		return 0;
+	}
+}
+
+#endif
+
 struct dso *vdso__dso_findnew(struct machine *machine,
 			      struct thread *thread __maybe_unused)
 {
@@ -148,6 +309,11 @@ struct dso *vdso__dso_findnew(struct machine *machine,
 	if (!vdso_info)
 		return NULL;
 
+#if BITS_PER_LONG == 64
+	if (vdso__dso_findnew_compat(machine, thread, vdso_info, &dso))
+		return dso;
+#endif
+
 	dso = dsos__find(&machine->user_dsos, DSO__NAME_VDSO, true);
 	if (!dso) {
 		char *file;
@@ -164,5 +330,7 @@ struct dso *vdso__dso_findnew(struct machine *machine,
 
 bool dso__is_vdso(struct dso *dso)
 {
-	return !strcmp(dso->short_name, DSO__NAME_VDSO);
+	return !strcmp(dso->short_name, DSO__NAME_VDSO) ||
+	       !strcmp(dso->short_name, DSO__NAME_VDSO32) ||
+	       !strcmp(dso->short_name, DSO__NAME_VDSOX32);
 }
tools/perf/util/vdso.h +3 -1
index af9d6929a215..d97da1616f0c 100644
@@ -7,7 +7,9 @@
 
 #define VDSO__MAP_NAME "[vdso]"
 
-#define DSO__NAME_VDSO "[vdso]"
+#define DSO__NAME_VDSO    "[vdso]"
+#define DSO__NAME_VDSO32  "[vdso32]"
+#define DSO__NAME_VDSOX32 "[vdsox32]"
 
 static inline bool is_vdso_map(const char *filename)
 {
Signature · 1 line
1.9.3
author maintainer
#12 lore raw

PATCH 12/13 perf tools: Let default config be defined for a PMU

In reply to Arnaldo Carvalho de Melo

From: Adrian Hunter <[email protected]>

This allows default config terms to be provided for a PMU. So, for example, when the Intel PT PMU is added, it will be possible to specify:

	intel_pt//

which will be the same as:

	intel_pt/tsc=1,noretcomp=0/

meaning that the trace should contain TSC timestamps and perform 'return compression'.

An important consideration of this patch is that it must be possible to overwrite the default values. That has meant changing the logic so that a zero value can replace a non-zero value.

---
 tools/perf/tests/pmu.c         |  2 +-
 tools/perf/util/parse-events.c |  7 ++++++-
 tools/perf/util/pmu.c          | 42 ++++++++++++++++++++++++++----------------
 tools/perf/util/pmu.h          |  9 ++++++++-
 4 files changed, 41 insertions(+), 19 deletions(-)
tools/perf/tests/pmu.c +1 -1
index 12b322fa3475..eeb68bb1972d 100644
@@ -152,7 +152,7 @@ int test__pmu(void)
 		if (ret)
 			break;
 
-		ret = perf_pmu__config_terms(&formats, &attr, terms);
+		ret = perf_pmu__config_terms(&formats, &attr, terms, false);
 		if (ret)
 			break;
 
tools/perf/util/parse-events.c +6 -1
index e75628813968..61be3e695ec2 100644
@@ -643,7 +643,12 @@ int parse_events_add_pmu(struct list_head *list, int *idx,
 	if (!pmu)
 		return -EINVAL;
 
-	memset(&attr, 0, sizeof(attr));
+	if (pmu->default_config) {
+		memcpy(&attr, pmu->default_config,
+		       sizeof(struct perf_event_attr));
+	} else {
+		memset(&attr, 0, sizeof(attr));
+	}
 
 	if (!head_config) {
 		attr.type = pmu->type;
tools/perf/util/pmu.c +26 -16

105 lines not on this page · raw message

tools/perf/util/pmu.h +8 -1
index 1c1e2eecbe1f..413b9a63c38d 100644
@@ -13,9 +13,12 @@ enum {
 
 #define PERF_PMU_FORMAT_BITS 64
 
+struct perf_event_attr;
+
 struct perf_pmu {
 	char *name;
 	__u32 type;
+	struct perf_event_attr *default_config;
 	struct cpu_map *cpus;
 	struct list_head format;  /* HEAD struct perf_pmu_format -> list */
 	struct list_head aliases; /* HEAD struct perf_pmu_alias -> list */
@@ -27,7 +30,8 @@ int perf_pmu__config(struct perf_pmu *pmu, struct perf_event_attr *attr,
 		     struct list_head *head_terms);
 int perf_pmu__config_terms(struct list_head *formats,
 			   struct perf_event_attr *attr,
-			   struct list_head *head_terms);
+			   struct list_head *head_terms,
+			   bool zero);
 int perf_pmu__check_alias(struct perf_pmu *pmu, struct list_head *head_terms,
 			  const char **unit, double *scale);
 struct list_head *perf_pmu__alias(struct perf_pmu *pmu,
@@ -46,4 +50,7 @@ void print_pmu_events(const char *event_glob, bool name_only);
 bool pmu_have_event(const char *pname, const char *name);
 
 int perf_pmu__test(void);
+
+struct perf_event_attr *perf_pmu__get_default_config(struct perf_pmu *pmu);
+
 #endif /* __PMU_H */
Signature · 1 line
1.9.3
author maintainer
#13 lore raw

PATCH 13/13 perf tools: Add perf_pmu__scan_file()

In reply to Arnaldo Carvalho de Melo

From: Adrian Hunter <[email protected]>

Add a function to scan a sysfs file within the pmu device directory.

This will be used to read capability values from the PMU 'caps' subdirectory.

---
 tools/perf/util/pmu.c | 37 +++++++++++++++++++++++++++++++++++++
 tools/perf/util/pmu.h |  3 +++
 2 files changed, 40 insertions(+)
tools/perf/util/pmu.c +37 -0
index 438bb261f391..22a4ad5a927a 100644
@@ -3,6 +3,7 @@
 #include <unistd.h>
 #include <stdio.h>
 #include <stdbool.h>
+#include <stdarg.h>
 #include <dirent.h>
 #include <api/fs/fs.h>
 #include <locale.h>
@@ -804,3 +805,39 @@ bool pmu_have_event(const char *pname, const char *name)
 	}
 	return false;
 }
+
+static FILE *perf_pmu__open_file(struct perf_pmu *pmu, const char *name)
+{
+	struct stat st;
+	char path[PATH_MAX];
+	const char *sysfs;
+
+	sysfs = sysfs__mountpoint();
+	if (!sysfs)
+		return NULL;
+
+	snprintf(path, PATH_MAX,
+		 "%s" EVENT_SOURCE_DEVICE_PATH "%s/%s", sysfs, pmu->name, name);
+
+	if (stat(path, &st) < 0)
+		return NULL;
+
+	return fopen(path, "r");
+}
+
+int perf_pmu__scan_file(struct perf_pmu *pmu, const char *name, const char *fmt,
+			...)
+{
+	va_list args;
+	FILE *file;
+	int ret = EOF;
+
+	va_start(args, fmt);
+	file = perf_pmu__open_file(pmu, name);
+	if (file) {
+		ret = vfscanf(file, fmt, args);
+		fclose(file);
+	}
+	va_end(args);
+	return ret;
+}
tools/perf/util/pmu.h +3 -0
index 413b9a63c38d..0f5c0a88fdc8 100644
@@ -49,6 +49,9 @@ struct perf_pmu *perf_pmu__scan(struct perf_pmu *pmu);
 void print_pmu_events(const char *event_glob, bool name_only);
 bool pmu_have_event(const char *pname, const char *name);
 
+int perf_pmu__scan_file(struct perf_pmu *pmu, const char *name, const char *fmt,
+			...) __attribute__((format(scanf, 3, 4)));
+
 int perf_pmu__test(void);
 
 struct perf_event_attr *perf_pmu__get_default_config(struct perf_pmu *pmu);
Signature · 1 line
1.9.3
#14 lore raw
In reply to Arnaldo Carvalho de Melo
Quoted 86 lines · Arnaldo Carvalho de Melo

Hi Ingo,

Please consider pulling,

- Arnaldo

The following changes since commit 39b5a56ec0be5effe9b7d0f18cb27724bf2e5d47:

Merge branch 'rfc/perf' into perf/core, because it's ready for inclusion (2014-08-24 22:35:42 +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 fa3480cb0a96c8af9ded1a8c836c91bd5704bda1:

perf tools: Add perf_pmu__scan_file() (2014-09-08 17:16:06 -0300)

----------------------------------------------------------------
perf/core improvements and fixes:

User visible:

o Add +field argument support for --sort option (Jiri Olsa)

Infrastructure:

o More intel PT prep work, from Adrian Hunter, including:

- Let a user specify a PMU event without any config terms
- Add perf-with-kcore script
- Build programs to copy 32-bit compatibility VDSOs
- Add support for 32-bit compatibility VDSOs
- Let default config be defined for a PMU
- Add perf_pmu__scan_file()

o Add feature checks to .gitignore (Alexander Shishkin)

o "perf kvm stat report" improvements by Alexander Yarygin:

  o  Save pid string in opts.target.pid
  o  Enable the target.system_wide flag
  o  Unify the title bar output

o Fix build issue on powerpc when DWARF support is disabled (Anton Blanchard)

o Allow to specify lib compile variable for spec usage (Jiri Olsa)

----------------------------------------------------------------
Adrian Hunter (6):
perf tools: Let a user specify a PMU event without any config terms perf tools: Add perf-with-kcore script
perf tools: Build programs to copy 32-bit compatibility VDSOs perf tools: Add support for 32-bit compatibility VDSOs perf tools: Let default config be defined for a PMU perf tools: Add perf_pmu__scan_file()

Alexander Shishkin (1):
perf tools: Add feature checks to .gitignore

Alexander Yarygin (3):
perf kvm stat report: Save pid string in opts.target.pid perf kvm stat report: Enable the target.system_wide flag perf kvm stat report: Unify the title bar output

Anton Blanchard (1):
perf tools powerpc: Fix build issue when DWARF support is disabled

Jiri Olsa (2):
perf tools: Add +field argument support for --sort option perf tools: Allow to specify lib compile variable for spec usage

 tools/perf/.gitignore            |   2 +
 tools/perf/Makefile.perf         |  42 ++++++-
 tools/perf/arch/powerpc/Makefile |   2 +-
 tools/perf/builtin-kvm.c         |  23 ++--
 tools/perf/config/Makefile       |  33 ++++-
 tools/perf/config/Makefile.arch  |   8 ++
 tools/perf/perf-read-vdso.c      |  59 +++++++++
 tools/perf/perf-with-kcore.sh    | 259 +++++++++++++++++++++++++++++++++++++++
 tools/perf/tests/pmu.c           |   2 +-
 tools/perf/util/kvm-stat.h       |   1 -
 tools/perf/util/parse-events.c   |  13 +-
 tools/perf/util/parse-events.y   |  10 ++
Quoted 8 lines
 tools/perf/util/pmu.c            |  79 +++++++++---
 tools/perf/util/pmu.h            |  12 +-
 tools/perf/util/sort.c           |  37 +++++-
 tools/perf/util/vdso.c           | 170 ++++++++++++++++++++++++-
 tools/perf/util/vdso.h           |   4 +-
 17 files changed, 712 insertions(+), 44 deletions(-)
 create mode 100644 tools/perf/perf-read-vdso.c
 create mode 100644 tools/perf/perf-with-kcore.sh

Hm, so I'm getting this error, when trying to profile a 32-bit ELF binary on a 64-bit kernel, on a testbox:

 $ perf record ~/hackbench  10
 Time: 0.115
 [ perf record: Woken up 1 times to write data ]
 [ perf record: Captured and wrote 0.373 MB perf.data (~16279 samples) ]
 sh: perf-read-vdso32: command not found

comet:~/tip> file ~/hackbench
/home/mingo/hackbench: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.2.5, not stripped

64-bit executables work fine:

 $ perf record perf bench sched pipe
 # Running 'sched/pipe' benchmark:
 # Executed 1000000 pipe operations between two processes
      Total time: 13.374 [sec]

       13.374352 usecs/op
           74769 ops/sec

[ perf record: Woken up 14 times to write data ]
[ perf record: Captured and wrote 3.602 MB perf.data (~157354 samples) ]

The kernel is an older one:

 $ uname -a
 Linux comet 3.14.17-100.fc19.x86_64 #1 SMP Thu Aug 14 17:17:26 
 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

Thanks,

Ingo

reviewer
#15 lore raw
Quoted 98 lines · Ingo Molnar
Quoted 86 lines · Arnaldo Carvalho de Melo

Hi Ingo,

Please consider pulling,

- Arnaldo

The following changes since commit 39b5a56ec0be5effe9b7d0f18cb27724bf2e5d47:

Merge branch 'rfc/perf' into perf/core, because it's ready for inclusion (2014-08-24 22:35:42 +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 fa3480cb0a96c8af9ded1a8c836c91bd5704bda1:

perf tools: Add perf_pmu__scan_file() (2014-09-08 17:16:06 -0300)

----------------------------------------------------------------
perf/core improvements and fixes:

User visible:

o Add +field argument support for --sort option (Jiri Olsa)

Infrastructure:

o More intel PT prep work, from Adrian Hunter, including:

- Let a user specify a PMU event without any config terms
- Add perf-with-kcore script
- Build programs to copy 32-bit compatibility VDSOs
- Add support for 32-bit compatibility VDSOs
- Let default config be defined for a PMU
- Add perf_pmu__scan_file()

o Add feature checks to .gitignore (Alexander Shishkin)

o "perf kvm stat report" improvements by Alexander Yarygin:

  o  Save pid string in opts.target.pid
  o  Enable the target.system_wide flag
  o  Unify the title bar output

o Fix build issue on powerpc when DWARF support is disabled (Anton Blanchard)

o Allow to specify lib compile variable for spec usage (Jiri Olsa)

----------------------------------------------------------------
Adrian Hunter (6):
perf tools: Let a user specify a PMU event without any config terms perf tools: Add perf-with-kcore script
perf tools: Build programs to copy 32-bit compatibility VDSOs perf tools: Add support for 32-bit compatibility VDSOs perf tools: Let default config be defined for a PMU perf tools: Add perf_pmu__scan_file()

Alexander Shishkin (1):
perf tools: Add feature checks to .gitignore

Alexander Yarygin (3):
perf kvm stat report: Save pid string in opts.target.pid perf kvm stat report: Enable the target.system_wide flag perf kvm stat report: Unify the title bar output

Anton Blanchard (1):
perf tools powerpc: Fix build issue when DWARF support is disabled

Jiri Olsa (2):
perf tools: Add +field argument support for --sort option perf tools: Allow to specify lib compile variable for spec usage

 tools/perf/.gitignore            |   2 +
 tools/perf/Makefile.perf         |  42 ++++++-
 tools/perf/arch/powerpc/Makefile |   2 +-
 tools/perf/builtin-kvm.c         |  23 ++--
 tools/perf/config/Makefile       |  33 ++++-
 tools/perf/config/Makefile.arch  |   8 ++
 tools/perf/perf-read-vdso.c      |  59 +++++++++
 tools/perf/perf-with-kcore.sh    | 259 +++++++++++++++++++++++++++++++++++++++
 tools/perf/tests/pmu.c           |   2 +-
 tools/perf/util/kvm-stat.h       |   1 -
 tools/perf/util/parse-events.c   |  13 +-
 tools/perf/util/parse-events.y   |  10 ++
Quoted 8 lines
 tools/perf/util/pmu.c            |  79 +++++++++---
 tools/perf/util/pmu.h            |  12 +-
 tools/perf/util/sort.c           |  37 +++++-
 tools/perf/util/vdso.c           | 170 ++++++++++++++++++++++++-
 tools/perf/util/vdso.h           |   4 +-
 17 files changed, 712 insertions(+), 44 deletions(-)
 create mode 100644 tools/perf/perf-read-vdso.c
 create mode 100644 tools/perf/perf-with-kcore.sh
Quoted 8 lines

Hm, so I'm getting this error, when trying to profile a 32-bit ELF binary on a 64-bit kernel, on a testbox:

 $ perf record ~/hackbench  10
 Time: 0.115
 [ perf record: Woken up 1 times to write data ]
 [ perf record: Captured and wrote 0.373 MB perf.data (~16279 samples) ]
 sh: perf-read-vdso32: command not found

Presumably perf-read-vdso32 is not in the PATH. Did you 'make install'?

Quoted 28 lines

comet:~/tip> file ~/hackbench
/home/mingo/hackbench: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.2.5, not stripped

64-bit executables work fine:

 $ perf record perf bench sched pipe
 # Running 'sched/pipe' benchmark:
 # Executed 1000000 pipe operations between two processes
      Total time: 13.374 [sec]

       13.374352 usecs/op
           74769 ops/sec

[ perf record: Woken up 14 times to write data ]
[ perf record: Captured and wrote 3.602 MB perf.data (~157354 samples) ]

The kernel is an older one:

 $ uname -a
 Linux comet 3.14.17-100.fc19.x86_64 #1 SMP Thu Aug 14 17:17:26 
 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

Thanks,

Ingo

#16 lore raw
Quoted 102 lines · Adrian Hunter
Quoted 101 lines · Ingo Molnar
Quoted 86 lines · Arnaldo Carvalho de Melo

Hi Ingo,

Please consider pulling,

- Arnaldo

The following changes since commit 39b5a56ec0be5effe9b7d0f18cb27724bf2e5d47:

Merge branch 'rfc/perf' into perf/core, because it's ready for inclusion (2014-08-24 22:35:42 +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 fa3480cb0a96c8af9ded1a8c836c91bd5704bda1:

perf tools: Add perf_pmu__scan_file() (2014-09-08 17:16:06 -0300)

----------------------------------------------------------------
perf/core improvements and fixes:

User visible:

o Add +field argument support for --sort option (Jiri Olsa)

Infrastructure:

o More intel PT prep work, from Adrian Hunter, including:

- Let a user specify a PMU event without any config terms
- Add perf-with-kcore script
- Build programs to copy 32-bit compatibility VDSOs
- Add support for 32-bit compatibility VDSOs
- Let default config be defined for a PMU
- Add perf_pmu__scan_file()

o Add feature checks to .gitignore (Alexander Shishkin)

o "perf kvm stat report" improvements by Alexander Yarygin:

  o  Save pid string in opts.target.pid
  o  Enable the target.system_wide flag
  o  Unify the title bar output

o Fix build issue on powerpc when DWARF support is disabled (Anton Blanchard)

o Allow to specify lib compile variable for spec usage (Jiri Olsa)

----------------------------------------------------------------
Adrian Hunter (6):
perf tools: Let a user specify a PMU event without any config terms perf tools: Add perf-with-kcore script
perf tools: Build programs to copy 32-bit compatibility VDSOs perf tools: Add support for 32-bit compatibility VDSOs perf tools: Let default config be defined for a PMU perf tools: Add perf_pmu__scan_file()

Alexander Shishkin (1):
perf tools: Add feature checks to .gitignore

Alexander Yarygin (3):
perf kvm stat report: Save pid string in opts.target.pid perf kvm stat report: Enable the target.system_wide flag perf kvm stat report: Unify the title bar output

Anton Blanchard (1):
perf tools powerpc: Fix build issue when DWARF support is disabled

Jiri Olsa (2):
perf tools: Add +field argument support for --sort option perf tools: Allow to specify lib compile variable for spec usage

 tools/perf/.gitignore            |   2 +
 tools/perf/Makefile.perf         |  42 ++++++-
 tools/perf/arch/powerpc/Makefile |   2 +-
 tools/perf/builtin-kvm.c         |  23 ++--
 tools/perf/config/Makefile       |  33 ++++-
 tools/perf/config/Makefile.arch  |   8 ++
 tools/perf/perf-read-vdso.c      |  59 +++++++++
 tools/perf/perf-with-kcore.sh    | 259 +++++++++++++++++++++++++++++++++++++++
 tools/perf/tests/pmu.c           |   2 +-
 tools/perf/util/kvm-stat.h       |   1 -
 tools/perf/util/parse-events.c   |  13 +-
 tools/perf/util/parse-events.y   |  10 ++
Quoted 8 lines
 tools/perf/util/pmu.c            |  79 +++++++++---
 tools/perf/util/pmu.h            |  12 +-
 tools/perf/util/sort.c           |  37 +++++-
 tools/perf/util/vdso.c           | 170 ++++++++++++++++++++++++-
 tools/perf/util/vdso.h           |   4 +-
 17 files changed, 712 insertions(+), 44 deletions(-)
 create mode 100644 tools/perf/perf-read-vdso.c
 create mode 100644 tools/perf/perf-with-kcore.sh

Hm, so I'm getting this error, when trying to profile a 32-bit ELF binary on a 64-bit kernel, on a testbox:

Quoted 8 lines
Quoted 5 lines
 $ perf record ~/hackbench  10
 Time: 0.115
 [ perf record: Woken up 1 times to write data ]
 [ perf record: Captured and wrote 0.373 MB perf.data (~16279 samples) ]
 sh: perf-read-vdso32: command not found

Presumably perf-read-vdso32 is not in the PATH. Did you 'make install'?

Why are we relying on an external command now in perf record?

Quoted 29 lines
Quoted 28 lines

comet:~/tip> file ~/hackbench
/home/mingo/hackbench: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.2.5, not stripped

64-bit executables work fine:

 $ perf record perf bench sched pipe
 # Running 'sched/pipe' benchmark:
 # Executed 1000000 pipe operations between two processes
      Total time: 13.374 [sec]

       13.374352 usecs/op
           74769 ops/sec

[ perf record: Woken up 14 times to write data ]
[ perf record: Captured and wrote 3.602 MB perf.data (~157354 samples) ]

The kernel is an older one:

 $ uname -a
 Linux comet 3.14.17-100.fc19.x86_64 #1 SMP Thu Aug 14 17:17:26
 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

Thanks,

Ingo

reviewer
#17 lore raw
Quoted 109 lines · Stephane Eranian
Quoted 108 lines · Adrian Hunter
Quoted 106 lines · Ingo Molnar
Quoted 86 lines · Arnaldo Carvalho de Melo

Hi Ingo,

Please consider pulling,

- Arnaldo

The following changes since commit 39b5a56ec0be5effe9b7d0f18cb27724bf2e5d47:

Merge branch 'rfc/perf' into perf/core, because it's ready for inclusion (2014-08-24 22:35:42 +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 fa3480cb0a96c8af9ded1a8c836c91bd5704bda1:

perf tools: Add perf_pmu__scan_file() (2014-09-08 17:16:06 -0300)

----------------------------------------------------------------
perf/core improvements and fixes:

User visible:

o Add +field argument support for --sort option (Jiri Olsa)

Infrastructure:

o More intel PT prep work, from Adrian Hunter, including:

- Let a user specify a PMU event without any config terms
- Add perf-with-kcore script
- Build programs to copy 32-bit compatibility VDSOs
- Add support for 32-bit compatibility VDSOs
- Let default config be defined for a PMU
- Add perf_pmu__scan_file()

o Add feature checks to .gitignore (Alexander Shishkin)

o "perf kvm stat report" improvements by Alexander Yarygin:

  o  Save pid string in opts.target.pid
  o  Enable the target.system_wide flag
  o  Unify the title bar output

o Fix build issue on powerpc when DWARF support is disabled (Anton Blanchard)

o Allow to specify lib compile variable for spec usage (Jiri Olsa)

----------------------------------------------------------------
Adrian Hunter (6):
perf tools: Let a user specify a PMU event without any config terms perf tools: Add perf-with-kcore script
perf tools: Build programs to copy 32-bit compatibility VDSOs perf tools: Add support for 32-bit compatibility VDSOs perf tools: Let default config be defined for a PMU perf tools: Add perf_pmu__scan_file()

Alexander Shishkin (1):
perf tools: Add feature checks to .gitignore

Alexander Yarygin (3):
perf kvm stat report: Save pid string in opts.target.pid perf kvm stat report: Enable the target.system_wide flag perf kvm stat report: Unify the title bar output

Anton Blanchard (1):
perf tools powerpc: Fix build issue when DWARF support is disabled

Jiri Olsa (2):
perf tools: Add +field argument support for --sort option perf tools: Allow to specify lib compile variable for spec usage

 tools/perf/.gitignore            |   2 +
 tools/perf/Makefile.perf         |  42 ++++++-
 tools/perf/arch/powerpc/Makefile |   2 +-
 tools/perf/builtin-kvm.c         |  23 ++--
 tools/perf/config/Makefile       |  33 ++++-
 tools/perf/config/Makefile.arch  |   8 ++
 tools/perf/perf-read-vdso.c      |  59 +++++++++
 tools/perf/perf-with-kcore.sh    | 259 +++++++++++++++++++++++++++++++++++++++
 tools/perf/tests/pmu.c           |   2 +-
 tools/perf/util/kvm-stat.h       |   1 -
 tools/perf/util/parse-events.c   |  13 +-
 tools/perf/util/parse-events.y   |  10 ++
Quoted 8 lines
 tools/perf/util/pmu.c            |  79 +++++++++---
 tools/perf/util/pmu.h            |  12 +-
 tools/perf/util/sort.c           |  37 +++++-
 tools/perf/util/vdso.c           | 170 ++++++++++++++++++++++++-
 tools/perf/util/vdso.h           |   4 +-
 17 files changed, 712 insertions(+), 44 deletions(-)
 create mode 100644 tools/perf/perf-read-vdso.c
 create mode 100644 tools/perf/perf-with-kcore.sh

Hm, so I'm getting this error, when trying to profile a 32-bit ELF binary on a 64-bit kernel, on a testbox:

 $ perf record ~/hackbench  10
 Time: 0.115
 [ perf record: Woken up 1 times to write data ]
 [ perf record: Captured and wrote 0.373 MB perf.data (~16279 samples) ]
 sh: perf-read-vdso32: command not found
Quoted 3 lines
Quoted 2 lines

Presumably perf-read-vdso32 is not in the PATH. Did you 'make install'?

Why are we relying on an external command now in perf record?

We are not relying on it in the sense the 'record' works without it. There is more explanation in "perf tools: Build programs to copy 32-bit compatibility VDSOs" and "perf tools: Add support for 32-bit compatibility VDSOs" (although those are the wrong versions of those patches - I will send another email about that in a moment).

Quoted 32 lines
Quoted 30 lines
Quoted 29 lines

comet:~/tip> file ~/hackbench
/home/mingo/hackbench: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.2.5, not stripped

64-bit executables work fine:

 $ perf record perf bench sched pipe
 # Running 'sched/pipe' benchmark:
 # Executed 1000000 pipe operations between two processes
      Total time: 13.374 [sec]

       13.374352 usecs/op
           74769 ops/sec

[ perf record: Woken up 14 times to write data ]
[ perf record: Captured and wrote 3.602 MB perf.data (~157354 samples) ]

The kernel is an older one:

 $ uname -a
 Linux comet 3.14.17-100.fc19.x86_64 #1 SMP Thu Aug 14 17:17:26
 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

Thanks,

Ingo

#18 lore raw
In reply to Adrian Hunter
Quoted 102 lines · Adrian Hunter
Quoted 101 lines · Ingo Molnar
Quoted 86 lines · Arnaldo Carvalho de Melo

Hi Ingo,

Please consider pulling,

- Arnaldo

The following changes since commit 39b5a56ec0be5effe9b7d0f18cb27724bf2e5d47:

Merge branch 'rfc/perf' into perf/core, because it's ready for inclusion (2014-08-24 22:35:42 +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 fa3480cb0a96c8af9ded1a8c836c91bd5704bda1:

perf tools: Add perf_pmu__scan_file() (2014-09-08 17:16:06 -0300)

----------------------------------------------------------------
perf/core improvements and fixes:

User visible:

o Add +field argument support for --sort option (Jiri Olsa)

Infrastructure:

o More intel PT prep work, from Adrian Hunter, including:

- Let a user specify a PMU event without any config terms
- Add perf-with-kcore script
- Build programs to copy 32-bit compatibility VDSOs
- Add support for 32-bit compatibility VDSOs
- Let default config be defined for a PMU
- Add perf_pmu__scan_file()

o Add feature checks to .gitignore (Alexander Shishkin)

o "perf kvm stat report" improvements by Alexander Yarygin:

  o  Save pid string in opts.target.pid
  o  Enable the target.system_wide flag
  o  Unify the title bar output

o Fix build issue on powerpc when DWARF support is disabled (Anton Blanchard)

o Allow to specify lib compile variable for spec usage (Jiri Olsa)

----------------------------------------------------------------
Adrian Hunter (6):
perf tools: Let a user specify a PMU event without any config terms perf tools: Add perf-with-kcore script
perf tools: Build programs to copy 32-bit compatibility VDSOs perf tools: Add support for 32-bit compatibility VDSOs perf tools: Let default config be defined for a PMU perf tools: Add perf_pmu__scan_file()

Alexander Shishkin (1):
perf tools: Add feature checks to .gitignore

Alexander Yarygin (3):
perf kvm stat report: Save pid string in opts.target.pid perf kvm stat report: Enable the target.system_wide flag perf kvm stat report: Unify the title bar output

Anton Blanchard (1):
perf tools powerpc: Fix build issue when DWARF support is disabled

Jiri Olsa (2):
perf tools: Add +field argument support for --sort option perf tools: Allow to specify lib compile variable for spec usage

 tools/perf/.gitignore            |   2 +
 tools/perf/Makefile.perf         |  42 ++++++-
 tools/perf/arch/powerpc/Makefile |   2 +-
 tools/perf/builtin-kvm.c         |  23 ++--
 tools/perf/config/Makefile       |  33 ++++-
 tools/perf/config/Makefile.arch  |   8 ++
 tools/perf/perf-read-vdso.c      |  59 +++++++++
 tools/perf/perf-with-kcore.sh    | 259 +++++++++++++++++++++++++++++++++++++++
 tools/perf/tests/pmu.c           |   2 +-
 tools/perf/util/kvm-stat.h       |   1 -
 tools/perf/util/parse-events.c   |  13 +-
 tools/perf/util/parse-events.y   |  10 ++
Quoted 8 lines
 tools/perf/util/pmu.c            |  79 +++++++++---
 tools/perf/util/pmu.h            |  12 +-
 tools/perf/util/sort.c           |  37 +++++-
 tools/perf/util/vdso.c           | 170 ++++++++++++++++++++++++-
 tools/perf/util/vdso.h           |   4 +-
 17 files changed, 712 insertions(+), 44 deletions(-)
 create mode 100644 tools/perf/perf-read-vdso.c
 create mode 100644 tools/perf/perf-with-kcore.sh

Hm, so I'm getting this error, when trying to profile a 32-bit ELF binary on a 64-bit kernel, on a testbox:

Quoted 7 lines
Quoted 5 lines
 $ perf record ~/hackbench  10
 Time: 0.115
 [ perf record: Woken up 1 times to write data ]
 [ perf record: Captured and wrote 0.373 MB perf.data (~16279 samples) ]
 sh: perf-read-vdso32: command not found

Presumably perf-read-vdso32 is not in the PATH. Did you 'make install'?

I did 'make install' as usual - that's the only thing that I type to install a new version of perf tooling.

Thanks,

Ingo

reviewer
#19 lore raw
In reply to Arnaldo Carvalho de Melo
Quoted 5 lines · Arnaldo Carvalho de Melo

Hi Ingo,

Please consider pulling,

- Arnaldo

I am very sorry Arnaldo but 2 patches are older versions, namely:

perf tools: Build programs to copy 32-bit compatibility VDSOs perf tools: Add support for 32-bit compatibility VDSOs

Up-to-date versions can be found from 15 August:

	patchwork:

		https://patchwork.kernel.org/patch/4729131/
		https://patchwork.kernel.org/patch/4729111/

	marc.info:

		http://marc.info/?l=linux-kernel&m=140812995414607&w=4
		http://marc.info/?l=linux-kernel&m=140812993814585&w=4

It looks like I reposted older versions by mistake on 31 July. Very sorry :-(

The originals were changed as described here:

	http://marc.info/?l=linux-kernel&m=140621020918615
	http://marc.info/?l=linux-kernel&m=140618721010170
Quoted 91 lines

The following changes since commit 39b5a56ec0be5effe9b7d0f18cb27724bf2e5d47:

Merge branch 'rfc/perf' into perf/core, because it's ready for inclusion (2014-08-24 22:35:42 +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 fa3480cb0a96c8af9ded1a8c836c91bd5704bda1:

perf tools: Add perf_pmu__scan_file() (2014-09-08 17:16:06 -0300)

----------------------------------------------------------------
perf/core improvements and fixes:

User visible:

o Add +field argument support for --sort option (Jiri Olsa)

Infrastructure:

o More intel PT prep work, from Adrian Hunter, including:

- Let a user specify a PMU event without any config terms
- Add perf-with-kcore script
- Build programs to copy 32-bit compatibility VDSOs
- Add support for 32-bit compatibility VDSOs
- Let default config be defined for a PMU
- Add perf_pmu__scan_file()

o Add feature checks to .gitignore (Alexander Shishkin)

o "perf kvm stat report" improvements by Alexander Yarygin:

  o  Save pid string in opts.target.pid
  o  Enable the target.system_wide flag
  o  Unify the title bar output

o Fix build issue on powerpc when DWARF support is disabled (Anton Blanchard)

o Allow to specify lib compile variable for spec usage (Jiri Olsa)

----------------------------------------------------------------
Adrian Hunter (6):
perf tools: Let a user specify a PMU event without any config terms perf tools: Add perf-with-kcore script
perf tools: Build programs to copy 32-bit compatibility VDSOs perf tools: Add support for 32-bit compatibility VDSOs perf tools: Let default config be defined for a PMU perf tools: Add perf_pmu__scan_file()

Alexander Shishkin (1):
perf tools: Add feature checks to .gitignore

Alexander Yarygin (3):
perf kvm stat report: Save pid string in opts.target.pid perf kvm stat report: Enable the target.system_wide flag perf kvm stat report: Unify the title bar output

Anton Blanchard (1):
perf tools powerpc: Fix build issue when DWARF support is disabled

Jiri Olsa (2):
perf tools: Add +field argument support for --sort option perf tools: Allow to specify lib compile variable for spec usage

 tools/perf/.gitignore            |   2 +
 tools/perf/Makefile.perf         |  42 ++++++-
 tools/perf/arch/powerpc/Makefile |   2 +-
 tools/perf/builtin-kvm.c         |  23 ++--
 tools/perf/config/Makefile       |  33 ++++-
 tools/perf/config/Makefile.arch  |   8 ++
 tools/perf/perf-read-vdso.c      |  59 +++++++++
 tools/perf/perf-with-kcore.sh    | 259 +++++++++++++++++++++++++++++++++++++++
 tools/perf/tests/pmu.c           |   2 +-
 tools/perf/util/kvm-stat.h       |   1 -
 tools/perf/util/parse-events.c   |  13 +-
 tools/perf/util/parse-events.y   |  10 ++
 tools/perf/util/pmu.c            |  79 +++++++++---
 tools/perf/util/pmu.h            |  12 +-
 tools/perf/util/sort.c           |  37 +++++-
 tools/perf/util/vdso.c           | 170 ++++++++++++++++++++++++-
 tools/perf/util/vdso.h           |   4 +-
 17 files changed, 712 insertions(+), 44 deletions(-)
 create mode 100644 tools/perf/perf-read-vdso.c
 create mode 100644 tools/perf/perf-with-kcore.sh
author maintainer
#20 lore raw

Em Tue, Sep 09, 2014 at 11:48:20AM +0300, Adrian Hunter escreveu:

Quoted 7 lines

It looks like I reposted older versions by mistake on 31 July. Very sorry :-(

The originals were changed as described here:

	http://marc.info/?l=linux-kernel&m=140621020918615
	http://marc.info/?l=linux-kernel&m=140618721010170

No problem, the good thing is that we're almost getting it all in. I'll rework the branch and resubmit, Ingo, is that OK with you? Or have you already pulled and we should instead send a patch on top, fixing the problem?

- Arnaldo

#21 lore raw
Quoted 4 lines · Arnaldo Carvalho de Melo

Em Tue, Sep 09, 2014 at 11:48:20AM +0300, Adrian Hunter escreveu:

Quoted 3 lines

It looks like I reposted older versions by mistake on 31 July. Very sorry :-(

Quoted 8 lines
Quoted 4 lines

The originals were changed as described here:

	http://marc.info/?l=linux-kernel&m=140621020918615
	http://marc.info/?l=linux-kernel&m=140618721010170

No problem, the good thing is that we're almost getting it all in. I'll rework the branch and resubmit, Ingo, is that OK with you? [...]

Yeah, that's perfectly OK.

Quoted 2 lines

[...] Or have you already pulled and we should instead send a patch on top, fixing the problem?

I pulled it locally then unpulled as it didn't pass my (very simple) tests and it looked like there's something fishy going on.

Thanks,

Ingo

author maintainer
#22 lore raw

Em Tue, Sep 09, 2014 at 04:54:49PM +0200, Ingo Molnar escreveu:

Quoted 15 lines · Arnaldo Carvalho de Melo
Quoted 5 lines

Em Tue, Sep 09, 2014 at 11:48:20AM +0300, Adrian Hunter escreveu:

Quoted 2 lines

It looks like I reposted older versions by mistake on 31 July. Very sorry :-(

Quoted 8 lines
Quoted 4 lines

The originals were changed as described here:

	http://marc.info/?l=linux-kernel&m=140621020918615
	http://marc.info/?l=linux-kernel&m=140618721010170

No problem, the good thing is that we're almost getting it all in. I'll rework the branch and resubmit, Ingo, is that OK with you? [...]

Quoted 8 lines

Yeah, that's perfectly OK.

Quoted 2 lines

[...] Or have you already pulled and we should instead send a patch on top, fixing the problem?

I pulled it locally then unpulled as it didn't pass my (very simple) tests and it looked like there's something fishy going on.

Yeah, I should've tested this more, will make sure I test these things this time.

Having a requirement that for each new feature we need an entry in 'perf test' and/or in make -C tools/perf build-test seems a bit harsh, but would be ideal, hook that to 'git request-pull' and this would hopefully only happen every celestial aligment nights or so :-\

- Arnaldo

author maintainer
#23 lore raw
In reply to Adrian Hunter

Em Tue, Sep 09, 2014 at 11:48:20AM +0300, Adrian Hunter escreveu:

Quoted 12 lines · Arnaldo Carvalho de Melo
Quoted 5 lines

Hi Ingo,

Please consider pulling,

- Arnaldo

I am very sorry Arnaldo but 2 patches are older versions, namely:

perf tools: Build programs to copy 32-bit compatibility VDSOs perf tools: Add support for 32-bit compatibility VDSOs

Quoted 6 lines

Up-to-date versions can be found from 15 August:

	patchwork:

		https://patchwork.kernel.org/patch/4729131/
		https://patchwork.kernel.org/patch/4729111/

Ok, those don't apply, as it expects other stuff, that you sent before, but were not processed yet, to be in place, I'm fixing it up.

- Arnaldo

Quoted 104 lines
	marc.info:

		http://marc.info/?l=linux-kernel&m=140812995414607&w=4
		http://marc.info/?l=linux-kernel&m=140812993814585&w=4

It looks like I reposted older versions by mistake on 31 July. Very sorry :-(

The originals were changed as described here:

	http://marc.info/?l=linux-kernel&m=140621020918615
	http://marc.info/?l=linux-kernel&m=140618721010170
Quoted 91 lines

The following changes since commit 39b5a56ec0be5effe9b7d0f18cb27724bf2e5d47:

Merge branch 'rfc/perf' into perf/core, because it's ready for inclusion (2014-08-24 22:35:42 +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 fa3480cb0a96c8af9ded1a8c836c91bd5704bda1:

perf tools: Add perf_pmu__scan_file() (2014-09-08 17:16:06 -0300)

----------------------------------------------------------------
perf/core improvements and fixes:

User visible:

o Add +field argument support for --sort option (Jiri Olsa)

Infrastructure:

o More intel PT prep work, from Adrian Hunter, including:

- Let a user specify a PMU event without any config terms
- Add perf-with-kcore script
- Build programs to copy 32-bit compatibility VDSOs
- Add support for 32-bit compatibility VDSOs
- Let default config be defined for a PMU
- Add perf_pmu__scan_file()

o Add feature checks to .gitignore (Alexander Shishkin)

o "perf kvm stat report" improvements by Alexander Yarygin:

  o  Save pid string in opts.target.pid
  o  Enable the target.system_wide flag
  o  Unify the title bar output

o Fix build issue on powerpc when DWARF support is disabled (Anton Blanchard)

o Allow to specify lib compile variable for spec usage (Jiri Olsa)

----------------------------------------------------------------
Adrian Hunter (6):
perf tools: Let a user specify a PMU event without any config terms perf tools: Add perf-with-kcore script
perf tools: Build programs to copy 32-bit compatibility VDSOs perf tools: Add support for 32-bit compatibility VDSOs perf tools: Let default config be defined for a PMU perf tools: Add perf_pmu__scan_file()

Alexander Shishkin (1):
perf tools: Add feature checks to .gitignore

Alexander Yarygin (3):
perf kvm stat report: Save pid string in opts.target.pid perf kvm stat report: Enable the target.system_wide flag perf kvm stat report: Unify the title bar output

Anton Blanchard (1):
perf tools powerpc: Fix build issue when DWARF support is disabled

Jiri Olsa (2):
perf tools: Add +field argument support for --sort option perf tools: Allow to specify lib compile variable for spec usage

 tools/perf/.gitignore            |   2 +
 tools/perf/Makefile.perf         |  42 ++++++-
 tools/perf/arch/powerpc/Makefile |   2 +-
 tools/perf/builtin-kvm.c         |  23 ++--
 tools/perf/config/Makefile       |  33 ++++-
 tools/perf/config/Makefile.arch  |   8 ++
 tools/perf/perf-read-vdso.c      |  59 +++++++++
 tools/perf/perf-with-kcore.sh    | 259 +++++++++++++++++++++++++++++++++++++++
 tools/perf/tests/pmu.c           |   2 +-
 tools/perf/util/kvm-stat.h       |   1 -
 tools/perf/util/parse-events.c   |  13 +-
 tools/perf/util/parse-events.y   |  10 ++
 tools/perf/util/pmu.c            |  79 +++++++++---
 tools/perf/util/pmu.h            |  12 +-
 tools/perf/util/sort.c           |  37 +++++-
 tools/perf/util/vdso.c           | 170 ++++++++++++++++++++++++-
 tools/perf/util/vdso.h           |   4 +-
 17 files changed, 712 insertions(+), 44 deletions(-)
 create mode 100644 tools/perf/perf-read-vdso.c
 create mode 100644 tools/perf/perf-with-kcore.sh
reviewer
#24 lore raw
Quoted 15 lines · Arnaldo Carvalho de Melo

Em Tue, Sep 09, 2014 at 11:48:20AM +0300, Adrian Hunter escreveu:

Quoted 14 lines · Arnaldo Carvalho de Melo
Quoted 5 lines

Hi Ingo,

Please consider pulling,

- Arnaldo

I am very sorry Arnaldo but 2 patches are older versions, namely:

perf tools: Build programs to copy 32-bit compatibility VDSOs perf tools: Add support for 32-bit compatibility VDSOs

Up-to-date versions can be found from 15 August:

Quoted 8 lines
Quoted 4 lines
	patchwork:

		https://patchwork.kernel.org/patch/4729131/
		https://patchwork.kernel.org/patch/4729111/

Ok, those don't apply, as it expects other stuff, that you sent before, but were not processed yet, to be in place, I'm fixing it up.

Something like this might prevent Ingo's error message:

From: Adrian Hunter <[email protected]>
Date: Wed, 10 Sep 2014 16:14:50 +0300
Subject: [PATCH] perf tools: Do not attempt to run perf-read-vdso32 if it
wasn't built

popen() causes an error message to print if perf-read-vdso32 does not run. Avoid that by not trying to run it if it was not built. Ditto perf-read-vdsox32.

---
 tools/perf/config/Makefile |  8 ++++++--
 tools/perf/util/vdso.c     | 10 ++++++++++
 2 files changed, 16 insertions(+), 2 deletions(-)
tools/perf/config/Makefile +6 -2
index 3ba2382..71264e4 100644
@@ -627,7 +627,9 @@ endif
 ifeq (${IS_64_BIT}, 1)
   ifndef NO_PERF_READ_VDSO32
     $(call feature_check,compile-32)
-    ifneq ($(feature-compile-32), 1)
+    ifeq ($(feature-compile-32), 1)
+      CFLAGS += -DHAVE_PERF_READ_VDSO32
+    else
       NO_PERF_READ_VDSO32 := 1
     endif
   endif
@@ -636,7 +638,9 @@ ifeq (${IS_64_BIT}, 1)
   endif
   ifndef NO_PERF_READ_VDSOX32
     $(call feature_check,compile-x32)
-    ifneq ($(feature-compile-x32), 1)
+    ifeq ($(feature-compile-x32), 1)
+      CFLAGS += -DHAVE_PERF_READ_VDSOX32
+    else
       NO_PERF_READ_VDSOX32 := 1
     endif
   endif
tools/perf/util/vdso.c +0 -0
index 69daef6..5c7dd79 100644
@@ -255,6 +255,16 @@ static int vdso__dso_findnew_compat(struct machine

*machine,
enum dso_type dso_type;

dso_type = machine__thread_dso_type(machine, thread);
+
+#ifndef HAVE_PERF_READ_VDSO32
+ if (dso_type == DSO__TYPE_32BIT)
+ return 0;
+#endif
+#ifndef HAVE_PERF_READ_VDSOX32
+ if (dso_type == DSO__TYPE_X32BIT)
+ return 0;
+#endif
+
switch (dso_type) {
case DSO__TYPE_32BIT:
*dso = vdso__findnew_compat(machine, &vdso_info->vdso32);

Signature · 1 line
1.8.3.2