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

Commit efe8eaf7 authored by Ingo Molnar's avatar Ingo Molnar
Browse files

Merge tag 'perf-core-for-mingo-4.20-20181025' of...

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

 into perf/urgent

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

- Introduce 'perf trace --max-events' for stopping 'perf trace' when
  that many syscalls (enter+exit), tracepoints or other events such as
  page faults take place.

  Support that as well on a per-event basis, e.g.:

   perf trace -e sched:*switch/nr=2/,block:*_plug/nr=4/,block:*_unplug/nr=1/,net:*dev_queue/nr=3,max-stack=16/

  Will stop when 2 context switches, 4 block plugs, 1 block unplug and
  3 net_dev_queue tracepoints take place. (Arnaldo Carvalho de Melo)

- Poll for monitored tasks being alive in 'perf stat -p/-t', exiting when
  those tasks all terminate (Jiri Olsa)

- Encode -k clockid frequency into perf.data to enable timestamps derived
  metrics conversion into wall clock time on reporting stage. (Alexey Budankov)

- Improve Intel PT call graph from SQL database and GUI python scripts,
  including adopting the Qt MDI interface to allow for multiple subwindows
  for all the tables, helping in better visualizing the data in the SQL
  tables, also uses, when available, the Intel XED disassembler libraries
  to present the Intel PT data as x86 asm mnemonics. This last feature
  is not currently working in some cases, fix is being discussed (Adrian Hunter)

- Implement a ftrace function_graph view in 'perf script' when processing
  hardware trace data such as Intel PT (Andi Kleen)

- Better integration with the Intel XED disassembler, when available, in
  'perf script' (Andi Kleen)

- Some 'perf trace' drop refcount fixes (Arnaldo Carvalho de Melo)

- Add Sparc support to 'perf annotate', jitdump (David Miller)

- Fix PLT symbols entry/header sizes properly on Sparc (David Miller)

- Fix generation of system call table failure with /tmp mounted with 'noexec'
  in arm64 (Hongxu Jia)

- Allow extended console debug output in 'perf script' (Milian Wolff)

- Flush output stream after events in 'perf script' verbose mode (Milian Wolff)

Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parents 034bda1c fe57120e
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -116,6 +116,7 @@ static int get_value(struct parse_opt_ctx_t *p,
		case OPTION_INTEGER:
		case OPTION_UINTEGER:
		case OPTION_LONG:
		case OPTION_ULONG:
		case OPTION_U64:
		default:
			break;
@@ -166,6 +167,7 @@ static int get_value(struct parse_opt_ctx_t *p,
		case OPTION_INTEGER:
		case OPTION_UINTEGER:
		case OPTION_LONG:
		case OPTION_ULONG:
		case OPTION_U64:
		default:
			break;
@@ -295,6 +297,22 @@ static int get_value(struct parse_opt_ctx_t *p,
			return opterror(opt, "expects a numerical value", flags);
		return 0;

	case OPTION_ULONG:
		if (unset) {
			*(unsigned long *)opt->value = 0;
			return 0;
		}
		if (opt->flags & PARSE_OPT_OPTARG && !p->opt) {
			*(unsigned long *)opt->value = opt->defval;
			return 0;
		}
		if (get_arg(p, opt, flags, &arg))
			return -1;
		*(unsigned long *)opt->value = strtoul(arg, (char **)&s, 10);
		if (*s)
			return opterror(opt, "expects a numerical value", flags);
		return 0;

	case OPTION_U64:
		if (unset) {
			*(u64 *)opt->value = 0;
@@ -703,6 +721,7 @@ static void print_option_help(const struct option *opts, int full)
	case OPTION_ARGUMENT:
		break;
	case OPTION_LONG:
	case OPTION_ULONG:
	case OPTION_U64:
	case OPTION_INTEGER:
	case OPTION_UINTEGER:
+2 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ enum parse_opt_type {
	OPTION_STRING,
	OPTION_INTEGER,
	OPTION_LONG,
	OPTION_ULONG,
	OPTION_CALLBACK,
	OPTION_U64,
	OPTION_UINTEGER,
@@ -133,6 +134,7 @@ struct option {
#define OPT_INTEGER(s, l, v, h)     { .type = OPTION_INTEGER, .short_name = (s), .long_name = (l), .value = check_vtype(v, int *), .help = (h) }
#define OPT_UINTEGER(s, l, v, h)    { .type = OPTION_UINTEGER, .short_name = (s), .long_name = (l), .value = check_vtype(v, unsigned int *), .help = (h) }
#define OPT_LONG(s, l, v, h)        { .type = OPTION_LONG, .short_name = (s), .long_name = (l), .value = check_vtype(v, long *), .help = (h) }
#define OPT_ULONG(s, l, v, h)        { .type = OPTION_ULONG, .short_name = (s), .long_name = (l), .value = check_vtype(v, unsigned long *), .help = (h) }
#define OPT_U64(s, l, v, h)         { .type = OPTION_U64, .short_name = (s), .long_name = (l), .value = check_vtype(v, u64 *), .help = (h) }
#define OPT_STRING(s, l, v, a, h)   { .type = OPTION_STRING,  .short_name = (s), .long_name = (l), .value = check_vtype(v, const char **), .argh = (a), .help = (h) }
#define OPT_STRING_OPTARG(s, l, v, a, h, d) \
+19 −0
Original line number Diff line number Diff line

For --xed the xed tool is needed. Here is how to install it:

  $ git clone https://github.com/intelxed/mbuild.git mbuild
  $ git clone https://github.com/intelxed/xed
  $ cd xed
  $ ./mfile.py --share
  $ ./mfile.py examples
  $ sudo ./mfile.py --prefix=/usr/local install
  $ sudo ldconfig
  $ sudo cp obj/examples/xed /usr/local/bin

Basic xed testing:

  $ xed | head -3
  ERROR: required argument(s) were missing
  Copyright (C) 2017, Intel Corporation. All rights reserved.
  XED version: [v10.0-328-g7d62c8c49b7b]
  $
+1 −1
Original line number Diff line number Diff line
@@ -106,7 +106,7 @@ in transaction, respectively.
While it is possible to create scripts to analyze the data, an alternative
approach is available to export the data to a sqlite or postgresql database.
Refer to script export-to-sqlite.py or export-to-postgresql.py for more details,
and to script call-graph-from-sql.py for an example of using the database.
and to script exported-sql-viewer.py for an example of using the database.

There is also script intel-pt-events.py which provides an example of how to
unpack the raw data for power events and PTWRITE.
+4 −3
Original line number Diff line number Diff line
@@ -11,10 +11,11 @@
		l	synthesize last branch entries (use with i or x)
		s       skip initial number of events

	The default is all events i.e. the same as --itrace=ibxwpe
	The default is all events i.e. the same as --itrace=ibxwpe,
	except for perf script where it is --itrace=ce

	In addition, the period (default 100000) for instructions events
	can be specified in units of:
	In addition, the period (default 100000, except for perf script where it is 1)
	for instructions events can be specified in units of:

		i	instructions
		t	ticks
Loading