Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8e70e840 authored by Ingo Molnar's avatar Ingo Molnar
Browse files

Merge tag 'perf-core-for-mingo-4.13-20170621' of...

Merge tag 'perf-core-for-mingo-4.13-20170621' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux

 into perf/core

Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:

New features:

 - Add support to measure SMI cost in 'perf stat' (Kan Liang)

 - Add support for unwinding callchains in powerpc with libdw (Paolo Bonzini)

Fixes:

 - Fix message: cpu list option is -C not -c (Adrian Hunter)

 - Fix 'perf script' message: field list option is -F not -f (Adrian Hunter)

 - Intel PT fixes: (Adrian Hunter)

   o Fix missing stack clear
   o Ensure IP is zero when state is INTEL_PT_STATE_NO_IP
   o Fix last_ip usage
   o Ensure never to set 'last_ip' when packet 'count' is zero
   o Clear FUP flag on error
   o Fix transactions_sample_type

Infrastructure changes:

 - Intel PT cleanups/refactorings (Adrian Hunter)

   o Use FUP always when scanning for an IP
   o Add missing __fallthrough
   o Remove redundant initial_skip checks
   o Allow decoding with branch tracing disabled
   o Add default config for pass-through branch enable
   o Add documentation for new config terms
   o Add decoder support for ptwrite and power event packets
   o Add reserved byte to CBR packet payload
   o Add decoder support for CBR events

 - Move  find_process() to the only place that uses it, skimming some
   more fat from util.[ch] (Arnaldo Carvalho de Melo)

 - Do parameter validation earlier on fetch_kernel_version() (Arnaldo Carvalho de Melo)

 - Remove unused _ALL_SOURCE define (Arnaldo Carvalho de Melo)

 - Add sysfs__write_int function (Kan Liang)

Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parents 007b811b 701516ae
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
@@ -387,6 +387,22 @@ int filename__read_str(const char *filename, char **buf, size_t *sizep)
	return err;
}

int filename__write_int(const char *filename, int value)
{
	int fd = open(filename, O_WRONLY), err = -1;
	char buf[64];

	if (fd < 0)
		return err;

	sprintf(buf, "%d", value);
	if (write(fd, buf, sizeof(buf)) == sizeof(buf))
		err = 0;

	close(fd);
	return err;
}

int procfs__read_str(const char *entry, char **buf, size_t *sizep)
{
	char path[PATH_MAX];
@@ -480,3 +496,17 @@ int sysctl__read_int(const char *sysctl, int *value)

	return filename__read_int(path, value);
}

int sysfs__write_int(const char *entry, int value)
{
	char path[PATH_MAX];
	const char *sysfs = sysfs__mountpoint();

	if (!sysfs)
		return -1;

	if (snprintf(path, sizeof(path), "%s/%s", sysfs, entry) >= PATH_MAX)
		return -1;

	return filename__write_int(path, value);
}
+4 −0
Original line number Diff line number Diff line
@@ -31,6 +31,8 @@ int filename__read_int(const char *filename, int *value);
int filename__read_ull(const char *filename, unsigned long long *value);
int filename__read_str(const char *filename, char **buf, size_t *sizep);

int filename__write_int(const char *filename, int value);

int procfs__read_str(const char *entry, char **buf, size_t *sizep);

int sysctl__read_int(const char *sysctl, int *value);
@@ -38,4 +40,6 @@ int sysfs__read_int(const char *entry, int *value);
int sysfs__read_ull(const char *entry, unsigned long long *value);
int sysfs__read_str(const char *entry, char **buf, size_t *sizep);
int sysfs__read_bool(const char *entry, bool *value);

int sysfs__write_int(const char *entry, int value);
#endif /* __API_FS__ */
+36 −0
Original line number Diff line number Diff line
@@ -364,6 +364,42 @@ cyc_thresh Specifies how frequently CYC packets are produced - see cyc

		CYC packets are not requested by default.

pt		Specifies pass-through which enables the 'branch' config term.

		The default config selects 'pt' if it is available, so a user will
		never need to specify this term.

branch		Enable branch tracing.  Branch tracing is enabled by default so to
		disable branch tracing use 'branch=0'.

		The default config selects 'branch' if it is available.

ptw		Enable PTWRITE packets which are produced when a ptwrite instruction
		is executed.

		Support for this feature is indicated by:

			/sys/bus/event_source/devices/intel_pt/caps/ptwrite

		which contains "1" if the feature is supported and
		"0" otherwise.

fup_on_ptw	Enable a FUP packet to follow the PTWRITE packet.  The FUP packet
		provides the address of the ptwrite instruction.  In the absence of
		fup_on_ptw, the decoder will use the address of the previous branch
		if branch tracing is enabled, otherwise the address will be zero.
		Note that fup_on_ptw will work even when branch tracing is disabled.

pwr_evt		Enable power events.  The power events provide information about
		changes to the CPU C-state.

		Support for this feature is indicated by:

			/sys/bus/event_source/devices/intel_pt/caps/power_event_trace

		which contains "1" if the feature is supported and
		"0" otherwise.


new snapshot option
-------------------
+14 −0
Original line number Diff line number Diff line
@@ -239,6 +239,20 @@ taskset.
--no-merge::
Do not merge results from same PMUs.

--smi-cost::
Measure SMI cost if msr/aperf/ and msr/smi/ events are supported.

During the measurement, the /sys/device/cpu/freeze_on_smi will be set to
freeze core counters on SMI.
The aperf counter will not be effected by the setting.
The cost of SMI can be measured by (aperf - unhalted core cycles).

In practice, the percentages of SMI cycles is very useful for performance
oriented analysis. --metric_only will be applied by default.
The output is SMI cycles%, equals to (aperf - unhalted core cycles) / aperf

Users who wants to get the actual value can apply --no-metric-only.

EXAMPLES
--------

+1 −1
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ endif
# Disable it on all other architectures in case libdw unwind
# support is detected in system. Add supported architectures
# to the check.
ifneq ($(SRCARCH),$(filter $(SRCARCH),x86 arm))
ifneq ($(SRCARCH),$(filter $(SRCARCH),x86 arm powerpc))
  NO_LIBDW_DWARF_UNWIND := 1
endif

Loading