Merge remote-tracking branch 'torvalds/master' into perf/urgent
authorArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 21 May 2021 18:59:23 +0000 (15:59 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 21 May 2021 18:59:23 +0000 (15:59 -0300)
To pick up more UAPI updates to sync with tools/.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/arch/x86/include/uapi/asm/kvm.h
tools/perf/builtin-buildid-list.c
tools/perf/tests/pfm.c
tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
tools/perf/util/intel-pt.c
tools/perf/util/parse-events.c
tools/perf/util/parse-events.l
tools/perf/util/pfm.c

index 5a3022c..0662f64 100644 (file)
@@ -437,6 +437,8 @@ struct kvm_vmx_nested_state_hdr {
                __u16 flags;
        } smm;
 
+       __u16 pad;
+
        __u32 flags;
        __u64 preemption_timer_deadline;
 };
index 87f5b1a..833405c 100644 (file)
@@ -80,6 +80,9 @@ static int perf_session__list_build_ids(bool force, bool with_hits)
        if (!perf_header__has_feat(&session->header, HEADER_BUILD_ID))
                with_hits = true;
 
+       if (zstd_init(&(session->zstd_data), 0) < 0)
+               pr_warning("Decompression initialization failed. Reported data may be incomplete.\n");
+
        /*
         * in pipe-mode, the only way to get the buildids is to parse
         * the record stream. Buildids are stored as RECORD_HEADER_BUILD_ID
index 76a5312..d4b0ef7 100644 (file)
@@ -131,8 +131,8 @@ static int test__pfm_group(void)
                },
                {
                        .events = "{},{instructions}",
-                       .nr_events = 0,
-                       .nr_groups = 0,
+                       .nr_events = 1,
+                       .nr_groups = 1,
                },
                {
                        .events = "{instructions},{instructions}",
index 8c59677..20ad663 100644 (file)
@@ -1146,6 +1146,8 @@ static bool intel_pt_fup_event(struct intel_pt_decoder *decoder)
                decoder->set_fup_tx_flags = false;
                decoder->tx_flags = decoder->fup_tx_flags;
                decoder->state.type = INTEL_PT_TRANSACTION;
+               if (decoder->fup_tx_flags & INTEL_PT_ABORT_TX)
+                       decoder->state.type |= INTEL_PT_BRANCH;
                decoder->state.from_ip = decoder->ip;
                decoder->state.to_ip = 0;
                decoder->state.flags = decoder->fup_tx_flags;
@@ -1220,8 +1222,10 @@ static int intel_pt_walk_fup(struct intel_pt_decoder *decoder)
                        return 0;
                if (err == -EAGAIN ||
                    intel_pt_fup_with_nlip(decoder, &intel_pt_insn, ip, err)) {
+                       bool no_tip = decoder->pkt_state != INTEL_PT_STATE_FUP;
+
                        decoder->pkt_state = INTEL_PT_STATE_IN_SYNC;
-                       if (intel_pt_fup_event(decoder))
+                       if (intel_pt_fup_event(decoder) && no_tip)
                                return 0;
                        return -EAGAIN;
                }
index 8658d42..0dfec87 100644 (file)
@@ -707,8 +707,10 @@ static int intel_pt_walk_next_insn(struct intel_pt_insn *intel_pt_insn,
 
                        *ip += intel_pt_insn->length;
 
-                       if (to_ip && *ip == to_ip)
+                       if (to_ip && *ip == to_ip) {
+                               intel_pt_insn->length = 0;
                                goto out_no_cache;
+                       }
 
                        if (*ip >= al.map->end)
                                break;
@@ -1198,6 +1200,7 @@ static void intel_pt_set_pid_tid_cpu(struct intel_pt *pt,
 
 static void intel_pt_sample_flags(struct intel_pt_queue *ptq)
 {
+       ptq->insn_len = 0;
        if (ptq->state->flags & INTEL_PT_ABORT_TX) {
                ptq->flags = PERF_IP_FLAG_BRANCH | PERF_IP_FLAG_TX_ABORT;
        } else if (ptq->state->flags & INTEL_PT_ASYNC) {
@@ -1211,7 +1214,6 @@ static void intel_pt_sample_flags(struct intel_pt_queue *ptq)
                        ptq->flags = PERF_IP_FLAG_BRANCH | PERF_IP_FLAG_CALL |
                                     PERF_IP_FLAG_ASYNC |
                                     PERF_IP_FLAG_INTERRUPT;
-               ptq->insn_len = 0;
        } else {
                if (ptq->state->from_ip)
                        ptq->flags = intel_pt_insn_type(ptq->state->insn_op);
index 4dad142..84108c1 100644 (file)
@@ -150,6 +150,10 @@ struct event_symbol event_symbols_sw[PERF_COUNT_SW_MAX] = {
                .symbol = "bpf-output",
                .alias  = "",
        },
+       [PERF_COUNT_SW_CGROUP_SWITCHES] = {
+               .symbol = "cgroup-switches",
+               .alias  = "",
+       },
 };
 
 #define __PERF_EVENT_FIELD(config, name) \
@@ -2928,9 +2932,14 @@ restart:
        }
 
        for (i = 0; i < max; i++, syms++) {
+               /*
+                * New attr.config still not supported here, the latest
+                * example was PERF_COUNT_SW_CGROUP_SWITCHES
+                */
+               if (syms->symbol == NULL)
+                       continue;
 
-               if (event_glob != NULL && syms->symbol != NULL &&
-                   !(strglobmatch(syms->symbol, event_glob) ||
+               if (event_glob != NULL && !(strglobmatch(syms->symbol, event_glob) ||
                      (syms->alias && strglobmatch(syms->alias, event_glob))))
                        continue;
 
index fb8646c..9238490 100644 (file)
@@ -347,6 +347,7 @@ emulation-faults                            { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_EM
 dummy                                          { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_DUMMY); }
 duration_time                                  { return tool(yyscanner, PERF_TOOL_DURATION_TIME); }
 bpf-output                                     { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_BPF_OUTPUT); }
+cgroup-switches                                        { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CGROUP_SWITCHES); }
 
        /*
         * We have to handle the kernel PMU event cycles-ct/cycles-t/mem-loads/mem-stores separately.
index d735acb..6eef6df 100644 (file)
@@ -62,8 +62,16 @@ int parse_libpfm_events_option(const struct option *opt, const char *str,
                }
 
                /* no event */
-               if (*q == '\0')
+               if (*q == '\0') {
+                       if (*sep == '}') {
+                               if (grp_evt < 0) {
+                                       ui__error("cannot close a non-existing event group\n");
+                                       goto error;
+                               }
+                               grp_evt--;
+                       }
                        continue;
+               }
 
                memset(&attr, 0, sizeof(attr));
                event_attr_init(&attr);
@@ -107,6 +115,7 @@ int parse_libpfm_events_option(const struct option *opt, const char *str,
                        grp_evt = -1;
                }
        }
+       free(p_orig);
        return 0;
 error:
        free(p_orig);