Commit 0e9b51a4 authored by Ian Rogers's avatar Ian Rogers Committed by Namhyung Kim
Browse files

perf pmu: Make pmu_alias_terms weak again



The terms for a json event should be weak so they don't override
command line options.

Before:
```
$ perf record -vv -c 1000 -e uops_issued.any -o /dev/null true 2>&1
|grep "{ sample_period, sample_freq }"
 { sample_period, sample_freq }   200003
 { sample_period, sample_freq }   2000003
 { sample_period, sample_freq }   1000
```

After:
```
$ perf record -vv -c 1000 -e uops_issued.any -o /dev/null true 2>&1
|grep "{ sample_period, sample_freq }"
 { sample_period, sample_freq }   1000
 { sample_period, sample_freq }   1000
 { sample_period, sample_freq }   1000
```

Fixes: 84bae3af ("perf pmu: Don't eagerly parse event terms")
Signed-off-by: default avatarIan Rogers <irogers@google.com>
Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
parent 6331b266
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -802,6 +802,7 @@ static int pmu_aliases_parse_eager(struct perf_pmu *pmu, int sysfs_fd)
static int pmu_alias_terms(struct perf_pmu_alias *alias, struct list_head *terms)
{
	struct parse_events_terms alias_terms;
	struct parse_events_term *term;
	int ret;

	parse_events_terms__init(&alias_terms);
@@ -812,6 +813,13 @@ static int pmu_alias_terms(struct perf_pmu_alias *alias, struct list_head *terms
		parse_events_terms__exit(&alias_terms);
		return ret;
	}
	list_for_each_entry(term, &alias_terms.terms, list) {
		/*
		 * Weak terms don't override command line options,
		 * which we don't want for implicit terms in aliases.
		 */
		term->weak = true;
	}
	list_splice_init(&alias_terms.terms, terms);
	parse_events_terms__exit(&alias_terms);
	return 0;