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

Commit c1776a18 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 updates from Ingo Molnar:
 "This tree includes an x86 PMU scheduling fix, but most changes are
  late breaking tooling fixes and updates:

  User visible fixes:

   - Create config.detected into OUTPUT directory, fixing parallel
     builds sharing the same source directory (Aaro Kiskinen)

   - Allow to specify custom linker command, fixing some MIPS64 builds.
     (Aaro Kiskinen)

   - Fix to show proper convergence stats in 'perf bench numa' (Srikar
     Dronamraju)

  User visible changes:

   - Validate syscall list passed via -e argument to 'perf trace'.
     (Arnaldo Carvalho de Melo)

   - Introduce 'perf stat --per-thread' (Jiri Olsa)

   - Check access permission for --kallsyms and --vmlinux (Li Zhang)

   - Move toggling event logic from 'perf top' and into hists browser,
     allowing freeze/unfreeze with event lists with more than one entry
     (Namhyung Kim)

   - Add missing newlines when dumping PERF_RECORD_FINISHED_ROUND and
     showing the Aggregated stats in 'perf report -D' (Adrian Hunter)

  Infrastructure fixes:

   - Add missing break for PERF_RECORD_ITRACE_START, which caused those
     events samples to be parsed as well as PERF_RECORD_LOST_SAMPLES.
     ITRACE_START only appears when Intel PT or BTS are present, so..
     (Jiri Olsa)

   - Call the perf_session destructor when bailing out in the inject,
     kmem, report, kvm and mem tools (Taeung Song)

  Infrastructure changes:

   - Move stuff out of 'perf stat' and into the lib for further use
     (Jiri Olsa)

   - Reference count the cpu_map and thread_map classes (Jiri Olsa)

   - Set evsel->{cpus,threads} from the evlist, if not set, allowing the
     generalization of some 'perf stat' functions that previously were
     accessing private static evlist variable (Jiri Olsa)

   - Delete an unnecessary check before the calling free_event_desc()
     (Markus Elfring)

   - Allow auxtrace data alignment (Adrian Hunter)

   - Allow events with dot (Andi Kleen)

   - Fix failure to 'perf probe' events on arm (He Kuang)

   - Add testing for Makefile.perf (Jiri Olsa)

   - Add test for make install with prefix (Jiri Olsa)

   - Fix single target build dependency check (Jiri Olsa)

   - Access thread_map entries via accessors, prep patch to hold more
     info per entry, for ongoing 'perf stat --per-thread' work (Jiri
     Olsa)

   - Use __weak definition from compiler.h (Sukadev Bhattiprolu)

   - Split perf_pmu__new_alias() (Sukadev Bhattiprolu)"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (54 commits)
  perf tools: Allow to specify custom linker command
  perf tools: Create config.detected into OUTPUT directory
  perf mem: Fill in the missing session freeing after an error occurs
  perf kvm: Fill in the missing session freeing after an error occurs
  perf report: Fill in the missing session freeing after an error occurs
  perf kmem: Fill in the missing session freeing after an error occurs
  perf inject: Fill in the missing session freeing after an error occurs
  perf tools: Add missing break for PERF_RECORD_ITRACE_START
  perf/x86: Fix 'active_events' imbalance
  perf symbols: Check access permission when reading symbol files
  perf stat: Introduce --per-thread option
  perf stat: Introduce print_counters function
  perf stat: Using init_stats instead of memset
  perf stat: Rename print_interval to process_interval
  perf stat: Remove perf_evsel__read_cb function
  perf stat: Move perf_stat initialization counter process code
  perf stat: Move zero_per_pkg into counter process code
  perf stat: Separate counters reading and processing
  perf stat: Introduce read_counters function
  perf stat: Introduce perf_evsel__read function
  ...
parents 91cca0f0 b9df84fd
Loading
Loading
Loading
Loading
+13 −23
Original line number Original line Diff line number Diff line
@@ -357,34 +357,24 @@ void x86_release_hardware(void)
 */
 */
int x86_add_exclusive(unsigned int what)
int x86_add_exclusive(unsigned int what)
{
{
	int ret = -EBUSY, i;
	int i;

	if (atomic_inc_not_zero(&x86_pmu.lbr_exclusive[what]))
		return 0;


	if (!atomic_inc_not_zero(&x86_pmu.lbr_exclusive[what])) {
		mutex_lock(&pmc_reserve_mutex);
		mutex_lock(&pmc_reserve_mutex);
		for (i = 0; i < ARRAY_SIZE(x86_pmu.lbr_exclusive); i++) {
		for (i = 0; i < ARRAY_SIZE(x86_pmu.lbr_exclusive); i++) {
			if (i != what && atomic_read(&x86_pmu.lbr_exclusive[i]))
			if (i != what && atomic_read(&x86_pmu.lbr_exclusive[i]))
			goto out;
				goto fail_unlock;
		}
		}

		atomic_inc(&x86_pmu.lbr_exclusive[what]);
		atomic_inc(&x86_pmu.lbr_exclusive[what]);
	ret = 0;

out:
		mutex_unlock(&pmc_reserve_mutex);
		mutex_unlock(&pmc_reserve_mutex);
	}


	/*
	 * Assuming that all exclusive events will share the PMI handler
	 * (which checks active_events for whether there is work to do),
	 * we can bump active_events counter right here, except for
	 * x86_lbr_exclusive_lbr events that go through x86_pmu_event_init()
	 * path, which already bumps active_events for them.
	 */
	if (!ret && what != x86_lbr_exclusive_lbr)
	atomic_inc(&active_events);
	atomic_inc(&active_events);
	return 0;


	return ret;
fail_unlock:
	mutex_unlock(&pmc_reserve_mutex);
	return -EBUSY;
}
}


void x86_del_exclusive(unsigned int what)
void x86_del_exclusive(unsigned int what)
+1 −1
Original line number Original line Diff line number Diff line
@@ -25,7 +25,7 @@ build-dir := $(srctree)/tools/build
include $(build-dir)/Build.include
include $(build-dir)/Build.include


# do not force detected configuration
# do not force detected configuration
-include .config-detected
-include $(OUTPUT).config-detected


# Init all relevant variables used in build files so
# Init all relevant variables used in build files so
# 1) they have correct type
# 1) they have correct type
+4 −0
Original line number Original line Diff line number Diff line
@@ -144,6 +144,10 @@ is a useful mode to detect imbalance between physical cores. To enable this mod
use --per-core in addition to -a. (system-wide).  The output includes the
use --per-core in addition to -a. (system-wide).  The output includes the
core number and the number of online logical processors on that physical processor.
core number and the number of online logical processors on that physical processor.


--per-thread::
Aggregate counts per monitored threads, when monitoring threads (-t option)
or processes (-p option).

-D msecs::
-D msecs::
--delay msecs::
--delay msecs::
After starting the program, wait msecs before measuring. This is useful to
After starting the program, wait msecs before measuring. This is useful to
+2 −2
Original line number Original line Diff line number Diff line
@@ -83,8 +83,8 @@ build-test:
#
#
# All other targets get passed through:
# All other targets get passed through:
#
#
%:
%: FORCE
	$(print_msg)
	$(print_msg)
	$(make)
	$(make)


.PHONY: tags TAGS
.PHONY: tags TAGS FORCE Makefile
+2 −2
Original line number Original line Diff line number Diff line
@@ -110,7 +110,7 @@ $(OUTPUT)PERF-VERSION-FILE: ../../.git/HEAD
	$(Q)touch $(OUTPUT)PERF-VERSION-FILE
	$(Q)touch $(OUTPUT)PERF-VERSION-FILE


CC = $(CROSS_COMPILE)gcc
CC = $(CROSS_COMPILE)gcc
LD = $(CROSS_COMPILE)ld
LD ?= $(CROSS_COMPILE)ld
AR = $(CROSS_COMPILE)ar
AR = $(CROSS_COMPILE)ar
PKG_CONFIG = $(CROSS_COMPILE)pkg-config
PKG_CONFIG = $(CROSS_COMPILE)pkg-config


@@ -545,7 +545,7 @@ config-clean:
clean: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean config-clean
clean: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean config-clean
	$(call QUIET_CLEAN, core-objs)  $(RM) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf-with-kcore $(LANG_BINDINGS)
	$(call QUIET_CLEAN, core-objs)  $(RM) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf-with-kcore $(LANG_BINDINGS)
	$(Q)find . -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
	$(Q)find . -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
	$(Q)$(RM) .config-detected
	$(Q)$(RM) $(OUTPUT).config-detected
	$(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf perf-read-vdso32 perf-read-vdsox32
	$(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf perf-read-vdso32 perf-read-vdsox32
	$(call QUIET_CLEAN, core-gen)   $(RM)  *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)FEATURE-DUMP $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex*
	$(call QUIET_CLEAN, core-gen)   $(RM)  *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)FEATURE-DUMP $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex*
	$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
	$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
Loading