Commit 4c45945a authored by Ingo Molnar's avatar Ingo Molnar

Merge tag 'perf-urgent-for-mingo-5.6-20200220' of...

Merge tag 'perf-urgent-for-mingo-5.6-20200220' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent

Pull perf/urgent fixes from Arnaldo Carvalho de Melo:

auxtrace:

  Adrian Hunter:

  - Fix endless record after being terminated on arm-spe.

  Wei Li:

  - Fix endless record after being terminated on Intel PT and BTS and
    on ARM's cs-etm.

perf test:

  Thomas Richter

  - Fix test trace+probe_vfs_getname.sh on s390

PowerPC:

  Arnaldo Carvalho de Melo:

  - Sync powerpc syscall.tbl with the kernel sources.

BPF:

  Arnaldo Carvalho de Melo:

  - Remove extraneous bpf/ subdir from bpf.h headers used to build bpf events.
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parents c5f86891 b103de53
...@@ -858,21 +858,6 @@ static void cs_etm_recording_free(struct auxtrace_record *itr) ...@@ -858,21 +858,6 @@ static void cs_etm_recording_free(struct auxtrace_record *itr)
free(ptr); free(ptr);
} }
static int cs_etm_read_finish(struct auxtrace_record *itr, int idx)
{
struct cs_etm_recording *ptr =
container_of(itr, struct cs_etm_recording, itr);
struct evsel *evsel;
evlist__for_each_entry(ptr->evlist, evsel) {
if (evsel->core.attr.type == ptr->cs_etm_pmu->type)
return perf_evlist__enable_event_idx(ptr->evlist,
evsel, idx);
}
return -EINVAL;
}
struct auxtrace_record *cs_etm_record_init(int *err) struct auxtrace_record *cs_etm_record_init(int *err)
{ {
struct perf_pmu *cs_etm_pmu; struct perf_pmu *cs_etm_pmu;
...@@ -892,6 +877,7 @@ struct auxtrace_record *cs_etm_record_init(int *err) ...@@ -892,6 +877,7 @@ struct auxtrace_record *cs_etm_record_init(int *err)
} }
ptr->cs_etm_pmu = cs_etm_pmu; ptr->cs_etm_pmu = cs_etm_pmu;
ptr->itr.pmu = cs_etm_pmu;
ptr->itr.parse_snapshot_options = cs_etm_parse_snapshot_options; ptr->itr.parse_snapshot_options = cs_etm_parse_snapshot_options;
ptr->itr.recording_options = cs_etm_recording_options; ptr->itr.recording_options = cs_etm_recording_options;
ptr->itr.info_priv_size = cs_etm_info_priv_size; ptr->itr.info_priv_size = cs_etm_info_priv_size;
...@@ -901,7 +887,7 @@ struct auxtrace_record *cs_etm_record_init(int *err) ...@@ -901,7 +887,7 @@ struct auxtrace_record *cs_etm_record_init(int *err)
ptr->itr.snapshot_finish = cs_etm_snapshot_finish; ptr->itr.snapshot_finish = cs_etm_snapshot_finish;
ptr->itr.reference = cs_etm_reference; ptr->itr.reference = cs_etm_reference;
ptr->itr.free = cs_etm_recording_free; ptr->itr.free = cs_etm_recording_free;
ptr->itr.read_finish = cs_etm_read_finish; ptr->itr.read_finish = auxtrace_record__read_finish;
*err = 0; *err = 0;
return &ptr->itr; return &ptr->itr;
......
...@@ -158,20 +158,6 @@ static void arm_spe_recording_free(struct auxtrace_record *itr) ...@@ -158,20 +158,6 @@ static void arm_spe_recording_free(struct auxtrace_record *itr)
free(sper); free(sper);
} }
static int arm_spe_read_finish(struct auxtrace_record *itr, int idx)
{
struct arm_spe_recording *sper =
container_of(itr, struct arm_spe_recording, itr);
struct evsel *evsel;
evlist__for_each_entry(sper->evlist, evsel) {
if (evsel->core.attr.type == sper->arm_spe_pmu->type)
return perf_evlist__enable_event_idx(sper->evlist,
evsel, idx);
}
return -EINVAL;
}
struct auxtrace_record *arm_spe_recording_init(int *err, struct auxtrace_record *arm_spe_recording_init(int *err,
struct perf_pmu *arm_spe_pmu) struct perf_pmu *arm_spe_pmu)
{ {
...@@ -189,12 +175,13 @@ struct auxtrace_record *arm_spe_recording_init(int *err, ...@@ -189,12 +175,13 @@ struct auxtrace_record *arm_spe_recording_init(int *err,
} }
sper->arm_spe_pmu = arm_spe_pmu; sper->arm_spe_pmu = arm_spe_pmu;
sper->itr.pmu = arm_spe_pmu;
sper->itr.recording_options = arm_spe_recording_options; sper->itr.recording_options = arm_spe_recording_options;
sper->itr.info_priv_size = arm_spe_info_priv_size; sper->itr.info_priv_size = arm_spe_info_priv_size;
sper->itr.info_fill = arm_spe_info_fill; sper->itr.info_fill = arm_spe_info_fill;
sper->itr.free = arm_spe_recording_free; sper->itr.free = arm_spe_recording_free;
sper->itr.reference = arm_spe_reference; sper->itr.reference = arm_spe_reference;
sper->itr.read_finish = arm_spe_read_finish; sper->itr.read_finish = auxtrace_record__read_finish;
sper->itr.alignment = 0; sper->itr.alignment = 0;
*err = 0; *err = 0;
......
...@@ -517,3 +517,5 @@ ...@@ -517,3 +517,5 @@
433 common fspick sys_fspick 433 common fspick sys_fspick
434 common pidfd_open sys_pidfd_open 434 common pidfd_open sys_pidfd_open
435 nospu clone3 ppc_clone3 435 nospu clone3 ppc_clone3
437 common openat2 sys_openat2
438 common pidfd_getfd sys_pidfd_getfd
...@@ -413,20 +413,6 @@ static int intel_bts_find_snapshot(struct auxtrace_record *itr, int idx, ...@@ -413,20 +413,6 @@ static int intel_bts_find_snapshot(struct auxtrace_record *itr, int idx,
return err; return err;
} }
static int intel_bts_read_finish(struct auxtrace_record *itr, int idx)
{
struct intel_bts_recording *btsr =
container_of(itr, struct intel_bts_recording, itr);
struct evsel *evsel;
evlist__for_each_entry(btsr->evlist, evsel) {
if (evsel->core.attr.type == btsr->intel_bts_pmu->type)
return perf_evlist__enable_event_idx(btsr->evlist,
evsel, idx);
}
return -EINVAL;
}
struct auxtrace_record *intel_bts_recording_init(int *err) struct auxtrace_record *intel_bts_recording_init(int *err)
{ {
struct perf_pmu *intel_bts_pmu = perf_pmu__find(INTEL_BTS_PMU_NAME); struct perf_pmu *intel_bts_pmu = perf_pmu__find(INTEL_BTS_PMU_NAME);
...@@ -447,6 +433,7 @@ struct auxtrace_record *intel_bts_recording_init(int *err) ...@@ -447,6 +433,7 @@ struct auxtrace_record *intel_bts_recording_init(int *err)
} }
btsr->intel_bts_pmu = intel_bts_pmu; btsr->intel_bts_pmu = intel_bts_pmu;
btsr->itr.pmu = intel_bts_pmu;
btsr->itr.recording_options = intel_bts_recording_options; btsr->itr.recording_options = intel_bts_recording_options;
btsr->itr.info_priv_size = intel_bts_info_priv_size; btsr->itr.info_priv_size = intel_bts_info_priv_size;
btsr->itr.info_fill = intel_bts_info_fill; btsr->itr.info_fill = intel_bts_info_fill;
...@@ -456,7 +443,7 @@ struct auxtrace_record *intel_bts_recording_init(int *err) ...@@ -456,7 +443,7 @@ struct auxtrace_record *intel_bts_recording_init(int *err)
btsr->itr.find_snapshot = intel_bts_find_snapshot; btsr->itr.find_snapshot = intel_bts_find_snapshot;
btsr->itr.parse_snapshot_options = intel_bts_parse_snapshot_options; btsr->itr.parse_snapshot_options = intel_bts_parse_snapshot_options;
btsr->itr.reference = intel_bts_reference; btsr->itr.reference = intel_bts_reference;
btsr->itr.read_finish = intel_bts_read_finish; btsr->itr.read_finish = auxtrace_record__read_finish;
btsr->itr.alignment = sizeof(struct branch); btsr->itr.alignment = sizeof(struct branch);
return &btsr->itr; return &btsr->itr;
} }
...@@ -1166,20 +1166,6 @@ static u64 intel_pt_reference(struct auxtrace_record *itr __maybe_unused) ...@@ -1166,20 +1166,6 @@ static u64 intel_pt_reference(struct auxtrace_record *itr __maybe_unused)
return rdtsc(); return rdtsc();
} }
static int intel_pt_read_finish(struct auxtrace_record *itr, int idx)
{
struct intel_pt_recording *ptr =
container_of(itr, struct intel_pt_recording, itr);
struct evsel *evsel;
evlist__for_each_entry(ptr->evlist, evsel) {
if (evsel->core.attr.type == ptr->intel_pt_pmu->type)
return perf_evlist__enable_event_idx(ptr->evlist, evsel,
idx);
}
return -EINVAL;
}
struct auxtrace_record *intel_pt_recording_init(int *err) struct auxtrace_record *intel_pt_recording_init(int *err)
{ {
struct perf_pmu *intel_pt_pmu = perf_pmu__find(INTEL_PT_PMU_NAME); struct perf_pmu *intel_pt_pmu = perf_pmu__find(INTEL_PT_PMU_NAME);
...@@ -1200,6 +1186,7 @@ struct auxtrace_record *intel_pt_recording_init(int *err) ...@@ -1200,6 +1186,7 @@ struct auxtrace_record *intel_pt_recording_init(int *err)
} }
ptr->intel_pt_pmu = intel_pt_pmu; ptr->intel_pt_pmu = intel_pt_pmu;
ptr->itr.pmu = intel_pt_pmu;
ptr->itr.recording_options = intel_pt_recording_options; ptr->itr.recording_options = intel_pt_recording_options;
ptr->itr.info_priv_size = intel_pt_info_priv_size; ptr->itr.info_priv_size = intel_pt_info_priv_size;
ptr->itr.info_fill = intel_pt_info_fill; ptr->itr.info_fill = intel_pt_info_fill;
...@@ -1209,7 +1196,7 @@ struct auxtrace_record *intel_pt_recording_init(int *err) ...@@ -1209,7 +1196,7 @@ struct auxtrace_record *intel_pt_recording_init(int *err)
ptr->itr.find_snapshot = intel_pt_find_snapshot; ptr->itr.find_snapshot = intel_pt_find_snapshot;
ptr->itr.parse_snapshot_options = intel_pt_parse_snapshot_options; ptr->itr.parse_snapshot_options = intel_pt_parse_snapshot_options;
ptr->itr.reference = intel_pt_reference; ptr->itr.reference = intel_pt_reference;
ptr->itr.read_finish = intel_pt_read_finish; ptr->itr.read_finish = auxtrace_record__read_finish;
/* /*
* Decoding starts at a PSB packet. Minimum PSB period is 2K so 4K * Decoding starts at a PSB packet. Minimum PSB period is 2K so 4K
* should give at least 1 PSB per sample. * should give at least 1 PSB per sample.
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#ifndef _PERF_BPF_PID_FILTER_ #ifndef _PERF_BPF_PID_FILTER_
#define _PERF_BPF_PID_FILTER_ #define _PERF_BPF_PID_FILTER_
#include <bpf/bpf.h> #include <bpf.h>
#define pid_filter(name) pid_map(name, bool) #define pid_filter(name) pid_map(name, bool)
......
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
#include <bpf/bpf.h> #include <bpf.h>
struct bpf_map SEC("maps") __bpf_stdout__ = { struct bpf_map SEC("maps") __bpf_stdout__ = {
.type = BPF_MAP_TYPE_PERF_EVENT_ARRAY, .type = BPF_MAP_TYPE_PERF_EVENT_ARRAY,
......
// SPDX-License-Identifier: LGPL-2.1 // SPDX-License-Identifier: LGPL-2.1
#include <bpf/bpf.h> #include <bpf.h>
static int (*bpf_get_current_pid_tgid)(void) = (void *)BPF_FUNC_get_current_pid_tgid; static int (*bpf_get_current_pid_tgid)(void) = (void *)BPF_FUNC_get_current_pid_tgid;
......
...@@ -14,7 +14,7 @@ add_probe_vfs_getname() { ...@@ -14,7 +14,7 @@ add_probe_vfs_getname() {
if [ $had_vfs_getname -eq 1 ] ; then if [ $had_vfs_getname -eq 1 ] ; then
line=$(perf probe -L getname_flags 2>&1 | egrep 'result.*=.*filename;' | sed -r 's/[[:space:]]+([[:digit:]]+)[[:space:]]+result->uptr.*/\1/') line=$(perf probe -L getname_flags 2>&1 | egrep 'result.*=.*filename;' | sed -r 's/[[:space:]]+([[:digit:]]+)[[:space:]]+result->uptr.*/\1/')
perf probe -q "vfs_getname=getname_flags:${line} pathname=result->name:string" || \ perf probe -q "vfs_getname=getname_flags:${line} pathname=result->name:string" || \
perf probe $verbose "vfs_getname=getname_flags:${line} pathname=filename:string" perf probe $verbose "vfs_getname=getname_flags:${line} pathname=filename:ustring"
fi fi
} }
......
...@@ -629,8 +629,10 @@ int auxtrace_record__options(struct auxtrace_record *itr, ...@@ -629,8 +629,10 @@ int auxtrace_record__options(struct auxtrace_record *itr,
struct evlist *evlist, struct evlist *evlist,
struct record_opts *opts) struct record_opts *opts)
{ {
if (itr) if (itr) {
itr->evlist = evlist;
return itr->recording_options(itr, evlist, opts); return itr->recording_options(itr, evlist, opts);
}
return 0; return 0;
} }
...@@ -664,6 +666,24 @@ int auxtrace_parse_snapshot_options(struct auxtrace_record *itr, ...@@ -664,6 +666,24 @@ int auxtrace_parse_snapshot_options(struct auxtrace_record *itr,
return -EINVAL; return -EINVAL;
} }
int auxtrace_record__read_finish(struct auxtrace_record *itr, int idx)
{
struct evsel *evsel;
if (!itr->evlist || !itr->pmu)
return -EINVAL;
evlist__for_each_entry(itr->evlist, evsel) {
if (evsel->core.attr.type == itr->pmu->type) {
if (evsel->disabled)
return 0;
return perf_evlist__enable_event_idx(itr->evlist, evsel,
idx);
}
}
return -EINVAL;
}
/* /*
* Event record size is 16-bit which results in a maximum size of about 64KiB. * Event record size is 16-bit which results in a maximum size of about 64KiB.
* Allow about 4KiB for the rest of the sample record, to give a maximum * Allow about 4KiB for the rest of the sample record, to give a maximum
......
...@@ -29,6 +29,7 @@ struct record_opts; ...@@ -29,6 +29,7 @@ struct record_opts;
struct perf_record_auxtrace_error; struct perf_record_auxtrace_error;
struct perf_record_auxtrace_info; struct perf_record_auxtrace_info;
struct events_stats; struct events_stats;
struct perf_pmu;
enum auxtrace_error_type { enum auxtrace_error_type {
PERF_AUXTRACE_ERROR_ITRACE = 1, PERF_AUXTRACE_ERROR_ITRACE = 1,
...@@ -322,6 +323,8 @@ struct auxtrace_mmap_params { ...@@ -322,6 +323,8 @@ struct auxtrace_mmap_params {
* @read_finish: called after reading from an auxtrace mmap * @read_finish: called after reading from an auxtrace mmap
* @alignment: alignment (if any) for AUX area data * @alignment: alignment (if any) for AUX area data
* @default_aux_sample_size: default sample size for --aux sample option * @default_aux_sample_size: default sample size for --aux sample option
* @pmu: associated pmu
* @evlist: selected events list
*/ */
struct auxtrace_record { struct auxtrace_record {
int (*recording_options)(struct auxtrace_record *itr, int (*recording_options)(struct auxtrace_record *itr,
...@@ -346,6 +349,8 @@ struct auxtrace_record { ...@@ -346,6 +349,8 @@ struct auxtrace_record {
int (*read_finish)(struct auxtrace_record *itr, int idx); int (*read_finish)(struct auxtrace_record *itr, int idx);
unsigned int alignment; unsigned int alignment;
unsigned int default_aux_sample_size; unsigned int default_aux_sample_size;
struct perf_pmu *pmu;
struct evlist *evlist;
}; };
/** /**
...@@ -537,6 +542,7 @@ int auxtrace_record__find_snapshot(struct auxtrace_record *itr, int idx, ...@@ -537,6 +542,7 @@ int auxtrace_record__find_snapshot(struct auxtrace_record *itr, int idx,
struct auxtrace_mmap *mm, struct auxtrace_mmap *mm,
unsigned char *data, u64 *head, u64 *old); unsigned char *data, u64 *head, u64 *old);
u64 auxtrace_record__reference(struct auxtrace_record *itr); u64 auxtrace_record__reference(struct auxtrace_record *itr);
int auxtrace_record__read_finish(struct auxtrace_record *itr, int idx);
int auxtrace_index__auxtrace_event(struct list_head *head, union perf_event *event, int auxtrace_index__auxtrace_event(struct list_head *head, union perf_event *event,
off_t file_offset); off_t file_offset);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment