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

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

Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull perf fixes from Ingo MOlnar:
 "Mostly tooling fixes, but also two x86 PMU driver fixes"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf tests: Fix software clock events test setting maps
  perf tests: Fix task exit test setting maps
  perf evlist: Fix create_syswide_maps() not propagating maps
  perf evlist: Fix add() not propagating maps
  perf evlist: Factor out a function to propagate maps for a single evsel
  perf evlist: Make create_maps() use set_maps()
  perf evlist: Make set_maps() more resilient
  perf evsel: Add own_cpus member
  perf evlist: Fix missing thread_map__put in propagate_maps()
  perf evlist: Fix splice_list_tail() not setting evlist
  perf evlist: Add has_user_cpus member
  perf evlist: Remove redundant validation from propagate_maps()
  perf evlist: Simplify set_maps() logic
  perf evlist: Simplify propagate_maps() logic
  perf top: Fix segfault pressing -> with no hist entries
  perf header: Fixup reading of HEADER_NRCPUS feature
  perf/x86/intel: Fix constraint access
  perf/x86/intel/bts: Set event->hw.itrace_started in pmu::start to match the new logic
  perf tools: Fix use of wrong event when processing exit events
  perf tools: Fix parse_events_add_pmu caller
parents 9786cff3 f6cf87f7
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -2316,9 +2316,12 @@ static struct event_constraint *
intel_get_event_constraints(struct cpu_hw_events *cpuc, int idx,
intel_get_event_constraints(struct cpu_hw_events *cpuc, int idx,
			    struct perf_event *event)
			    struct perf_event *event)
{
{
	struct event_constraint *c1 = cpuc->event_constraint[idx];
	struct event_constraint *c1 = NULL;
	struct event_constraint *c2;
	struct event_constraint *c2;


	if (idx >= 0) /* fake does < 0 */
		c1 = cpuc->event_constraint[idx];

	/*
	/*
	 * first time only
	 * first time only
	 * - static constraint: no change across incremental scheduling calls
	 * - static constraint: no change across incremental scheduling calls
+1 −0
Original line number Original line Diff line number Diff line
@@ -222,6 +222,7 @@ static void __bts_event_start(struct perf_event *event)
	if (!buf || bts_buffer_is_full(buf, bts))
	if (!buf || bts_buffer_is_full(buf, bts))
		return;
		return;


	event->hw.itrace_started = 1;
	event->hw.state = 0;
	event->hw.state = 0;


	if (!buf->snapshot)
	if (!buf->snapshot)
+2 −2
Original line number Original line Diff line number Diff line
@@ -768,8 +768,8 @@ static int process_exit_event(struct perf_tool *tool,
	if (!evsel->attr.sample_id_all) {
	if (!evsel->attr.sample_id_all) {
		sample->cpu = 0;
		sample->cpu = 0;
		sample->time = 0;
		sample->time = 0;
		sample->tid = event->comm.tid;
		sample->tid = event->fork.tid;
		sample->pid = event->comm.pid;
		sample->pid = event->fork.pid;
	}
	}
	print_sample_start(sample, thread, evsel);
	print_sample_start(sample, thread, evsel);
	perf_event__fprintf(event, stdout);
	perf_event__fprintf(event, stdout);
+14 −4
Original line number Original line Diff line number Diff line
@@ -34,6 +34,8 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id)
		.disabled = 1,
		.disabled = 1,
		.freq = 1,
		.freq = 1,
	};
	};
	struct cpu_map *cpus;
	struct thread_map *threads;


	attr.sample_freq = 500;
	attr.sample_freq = 500;


@@ -50,14 +52,19 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id)
	}
	}
	perf_evlist__add(evlist, evsel);
	perf_evlist__add(evlist, evsel);


	evlist->cpus = cpu_map__dummy_new();
	cpus = cpu_map__dummy_new();
	evlist->threads = thread_map__new_by_tid(getpid());
	threads = thread_map__new_by_tid(getpid());
	if (!evlist->cpus || !evlist->threads) {
	if (!cpus || !threads) {
		err = -ENOMEM;
		err = -ENOMEM;
		pr_debug("Not enough memory to create thread/cpu maps\n");
		pr_debug("Not enough memory to create thread/cpu maps\n");
		goto out_delete_evlist;
		goto out_free_maps;
	}
	}


	perf_evlist__set_maps(evlist, cpus, threads);

	cpus	= NULL;
	threads = NULL;

	if (perf_evlist__open(evlist)) {
	if (perf_evlist__open(evlist)) {
		const char *knob = "/proc/sys/kernel/perf_event_max_sample_rate";
		const char *knob = "/proc/sys/kernel/perf_event_max_sample_rate";


@@ -107,6 +114,9 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id)
		err = -1;
		err = -1;
	}
	}


out_free_maps:
	cpu_map__put(cpus);
	thread_map__put(threads);
out_delete_evlist:
out_delete_evlist:
	perf_evlist__delete(evlist);
	perf_evlist__delete(evlist);
	return err;
	return err;
+14 −4
Original line number Original line Diff line number Diff line
@@ -43,6 +43,8 @@ int test__task_exit(void)
	};
	};
	const char *argv[] = { "true", NULL };
	const char *argv[] = { "true", NULL };
	char sbuf[STRERR_BUFSIZE];
	char sbuf[STRERR_BUFSIZE];
	struct cpu_map *cpus;
	struct thread_map *threads;


	signal(SIGCHLD, sig_handler);
	signal(SIGCHLD, sig_handler);


@@ -58,14 +60,19 @@ int test__task_exit(void)
	 * perf_evlist__prepare_workload we'll fill in the only thread
	 * perf_evlist__prepare_workload we'll fill in the only thread
	 * we're monitoring, the one forked there.
	 * we're monitoring, the one forked there.
	 */
	 */
	evlist->cpus = cpu_map__dummy_new();
	cpus = cpu_map__dummy_new();
	evlist->threads = thread_map__new_by_tid(-1);
	threads = thread_map__new_by_tid(-1);
	if (!evlist->cpus || !evlist->threads) {
	if (!cpus || !threads) {
		err = -ENOMEM;
		err = -ENOMEM;
		pr_debug("Not enough memory to create thread/cpu maps\n");
		pr_debug("Not enough memory to create thread/cpu maps\n");
		goto out_delete_evlist;
		goto out_free_maps;
	}
	}


	perf_evlist__set_maps(evlist, cpus, threads);

	cpus	= NULL;
	threads = NULL;

	err = perf_evlist__prepare_workload(evlist, &target, argv, false,
	err = perf_evlist__prepare_workload(evlist, &target, argv, false,
					    workload_exec_failed_signal);
					    workload_exec_failed_signal);
	if (err < 0) {
	if (err < 0) {
@@ -114,6 +121,9 @@ int test__task_exit(void)
		err = -1;
		err = -1;
	}
	}


out_free_maps:
	cpu_map__put(cpus);
	thread_map__put(threads);
out_delete_evlist:
out_delete_evlist:
	perf_evlist__delete(evlist);
	perf_evlist__delete(evlist);
	return err;
	return err;
Loading