perf/urgent fixes:
- Unbreak 'perf record' for arm/arm64 with events with explicit PMU (Mark Rutland) - Add missing separator for "perf script -F ip,brstack" (and brstackoff) (Mark Santaniello) - One line, comment only, sync kernel ABI header with tooling header (Arnaldo Carvalho de Melo) Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEELb9bqkb7Te0zijNb1lAW81NSqkAFAlnc5REACgkQ1lAW81NS qkBsnRAAn77bFSrGgv3Xq2O49shGWQJp5AtgDvGX71N6B0GCYh//BHeWtoALnOCI XyGMWxTLxWC64Gzzr3jp+LL2pq2bRBmbuSYq5S9yb+LyNxIMz6Xvd8lPYh6n4K73 CRqzAp9ChxSOmgSD/wnHtne7vYDx626dy6zvu+LdnoMoYhEy8QKmheGA4l+5fm1L w0dVqU98/10jj4N0LSVfHT4n6S8XcxqZtKmEO/mmBtmdzMKtiQgG2DMOQWkt/82N tlDDn7y/+orJF4xvgFnBUK5ws/vZD+vmkB61EBbmfChYM9a0XC0Mugpz+9QyxT4q 8R4cZ44Zc2kQHHndOpAwLh+vgRUwYhbVcWgezhHTKIN6rm2XcQ/msAiY+F2WBoy5 NBmDcmhw+sWLX2Ut9lwyrO6LWBFWrNItFQzS1x0jlpX+To07RTnU7r4xilaXvE39 MDZBzw+N9vq3VUpmdFSidZYnSKuJBGfHBmcUezmUhKaO57kNr6ac2Y041mvkr/V9 qRJTAtOO/BiQn5NOYG1OrczOaoEHGG2FYM8ZtEa9VZVVHNKe7IvPvzpTw1UF6swg g4h7fB9sW6lRAXUppfcLBUchZB22W/NIaqvVuJnh8FdarQmVH3nc1MaIfuKeY/cb quYT6frFxoHfCMJLjqTNHPE8t+WVyi4xyqI0luxnh3/svT/dqF8= =AASQ -----END PGP SIGNATURE----- Merge tag 'perf-urgent-for-mingo-4.14-20171010' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent Pull perf/urgent fixes from Arnaldo Carvalho de Melo: - Unbreak 'perf record' for arm/arm64 with events with explicit PMU (Mark Rutland) - Add missing separator for "perf script -F ip,brstack" (and brstackoff) (Mark Santaniello) - One line, comment only, sync kernel ABI header with tooling header (Arnaldo Carvalho de Melo) Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
commit
47a74bdcbf
|
@ -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)
|
||||
|
|
|
@ -586,7 +586,7 @@ static void print_sample_brstack(struct perf_sample *sample,
|
|||
thread__find_addr_map(thread, sample->cpumode, MAP__FUNCTION, to, &alt);
|
||||
}
|
||||
|
||||
printf("0x%"PRIx64, from);
|
||||
printf(" 0x%"PRIx64, from);
|
||||
if (PRINT_FIELD(DSO)) {
|
||||
printf("(");
|
||||
map__fprintf_dsoname(alf.map, stdout);
|
||||
|
@ -681,7 +681,7 @@ static void print_sample_brstackoff(struct perf_sample *sample,
|
|||
if (alt.map && !alt.map->dso->adjust_symbols)
|
||||
to = map__map_ip(alt.map, to);
|
||||
|
||||
printf("0x%"PRIx64, from);
|
||||
printf(" 0x%"PRIx64, from);
|
||||
if (PRINT_FIELD(DSO)) {
|
||||
printf("(");
|
||||
map__fprintf_dsoname(alf.map, stdout);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -470,31 +470,10 @@ static void pmu_read_sysfs(void)
|
|||
closedir(dir);
|
||||
}
|
||||
|
||||
static struct cpu_map *pmu_cpumask(const char *name)
|
||||
static struct cpu_map *__pmu_cpumask(const char *path)
|
||||
{
|
||||
struct stat st;
|
||||
char path[PATH_MAX];
|
||||
FILE *file;
|
||||
struct cpu_map *cpus;
|
||||
const char *sysfs = sysfs__mountpoint();
|
||||
const char *templates[] = {
|
||||
"%s/bus/event_source/devices/%s/cpumask",
|
||||
"%s/bus/event_source/devices/%s/cpus",
|
||||
NULL
|
||||
};
|
||||
const char **template;
|
||||
|
||||
if (!sysfs)
|
||||
return NULL;
|
||||
|
||||
for (template = templates; *template; template++) {
|
||||
snprintf(path, PATH_MAX, *template, sysfs, name);
|
||||
if (stat(path, &st) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!*template)
|
||||
return NULL;
|
||||
|
||||
file = fopen(path, "r");
|
||||
if (!file)
|
||||
|
@ -505,6 +484,51 @@ static struct cpu_map *pmu_cpumask(const char *name)
|
|||
return cpus;
|
||||
}
|
||||
|
||||
/*
|
||||
* Uncore PMUs have a "cpumask" file under sysfs. CPU PMUs (e.g. on arm/arm64)
|
||||
* may have a "cpus" file.
|
||||
*/
|
||||
#define CPUS_TEMPLATE_UNCORE "%s/bus/event_source/devices/%s/cpumask"
|
||||
#define CPUS_TEMPLATE_CPU "%s/bus/event_source/devices/%s/cpus"
|
||||
|
||||
static struct cpu_map *pmu_cpumask(const char *name)
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
struct cpu_map *cpus;
|
||||
const char *sysfs = sysfs__mountpoint();
|
||||
const char *templates[] = {
|
||||
CPUS_TEMPLATE_UNCORE,
|
||||
CPUS_TEMPLATE_CPU,
|
||||
NULL
|
||||
};
|
||||
const char **template;
|
||||
|
||||
if (!sysfs)
|
||||
return NULL;
|
||||
|
||||
for (template = templates; *template; template++) {
|
||||
snprintf(path, PATH_MAX, *template, sysfs, name);
|
||||
cpus = __pmu_cpumask(path);
|
||||
if (cpus)
|
||||
return cpus;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static bool pmu_is_uncore(const char *name)
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
struct cpu_map *cpus;
|
||||
const char *sysfs = sysfs__mountpoint();
|
||||
|
||||
snprintf(path, PATH_MAX, CPUS_TEMPLATE_UNCORE, sysfs, name);
|
||||
cpus = __pmu_cpumask(path);
|
||||
cpu_map__put(cpus);
|
||||
|
||||
return !!cpus;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the CPU id as a raw string.
|
||||
*
|
||||
|
@ -617,6 +641,8 @@ static struct perf_pmu *pmu_lookup(const char *name)
|
|||
|
||||
pmu->cpus = pmu_cpumask(name);
|
||||
|
||||
pmu->is_uncore = pmu_is_uncore(name);
|
||||
|
||||
INIT_LIST_HEAD(&pmu->format);
|
||||
INIT_LIST_HEAD(&pmu->aliases);
|
||||
list_splice(&format, &pmu->format);
|
||||
|
|
|
@ -22,6 +22,7 @@ struct perf_pmu {
|
|||
char *name;
|
||||
__u32 type;
|
||||
bool selectable;
|
||||
bool is_uncore;
|
||||
struct perf_event_attr *default_config;
|
||||
struct cpu_map *cpus;
|
||||
struct list_head format; /* HEAD struct perf_pmu_format -> list */
|
||||
|
|
Loading…
Reference in New Issue