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

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

Merge tag 'perf-urgent-for-mingo' of...

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

 into perf/urgent

Pull perf/urgent fixes from Arnaldo Carvalho de Melo:

 * Handle perf.data files with no tracepoints in 'perf trace', fixing a
   segfault.

 * Fix up MMAP2 buffer space reservation, a problem that was caught via
   'perf test' consistency tests.

 * Add attr->mmap2 support in the tools, a patch that should've been merged
   together with the kernel counterpart:

     13d7a241 "perf: Add attr->mmap2 attribute to an event".

   Merging it allowed us to catch the MMAP buffer space reservation problem via
   'perf test'. From Stephane Eranian.

   The tools deals with older kernels by disabling this feature, resetting the
   perf_event_attr.mmap2 bit, when -EINVAL is returned by perf_event_open, just
   like with perf_event_attr.{sample_id_all,exclude_{guest,host}}.

   When such fallback happens the perf_missing_features.mmap2 flag is set to
   true and can be used by tooling that strictly needs this feature to check
   for its availability on the running kernel.

 * Make sure we can find PERF_SAMPLE_ID in the variable part of PERF_RECORD_
   ring buffer records in 'perf kvm', where direct manipulation of sample_type
   was being done.

   Fixed by making use of the perf_evlist__set_sample_bit() helper and by
   setting the evlist->id_pos in perf_evlist__open(), from Adrian Hunter.

Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parents 72f4a11d d008d525
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -5039,6 +5039,7 @@ static void perf_event_mmap_output(struct perf_event *event,
		mmap_event->event_id.header.size += sizeof(mmap_event->maj);
		mmap_event->event_id.header.size += sizeof(mmap_event->min);
		mmap_event->event_id.header.size += sizeof(mmap_event->ino);
		mmap_event->event_id.header.size += sizeof(mmap_event->ino_generation);
	}

	perf_event_header__init_id(&mmap_event->event_id.header, &sample, event);
+1 −0
Original line number Diff line number Diff line
@@ -277,6 +277,7 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused)
		.tool = {
			.sample	= process_sample_event,
			.mmap	= perf_event__process_mmap,
			.mmap2	= perf_event__process_mmap2,
			.comm	= perf_event__process_comm,
			.exit	= perf_event__process_exit,
			.fork	= perf_event__process_fork,
+15 −0
Original line number Diff line number Diff line
@@ -123,6 +123,19 @@ static int perf_event__repipe_mmap(struct perf_tool *tool,
	return err;
}

static int perf_event__repipe_mmap2(struct perf_tool *tool,
				   union perf_event *event,
				   struct perf_sample *sample,
				   struct machine *machine)
{
	int err;

	err = perf_event__process_mmap2(tool, event, sample, machine);
	perf_event__repipe(tool, event, sample, machine);

	return err;
}

static int perf_event__repipe_fork(struct perf_tool *tool,
				   union perf_event *event,
				   struct perf_sample *sample,
@@ -339,6 +352,7 @@ static int __cmd_inject(struct perf_inject *inject)

	if (inject->build_ids || inject->sched_stat) {
		inject->tool.mmap	  = perf_event__repipe_mmap;
		inject->tool.mmap2	  = perf_event__repipe_mmap2;
		inject->tool.fork	  = perf_event__repipe_fork;
		inject->tool.tracing_data = perf_event__repipe_tracing_data;
	}
@@ -390,6 +404,7 @@ int cmd_inject(int argc, const char **argv, const char *prefix __maybe_unused)
		.tool = {
			.sample		= perf_event__repipe_sample,
			.mmap		= perf_event__repipe,
			.mmap2		= perf_event__repipe,
			.comm		= perf_event__repipe,
			.fork		= perf_event__repipe,
			.exit		= perf_event__repipe,
+9 −9
Original line number Diff line number Diff line
@@ -1165,16 +1165,16 @@ static int kvm_live_open_events(struct perf_kvm_stat *kvm)
		struct perf_event_attr *attr = &pos->attr;

		/* make sure these *are* set */
		attr->sample_type |= PERF_SAMPLE_TID;
		attr->sample_type |= PERF_SAMPLE_TIME;
		attr->sample_type |= PERF_SAMPLE_CPU;
		attr->sample_type |= PERF_SAMPLE_RAW;
		perf_evsel__set_sample_bit(pos, TID);
		perf_evsel__set_sample_bit(pos, TIME);
		perf_evsel__set_sample_bit(pos, CPU);
		perf_evsel__set_sample_bit(pos, RAW);
		/* make sure these are *not*; want as small a sample as possible */
		attr->sample_type &= ~PERF_SAMPLE_PERIOD;
		attr->sample_type &= ~PERF_SAMPLE_IP;
		attr->sample_type &= ~PERF_SAMPLE_CALLCHAIN;
		attr->sample_type &= ~PERF_SAMPLE_ADDR;
		attr->sample_type &= ~PERF_SAMPLE_READ;
		perf_evsel__reset_sample_bit(pos, PERIOD);
		perf_evsel__reset_sample_bit(pos, IP);
		perf_evsel__reset_sample_bit(pos, CALLCHAIN);
		perf_evsel__reset_sample_bit(pos, ADDR);
		perf_evsel__reset_sample_bit(pos, READ);
		attr->mmap = 0;
		attr->comm = 0;
		attr->task = 0;
+1 −0
Original line number Diff line number Diff line
@@ -190,6 +190,7 @@ int cmd_mem(int argc, const char **argv, const char *prefix __maybe_unused)
		.tool = {
			.sample		= process_sample_event,
			.mmap		= perf_event__process_mmap,
			.mmap2		= perf_event__process_mmap2,
			.comm		= perf_event__process_comm,
			.lost		= perf_event__process_lost,
			.fork		= perf_event__process_fork,
Loading