Commit dcde237b authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'perf-tools-fixes-2020-07-07' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux

Pull perf tooling fixes from Arnaldo Carvalho de Melo:

 - Intel PT fixes for PEBS-via-PT with registers

 - Fixes for Intel PT python based GUI

 - Avoid duplicated sideband events with Intel PT in system wide tracing

 - Remove needless 'dummy' event from TUI menu, used when synthesizing
   meta data events for pre-existing processes

 - Fix corner case segfault when pressing enter in a screen without
   entries in the TUI for report/top

 - Fixes for time stamp handling in libtraceevent

 - Explicitly set utf-8 encoding in perf flamegraph

 - Update arch/x86/lib/memcpy_64.S copy used in 'perf bench mem memcpy',
   silencing perf build warning

* tag 'perf-tools-fixes-2020-07-07' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux:
  perf report TUI: Remove needless 'dummy' event from menu
  perf intel-pt: Fix PEBS sample for XMM registers
  perf intel-pt: Fix displaying PEBS-via-PT with registers
  perf intel-pt: Fix recording PEBS-via-PT with registers
  perf report TUI: Fix segmentation fault in perf_evsel__hists_browse()
  tools lib traceevent: Add proper KBUFFER_TYPE_TIME_STAMP handling
  tools lib traceevent: Add API to read time information from kbuffer
  perf scripts python: exported-sql-viewer.py: Fix time chart call tree
  perf scripts python: exported-sql-viewer.py: Fix zero id in call tree 'Find' result
  perf scripts python: exported-sql-viewer.py: Fix zero id in call graph 'Find' result
  perf scripts python: exported-sql-viewer.py: Fix unexpanded 'Find' result
  perf record: Fix duplicated sideband events with Intel PT system wide tracing
  perf scripts python: export-to-postgresql.py: Fix struct.pack() int argument
  tools arch: Update arch/x86/lib/memcpy_64.S copy used in 'perf bench mem memcpy'
  perf flamegraph: Explicitly set utf-8 encoding
parents 6d12075d bee9ca1c
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -8,6 +8,8 @@
#include <asm/alternative-asm.h>
#include <asm/export.h>

.pushsection .noinstr.text, "ax"

/*
 * We build a jump to memcpy_orig by default which gets NOPped out on
 * the majority of x86 CPUs which set REP_GOOD. In addition, CPUs which
@@ -184,6 +186,8 @@ SYM_FUNC_START(memcpy_orig)
	retq
SYM_FUNC_END(memcpy_orig)

.popsection

#ifndef CONFIG_UML

MCSAFE_TEST_CTL
+37 −6
Original line number Diff line number Diff line
@@ -361,6 +361,7 @@ translate_data(struct kbuffer *kbuf, void *data, void **rptr,
		break;

	case KBUFFER_TYPE_TIME_EXTEND:
	case KBUFFER_TYPE_TIME_STAMP:
		extend = read_4(kbuf, data);
		data += 4;
		extend <<= TS_SHIFT;
@@ -369,10 +370,6 @@ translate_data(struct kbuffer *kbuf, void *data, void **rptr,
		*length = 0;
		break;

	case KBUFFER_TYPE_TIME_STAMP:
		data += 12;
		*length = 0;
		break;
	case 0:
		*length = read_4(kbuf, data) - 4;
		*length = (*length + 3) & ~3;
@@ -397,7 +394,11 @@ static unsigned int update_pointers(struct kbuffer *kbuf)

	type_len = translate_data(kbuf, ptr, &ptr, &delta, &length);

	if (type_len == KBUFFER_TYPE_TIME_STAMP)
		kbuf->timestamp = delta;
	else
		kbuf->timestamp += delta;

	kbuf->index = calc_index(kbuf, ptr);
	kbuf->next = kbuf->index + length;

@@ -454,7 +455,9 @@ static int __next_event(struct kbuffer *kbuf)
		if (kbuf->next >= kbuf->size)
			return -1;
		type = update_pointers(kbuf);
	} while (type == KBUFFER_TYPE_TIME_EXTEND || type == KBUFFER_TYPE_PADDING);
	} while (type == KBUFFER_TYPE_TIME_EXTEND ||
		 type == KBUFFER_TYPE_TIME_STAMP ||
		 type == KBUFFER_TYPE_PADDING);

	return 0;
}
@@ -546,6 +549,34 @@ int kbuffer_load_subbuffer(struct kbuffer *kbuf, void *subbuffer)
	return 0;
}

/**
 * kbuffer_subbuf_timestamp - read the timestamp from a sub buffer
 * @kbuf:      The kbuffer to load
 * @subbuf:    The subbuffer to read from.
 *
 * Return the timestamp from a subbuffer.
 */
unsigned long long kbuffer_subbuf_timestamp(struct kbuffer *kbuf, void *subbuf)
{
	return kbuf->read_8(subbuf);
}

/**
 * kbuffer_ptr_delta - read the delta field from a record
 * @kbuf:      The kbuffer to load
 * @ptr:       The record in the buffe.
 *
 * Return the timestamp delta from a record
 */
unsigned int kbuffer_ptr_delta(struct kbuffer *kbuf, void *ptr)
{
	unsigned int type_len_ts;

	type_len_ts = read_4(kbuf, ptr);
	return ts4host(kbuf, type_len_ts);
}


/**
 * kbuffer_read_event - read the next event in the kbuffer subbuffer
 * @kbuf:	The kbuffer to read from
+2 −0
Original line number Diff line number Diff line
@@ -49,6 +49,8 @@ int kbuffer_load_subbuffer(struct kbuffer *kbuf, void *subbuffer);
void *kbuffer_read_event(struct kbuffer *kbuf, unsigned long long *ts);
void *kbuffer_next_event(struct kbuffer *kbuf, unsigned long long *ts);
unsigned long long kbuffer_timestamp(struct kbuffer *kbuf);
unsigned long long kbuffer_subbuf_timestamp(struct kbuffer *kbuf, void *subbuf);
unsigned int kbuffer_ptr_delta(struct kbuffer *kbuf, void *ptr);

void *kbuffer_translate_data(int swap, void *data, unsigned int *size);

+1 −0
Original line number Diff line number Diff line
@@ -641,6 +641,7 @@ static int intel_pt_recording_options(struct auxtrace_record *itr,
			}
			evsel->core.attr.freq = 0;
			evsel->core.attr.sample_period = 1;
			evsel->no_aux_samples = true;
			intel_pt_evsel = evsel;
			opts->full_auxtrace = true;
		}
+9 −9
Original line number Diff line number Diff line
@@ -852,20 +852,20 @@ static int record__open(struct record *rec)
	 * event synthesis.
	 */
	if (opts->initial_delay || target__has_cpu(&opts->target)) {
		pos = perf_evlist__get_tracking_event(evlist);
		if (!evsel__is_dummy_event(pos)) {
			/* Set up dummy event. */
			if (perf_evlist__add_dummy(evlist))
				return -ENOMEM;

		/* Disable tracking of mmaps on lead event. */
		pos = evlist__first(evlist);
		pos->tracking = 0;
		/* Set up dummy event. */
			pos = evlist__last(evlist);
		pos->tracking = 1;
			perf_evlist__set_tracking_event(evlist, pos);
		}

		/*
		 * Enable the dummy event when the process is forked for
		 * initial_delay, immediately for system wide.
		 */
		if (opts->initial_delay)
		if (opts->initial_delay && !pos->immediate)
			pos->core.attr.enable_on_exec = 1;
		else
			pos->immediate = 1;
Loading