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

Commit 26c923ab 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:
 "Some tooling fixes plus three kernel fixes: a memory leak fix, a
  statistics fix and a crash fix"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf/x86/intel/uncore: Fix memory leaks on allocation failures
  perf/core: Fix cgroup time when scheduling descendants
  perf/core: Avoid freeing static PMU contexts when PMU is unregistered
  tools include uapi bpf.h: Sync kernel ABI header with tooling header
  perf pmu: Unbreak perf record for arm/arm64 with events with explicit PMU
  perf script: Add missing separator for "-F ip,brstack" (and brstackoff)
  perf callchain: Compare dsos (as well) for CCKEY_FUNCTION
parents 60a6ca6c 47a74bdc
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -822,7 +822,7 @@ static int __init uncore_type_init(struct intel_uncore_type *type, bool setid)
		pmus[i].type	= type;
		pmus[i].boxes	= kzalloc(size, GFP_KERNEL);
		if (!pmus[i].boxes)
			return -ENOMEM;
			goto err;
	}

	type->pmus = pmus;
@@ -836,7 +836,7 @@ static int __init uncore_type_init(struct intel_uncore_type *type, bool setid)
		attr_group = kzalloc(sizeof(struct attribute *) * (i + 1) +
					sizeof(*attr_group), GFP_KERNEL);
		if (!attr_group)
			return -ENOMEM;
			goto err;

		attrs = (struct attribute **)(attr_group + 1);
		attr_group->name = "events";
@@ -849,7 +849,15 @@ static int __init uncore_type_init(struct intel_uncore_type *type, bool setid)
	}

	type->pmu_group = &uncore_pmu_attr_group;

	return 0;

err:
	for (i = 0; i < type->num_boxes; i++)
		kfree(pmus[i].boxes);
	kfree(pmus);

	return -ENOMEM;
}

static int __init
+9 −1
Original line number Diff line number Diff line
@@ -662,7 +662,7 @@ static inline void update_cgrp_time_from_event(struct perf_event *event)
	/*
	 * Do not update time when cgroup is not active
	 */
	if (cgrp == event->cgrp)
       if (cgroup_is_descendant(cgrp->css.cgroup, event->cgrp->css.cgroup))
		__update_cgrp_time(event->cgrp);
}

@@ -8955,6 +8955,14 @@ static struct perf_cpu_context __percpu *find_pmu_context(int ctxn)

static void free_pmu_context(struct pmu *pmu)
{
	/*
	 * Static contexts such as perf_sw_context have a global lifetime
	 * and may be shared between different PMUs. Avoid freeing them
	 * when a single PMU is going away.
	 */
	if (pmu->task_ctx_nr > perf_invalid_context)
		return;

	mutex_lock(&pmus_lock);
	free_percpu(pmu->pmu_cpu_context);
	mutex_unlock(&pmus_lock);
+1 −1
Original line number Diff line number Diff line
@@ -312,7 +312,7 @@ union bpf_attr {
 *     jump into another BPF program
 *     @ctx: context pointer passed to next program
 *     @prog_array_map: pointer to map which type is BPF_MAP_TYPE_PROG_ARRAY
 *     @index: index inside array that selects specific program to run
 *     @index: 32-bit index inside array that selects specific program to run
 *     Return: 0 on success or negative error
 *
 * int bpf_clone_redirect(skb, ifindex, flags)
+5 −1
Original line number Diff line number Diff line
@@ -685,6 +685,8 @@ static enum match_result match_chain(struct callchain_cursor_node *node,
{
	struct symbol *sym = node->sym;
	u64 left, right;
	struct dso *left_dso = NULL;
	struct dso *right_dso = NULL;

	if (callchain_param.key == CCKEY_SRCLINE) {
		enum match_result match = match_chain_srcline(node, cnode);
@@ -696,12 +698,14 @@ static enum match_result match_chain(struct callchain_cursor_node *node,
	if (cnode->ms.sym && sym && callchain_param.key == CCKEY_FUNCTION) {
		left = cnode->ms.sym->start;
		right = sym->start;
		left_dso = cnode->ms.map->dso;
		right_dso = node->map->dso;
	} else {
		left = cnode->ip;
		right = node->ip;
	}

	if (left == right) {
	if (left == right && left_dso == right_dso) {
		if (node->branch) {
			cnode->branch_count++;

+5 −4
Original line number Diff line number Diff line
@@ -309,10 +309,11 @@ static char *get_config_name(struct list_head *head_terms)
static struct perf_evsel *
__add_event(struct list_head *list, int *idx,
	    struct perf_event_attr *attr,
	    char *name, struct cpu_map *cpus,
	    char *name, struct perf_pmu *pmu,
	    struct list_head *config_terms, bool auto_merge_stats)
{
	struct perf_evsel *evsel;
	struct cpu_map *cpus = pmu ? pmu->cpus : NULL;

	event_attr_init(attr);

@@ -323,7 +324,7 @@ __add_event(struct list_head *list, int *idx,
	(*idx)++;
	evsel->cpus        = cpu_map__get(cpus);
	evsel->own_cpus    = cpu_map__get(cpus);
	evsel->system_wide = !!cpus;
	evsel->system_wide = pmu ? pmu->is_uncore : false;
	evsel->auto_merge_stats = auto_merge_stats;

	if (name)
@@ -1233,7 +1234,7 @@ static int __parse_events_add_pmu(struct parse_events_state *parse_state,

	if (!head_config) {
		attr.type = pmu->type;
		evsel = __add_event(list, &parse_state->idx, &attr, NULL, pmu->cpus, NULL, auto_merge_stats);
		evsel = __add_event(list, &parse_state->idx, &attr, NULL, pmu, NULL, auto_merge_stats);
		return evsel ? 0 : -ENOMEM;
	}

@@ -1254,7 +1255,7 @@ static int __parse_events_add_pmu(struct parse_events_state *parse_state,
		return -EINVAL;

	evsel = __add_event(list, &parse_state->idx, &attr,
			    get_config_name(head_config), pmu->cpus,
			    get_config_name(head_config), pmu,
			    &config_terms, auto_merge_stats);
	if (evsel) {
		evsel->unit = info.unit;
Loading