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

Commit 7d9e55fe 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 Thomas Gleixner:
 "The perf update contains the following bits:

  x86:
   - Prevent setting freeze_on_smi on PerfMon V1 CPUs to avoid #GP

  perf stat:
   - Keep the '/' event modifier separator in fallback, for example when
     fallbacking from 'cpu/cpu-cycles/' to user level only, where it
     should become 'cpu/cpu-cycles/u' and not 'cpu/cpu-cycles/:u' (Jiri
     Olsa)

   - Fix PMU events parsing rule, improving error reporting for invalid
     events (Jiri Olsa)

   - Disable write_backward and other event attributes for !group events
     in a group, fixing, for instance this group: '{cycles,msr/aperf/}:S'
     that has leader sampling (:S) and where just the 'cycles', the
     leader event, should have the write_backward attribute set, in this
     case it all fails because the PMU where 'msr/aperf/' lives doesn't
     accepts write_backward style sampling (Jiri Olsa)

   - Only fall back group read for leader (Kan Liang)

   - Fix core PMU alias list for x86 platform (Kan Liang)

   - Print out hint for mixed PMU group error (Kan Liang)

   - Fix duplicate PMU name for interval print (Kan Liang)

  Core:
   - Set main kernel end address properly when reading kernel and module
     maps (Namhyung Kim)

  perf mem:
   - Fix incorrect entries and add missing man options (Sangwon Hong)

  s/390:
   - Remove s390 specific strcmp_cpuid_cmp function (Thomas Richter)

   - Adapt 'perf test' case record+probe_libc_inet_pton.sh for s390

   - Fix s390 undefined record__auxtrace_init() return value in 'perf
     record' (Thomas Richter)"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf/x86/intel: Don't enable freeze-on-smi for PerfMon V1
  perf stat: Fix duplicate PMU name for interval print
  perf evsel: Only fall back group read for leader
  perf stat: Print out hint for mixed PMU group error
  perf pmu: Fix core PMU alias list for X86 platform
  perf record: Fix s390 undefined record__auxtrace_init() return value
  perf mem: Document incorrect and missing options
  perf evsel: Disable write_backward for leader sampling group events
  perf pmu: Fix pmu events parsing rule
  perf stat: Keep the / modifier separator in fallback
  perf test: Adapt test case record+probe_libc_inet_pton.sh for s390
  perf list: Remove s390 specific strcmp_cpuid_cmp function
  perf machine: Set main kernel end address properly
parents cdface52 d4652f61
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -3339,6 +3339,7 @@ static void intel_pmu_cpu_starting(int cpu)

	cpuc->lbr_sel = NULL;

	if (x86_pmu.version > 1)
		flip_smm_bit(&x86_pmu.attr_freeze_on_smi);

	if (!cpuc->shared_regs)
@@ -3502,6 +3503,8 @@ static __initconst const struct x86_pmu core_pmu = {
	.cpu_dying		= intel_pmu_cpu_dying,
};

static struct attribute *intel_pmu_attrs[];

static __initconst const struct x86_pmu intel_pmu = {
	.name			= "Intel",
	.handle_irq		= intel_pmu_handle_irq,
@@ -3533,6 +3536,8 @@ static __initconst const struct x86_pmu intel_pmu = {
	.format_attrs		= intel_arch3_formats_attr,
	.events_sysfs_show	= intel_event_sysfs_show,

	.attrs			= intel_pmu_attrs,

	.cpu_prepare		= intel_pmu_cpu_prepare,
	.cpu_starting		= intel_pmu_cpu_starting,
	.cpu_dying		= intel_pmu_cpu_dying,
@@ -3911,8 +3916,6 @@ __init int intel_pmu_init(void)

	x86_pmu.max_pebs_events		= min_t(unsigned, MAX_PEBS_EVENTS, x86_pmu.num_counters);


	x86_pmu.attrs			= intel_pmu_attrs;
	/*
	 * Quirk: v2 perfmon does not report fixed-purpose events, so
	 * assume at least 3 events, when not running in a hypervisor:
+29 −12
Original line number Diff line number Diff line
@@ -28,29 +28,46 @@ OPTIONS
<command>...::
	Any command you can specify in a shell.

-i::
--input=<file>::
	Input file name.

-f::
--force::
	Don't do ownership validation

-t::
--type=::
--type=<type>::
	Select the memory operation type: load or store (default: load,store)

-D::
--dump-raw-samples=::
--dump-raw-samples::
	Dump the raw decoded samples on the screen in a format that is easy to parse with
	one sample per line.

-x::
--field-separator::
--field-separator=<separator>::
	Specify the field separator used when dump raw samples (-D option). By default,
	The separator is the space character.

-C::
--cpu-list::
	Restrict dump of raw samples to those provided via this option. Note that the same
	option can be passed in record mode. It will be interpreted the same way as perf
	record.
--cpu=<cpu>::
	Monitor only on the list of CPUs provided. Multiple CPUs can be provided as a
        comma-separated list with no space: 0,1. Ranges of CPUs are specified with -: 0-2. Default
        is to monitor all CPUS.
-U::
--hide-unresolved::
	Only display entries resolved to a symbol.

-p::
--phys-data::
	Record/Report sample physical addresses

RECORD OPTIONS
--------------
-e::
--event <event>::
	Event selector. Use 'perf mem record -e list' to list available events.

-K::
--all-kernel::
@@ -60,12 +77,12 @@ OPTIONS
--all-user::
	Configure all used events to run in user space.

--ldload::
	Specify desired latency for loads event.
-v::
--verbose::
	Be more verbose (show counter open errors, etc)

-p::
--phys-data::
	Record/Report sample physical addresses
--ldlat <n>::
	Specify desired latency for loads event.

In addition, for report all perf report options are valid, and for record
all perf record options.
+1 −0
Original line number Diff line number Diff line
@@ -87,6 +87,7 @@ struct auxtrace_record *auxtrace_record__init(struct perf_evlist *evlist,
	struct perf_evsel *pos;
	int diagnose = 0;

	*err = 0;
	if (evlist->nr_entries == 0)
		return NULL;

+0 −18
Original line number Diff line number Diff line
@@ -146,21 +146,3 @@ char *get_cpuid_str(struct perf_pmu *pmu __maybe_unused)
		zfree(&buf);
	return buf;
}

/*
 * Compare the cpuid string returned by get_cpuid() function
 * with the name generated by the jevents file read from
 * pmu-events/arch/s390/mapfile.csv.
 *
 * Parameter mapcpuid is the cpuid as stored in the
 * pmu-events/arch/s390/mapfile.csv. This is just the type number.
 * Parameter cpuid is the cpuid returned by function get_cpuid().
 */
int strcmp_cpuid_str(const char *mapcpuid, const char *cpuid)
{
	char *cp = strchr(cpuid, ',');

	if (cp == NULL)
		return -1;
	return strncmp(cp + 1, mapcpuid, strlen(mapcpuid));
}
+38 −2
Original line number Diff line number Diff line
@@ -172,6 +172,7 @@ static bool interval_count;
static const char		*output_name;
static int			output_fd;
static int			print_free_counters_hint;
static int			print_mixed_hw_group_error;

struct perf_stat {
	bool			 record;
@@ -1126,6 +1127,30 @@ static void abs_printout(int id, int nr, struct perf_evsel *evsel, double avg)
		fprintf(output, "%s%s", csv_sep, evsel->cgrp->name);
}

static bool is_mixed_hw_group(struct perf_evsel *counter)
{
	struct perf_evlist *evlist = counter->evlist;
	u32 pmu_type = counter->attr.type;
	struct perf_evsel *pos;

	if (counter->nr_members < 2)
		return false;

	evlist__for_each_entry(evlist, pos) {
		/* software events can be part of any hardware group */
		if (pos->attr.type == PERF_TYPE_SOFTWARE)
			continue;
		if (pmu_type == PERF_TYPE_SOFTWARE) {
			pmu_type = pos->attr.type;
			continue;
		}
		if (pmu_type != pos->attr.type)
			return true;
	}

	return false;
}

static void printout(int id, int nr, struct perf_evsel *counter, double uval,
		     char *prefix, u64 run, u64 ena, double noise,
		     struct runtime_stat *st)
@@ -1178,8 +1203,11 @@ static void printout(int id, int nr, struct perf_evsel *counter, double uval,
			counter->supported ? CNTR_NOT_COUNTED : CNTR_NOT_SUPPORTED,
			csv_sep);

		if (counter->supported)
		if (counter->supported) {
			print_free_counters_hint = 1;
			if (is_mixed_hw_group(counter))
				print_mixed_hw_group_error = 1;
		}

		fprintf(stat_config.output, "%-*s%s",
			csv_output ? 0 : unit_width,
@@ -1256,7 +1284,8 @@ static void uniquify_event_name(struct perf_evsel *counter)
	char *new_name;
	char *config;

	if (!counter->pmu_name || !strncmp(counter->name, counter->pmu_name,
	if (counter->uniquified_name ||
	    !counter->pmu_name || !strncmp(counter->name, counter->pmu_name,
					   strlen(counter->pmu_name)))
		return;

@@ -1274,6 +1303,8 @@ static void uniquify_event_name(struct perf_evsel *counter)
			counter->name = new_name;
		}
	}

	counter->uniquified_name = true;
}

static void collect_all_aliases(struct perf_evsel *counter,
@@ -1757,6 +1788,11 @@ static void print_footer(void)
"	echo 0 > /proc/sys/kernel/nmi_watchdog\n"
"	perf stat ...\n"
"	echo 1 > /proc/sys/kernel/nmi_watchdog\n");

	if (print_mixed_hw_group_error)
		fprintf(output,
			"The events in group usually have to be from "
			"the same PMU. Try reorganizing the group.\n");
}

static void print_counters(struct timespec *ts, int argc, const char **argv)
Loading