2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-29 15:43:59 +08:00

perf/urgent fixes:

core:
 
   Mao Han:
 
   - Use hweight64() instead of hweight_long(attr.sample_regs_user) when parsing
     samples, this is what the kernel uses and fixes de problem in 32-bit
     architectures such as C-SKY that have more than 32 registers that can come
     in a sample.
 
 perf stat:
 
   Jiri Olsa:
 
   - Disable DIR_FORMAT feature for 'perf stat record', fixing an assert()
     failure.
 
 Intel PT:
 
   Adrian Hunter:
 
   - Fix use of parent_id in calls_view in export-to-sqlite.py.
 
 BPF:
 
   Gustavo A. R. Silva:
 
   - Fix lock/unlock imbalances when processing BPF/BTF info, found by the
     coverity tool.
 
 libtraceevent:
 
   Rikard Falkeborn:
 
   - Fix missing equality check for strcmp(), detected by the cppcheck tool.
 
 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQR2GiIUctdOfX2qHhGyPKLppCJ+JwUCXLXr5gAKCRCyPKLppCJ+
 JyFYAQCeUncCLHtGQQukX/wJojGhgHiejCetVZtqe3Rm2BClNgEAlzbXyNT+ovzU
 ULG8tQSRxIo18hkrWKk+sDMDExNJIAk=
 =HIHW
 -----END PGP SIGNATURE-----

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

Pull perf/urgent fixes from Arnaldo Carvalho de Melo:

core:

  Mao Han:

  - Use hweight64() instead of hweight_long(attr.sample_regs_user) when parsing
    samples, this is what the kernel uses and fixes de problem in 32-bit
    architectures such as C-SKY that have more than 32 registers that can come
    in a sample.

perf stat:

  Jiri Olsa:

  - Disable DIR_FORMAT feature for 'perf stat record', fixing an assert()
    failure.

Intel PT:

  Adrian Hunter:

  - Fix use of parent_id in calls_view in export-to-sqlite.py.

BPF:

  Gustavo A. R. Silva:

  - Fix lock/unlock imbalances when processing BPF/BTF info, found by the
    coverity tool.

libtraceevent:

  Rikard Falkeborn:

  - Fix missing equality check for strcmp(), detected by the cppcheck tool.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
Ingo Molnar 2019-04-16 17:24:14 +02:00
commit b24131eb77
5 changed files with 22 additions and 17 deletions

View File

@ -2233,7 +2233,7 @@ eval_type_str(unsigned long long val, const char *type, int pointer)
return val & 0xffffffff;
if (strcmp(type, "u64") == 0 ||
strcmp(type, "s64"))
strcmp(type, "s64") == 0)
return val;
if (strcmp(type, "s8") == 0)

View File

@ -1308,6 +1308,7 @@ static void init_features(struct perf_session *session)
for (feat = HEADER_FIRST_FEATURE; feat < HEADER_LAST_FEATURE; feat++)
perf_header__set_feat(&session->header, feat);
perf_header__clear_feat(&session->header, HEADER_DIR_FORMAT);
perf_header__clear_feat(&session->header, HEADER_BUILD_ID);
perf_header__clear_feat(&session->header, HEADER_TRACING_DATA);
perf_header__clear_feat(&session->header, HEADER_BRANCH_STACK);

View File

@ -331,7 +331,7 @@ if perf_db_export_calls:
'return_id,'
'CASE WHEN flags=0 THEN \'\' WHEN flags=1 THEN \'no call\' WHEN flags=2 THEN \'no return\' WHEN flags=3 THEN \'no call/return\' WHEN flags=6 THEN \'jump\' ELSE flags END AS flags,'
'parent_call_path_id,'
'parent_id'
'calls.parent_id'
' FROM calls INNER JOIN call_paths ON call_paths.id = call_path_id')
do_query(query, 'CREATE VIEW samples_view AS '

View File

@ -2368,7 +2368,7 @@ int perf_evsel__parse_sample(struct perf_evsel *evsel, union perf_event *event,
if (data->user_regs.abi) {
u64 mask = evsel->attr.sample_regs_user;
sz = hweight_long(mask) * sizeof(u64);
sz = hweight64(mask) * sizeof(u64);
OVERFLOW_CHECK(array, sz, max_size);
data->user_regs.mask = mask;
data->user_regs.regs = (u64 *)array;
@ -2424,7 +2424,7 @@ int perf_evsel__parse_sample(struct perf_evsel *evsel, union perf_event *event,
if (data->intr_regs.abi != PERF_SAMPLE_REGS_ABI_NONE) {
u64 mask = evsel->attr.sample_regs_intr;
sz = hweight_long(mask) * sizeof(u64);
sz = hweight64(mask) * sizeof(u64);
OVERFLOW_CHECK(array, sz, max_size);
data->intr_regs.mask = mask;
data->intr_regs.regs = (u64 *)array;
@ -2552,7 +2552,7 @@ size_t perf_event__sample_event_size(const struct perf_sample *sample, u64 type,
if (type & PERF_SAMPLE_REGS_USER) {
if (sample->user_regs.abi) {
result += sizeof(u64);
sz = hweight_long(sample->user_regs.mask) * sizeof(u64);
sz = hweight64(sample->user_regs.mask) * sizeof(u64);
result += sz;
} else {
result += sizeof(u64);
@ -2580,7 +2580,7 @@ size_t perf_event__sample_event_size(const struct perf_sample *sample, u64 type,
if (type & PERF_SAMPLE_REGS_INTR) {
if (sample->intr_regs.abi) {
result += sizeof(u64);
sz = hweight_long(sample->intr_regs.mask) * sizeof(u64);
sz = hweight64(sample->intr_regs.mask) * sizeof(u64);
result += sz;
} else {
result += sizeof(u64);
@ -2710,7 +2710,7 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type,
if (type & PERF_SAMPLE_REGS_USER) {
if (sample->user_regs.abi) {
*array++ = sample->user_regs.abi;
sz = hweight_long(sample->user_regs.mask) * sizeof(u64);
sz = hweight64(sample->user_regs.mask) * sizeof(u64);
memcpy(array, sample->user_regs.regs, sz);
array = (void *)array + sz;
} else {
@ -2746,7 +2746,7 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type,
if (type & PERF_SAMPLE_REGS_INTR) {
if (sample->intr_regs.abi) {
*array++ = sample->intr_regs.abi;
sz = hweight_long(sample->intr_regs.mask) * sizeof(u64);
sz = hweight64(sample->intr_regs.mask) * sizeof(u64);
memcpy(array, sample->intr_regs.regs, sz);
array = (void *)array + sz;
} else {

View File

@ -2606,6 +2606,7 @@ static int process_bpf_prog_info(struct feat_fd *ff, void *data __maybe_unused)
perf_env__insert_bpf_prog_info(env, info_node);
}
up_write(&env->bpf_progs.lock);
return 0;
out:
free(info_linear);
@ -2623,7 +2624,9 @@ static int process_bpf_prog_info(struct feat_fd *ff __maybe_unused, void *data _
static int process_bpf_btf(struct feat_fd *ff, void *data __maybe_unused)
{
struct perf_env *env = &ff->ph->env;
struct btf_node *node = NULL;
u32 count, i;
int err = -1;
if (ff->ph->needs_swap) {
pr_warning("interpreting btf from systems with endianity is not yet supported\n");
@ -2636,31 +2639,32 @@ static int process_bpf_btf(struct feat_fd *ff, void *data __maybe_unused)
down_write(&env->bpf_progs.lock);
for (i = 0; i < count; ++i) {
struct btf_node *node;
u32 id, data_size;
if (do_read_u32(ff, &id))
return -1;
goto out;
if (do_read_u32(ff, &data_size))
return -1;
goto out;
node = malloc(sizeof(struct btf_node) + data_size);
if (!node)
return -1;
goto out;
node->id = id;
node->data_size = data_size;
if (__do_read(ff, node->data, data_size)) {
free(node);
return -1;
}
if (__do_read(ff, node->data, data_size))
goto out;
perf_env__insert_btf(env, node);
node = NULL;
}
err = 0;
out:
up_write(&env->bpf_progs.lock);
return 0;
free(node);
return err;
}
struct feature_ops {