Received: by 10.223.164.202 with SMTP id h10csp1198887wrb; Tue, 7 Nov 2017 23:58:48 -0800 (PST) X-Google-Smtp-Source: ABhQp+RNNb7SfSHqWrWMkOSe5rR+TZGaOOvOKVepdtjhFi5j5AQ40McdVRrStSTgvdPDoy+sVmi8 X-Received: by 10.98.74.93 with SMTP id x90mr1621876pfa.177.1510127927995; Tue, 07 Nov 2017 23:58:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510127927; cv=none; d=google.com; s=arc-20160816; b=mhuAW7/GbjYw2Bu7pQko1VsvvKhGkrVchwBT0IlXIg9x3d6J7DuwTNva0j6J+muURB YEZIY1uSivakdbQBZx/DfSbSPxxxscd0KDl5HqKrXJaHrVlukwRh191afjgv5WQ8Bomi TSnIYbw7FTadjNvNbra0z6GxVZj0bYkpo58RsUogV42pDWe3GCgPvQSopFRbmUxrL44x fHB56ldKjcXq4bpF7HZ64gi1YLIhj7UnPW0vGhnk+Msn8mZ6s3s8+gQ4aC2KKAL1UdzT brMGW1dIvaStP43rhTkzgvRmwwybUNNjdZNskwqyhQuwvlipmZCjhT8oH/OvYJtIs3It +ZXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=Am3BVsxZUNNiVtPbiju5rv/Rmytf+rfAmhT1N8w55vs=; b=zy2z8gvDwzwGWzpyaWA5XFwDzjfmd3Phv1bwtxzP91dnHejyEusdQbkAd13KVJEcGg 3zOqSze5PgArnLY50aJL8RudJt9yxzmzSuuJJ5X9WKyJr9dGLwQrhtSpNo6bdUkB2V2T UshOwwyY90wgeWP9Ln6WOofCvsxbPUzPSTqa/dhIYa5FUym+GEKKyOxkkr9vFQlzV1c5 sP3E5BGVakE2t+W2C3ZTO/BZHzBMyG+lmcG2zsTRUzYX226CtQLhZfBfGhnfc0ur58sE 2vyC4uzDt/OuU9o/nRio5y71kTFV+7bC/7Uano9kIcrCdh2269eqIHVeeunRldYupQn4 HKkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=TKqkPOTH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y6si3064895pgp.587.2017.11.07.23.58.35; Tue, 07 Nov 2017 23:58:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=TKqkPOTH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751416AbdKHH5n (ORCPT + 89 others); Wed, 8 Nov 2017 02:57:43 -0500 Received: from mail-pl0-f65.google.com ([209.85.160.65]:51434 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750888AbdKHH4v (ORCPT ); Wed, 8 Nov 2017 02:56:51 -0500 Received: by mail-pl0-f65.google.com with SMTP id q9so795708pli.8 for ; Tue, 07 Nov 2017 23:56:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Am3BVsxZUNNiVtPbiju5rv/Rmytf+rfAmhT1N8w55vs=; b=TKqkPOTHkDWXzZQomfy3SB+0vsGEzzP/8QUCvhsiMusCZNkjlUOLzetJvjX616P1Ou +hq0RW/jLeJJRZfRtIRwCzZ80UuF3JqtW1HOYZASAVZLbe3tOWl1vxIJME9WnC6HJYWl g8EXNCjvgnCx3eG6g7Rml79hkAFdur+FViFevfAl3FMc2QsF5EX9n/rPQpvvP+wbE+GC lXQUZgPCtRjcNlaAdlqg0tB1p4HLQz+PMx2BLzLJXAZ/BVAKTC2NMBE5ziQoixMgWUUH bmcM4gRfs+fn6kODLUME0Y5fApBZtcH5jyGzDAKp1AeRN+fJq6Cqfht8ZKaLtqQFxVuc aA6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Am3BVsxZUNNiVtPbiju5rv/Rmytf+rfAmhT1N8w55vs=; b=YJl0LLhl88KBSd7PtM+A+W5ZOeddcYJ2+T8xXoZ2Q1qvhdJNz/rvhHoL99A38L+CQ1 G2zJo6MDBr8uTtm7bTgA1bzlZQjYJV35y6SCn428P3txN9edetWPaa2mgofKH3e/Ouz0 PvAaLoWM8qBqBOY7P5E9O4F6jxqP+z551cf7VB0QFv4FKOTlw30wOMKfLh+5GAL7eBh5 75hN9fOo8v2yQDHL0Et+rUw0dpAzNIvJnaCaya+wWFoL4yeJXLeDO2ViOgdhFfTBYrhg Hp+KiNdpPd57CK0tZ9p5/ukjMl44l2Z+V1yD/FVhlyNWfbfp5zP8kvoXG7bCo1sp4QRD aLow== X-Gm-Message-State: AJaThX65OIRDEMhqIvbg/EkHKlvEo3ScT0cq7eJO1Q5myEmvKQQJs9K1 R5XsqFbV0SWeA3ZEhFbyWeih/vBz/lU= X-Received: by 10.84.240.12 with SMTP id y12mr1435211plk.249.1510127809743; Tue, 07 Nov 2017 23:56:49 -0800 (PST) Received: from localhost (c-67-169-55-77.hsd1.ca.comcast.net. [67.169.55.77]) by smtp.gmail.com with ESMTPSA id d6sm6353420pfc.29.2017.11.07.23.56.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Nov 2017 23:56:49 -0800 (PST) From: Stephane Eranian To: linux-kernel@vger.kernel.org Cc: acme@redhat.com, peterz@infradead.org, mingo@elte.hu, ak@linux.intel.com, kan.liang@intel.com, jolsa@redhat.com Subject: [PATCH v3 3/5] perf/tools: add support for PERF_SAMPLE_SKID_IP Date: Tue, 7 Nov 2017 23:56:35 -0800 Message-Id: <1510127797-22483-4-git-send-email-eranian@google.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510127797-22483-1-git-send-email-eranian@google.com> References: <1510127797-22483-1-git-send-email-eranian@google.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch adds the support code to handle the PERF_SAMPLE_SKID_IP record type. This is done as an event term and as such can be enabled per event: cpu/event=xxx,skid-ip=1/. This is a boolean term which is false by default. Signed-off-by: Stephane Eranian --- tools/include/uapi/linux/perf_event.h | 4 +++- tools/perf/util/event.h | 1 + tools/perf/util/evsel.c | 11 +++++++++++ tools/perf/util/evsel.h | 2 ++ tools/perf/util/parse-events.c | 7 +++++++ tools/perf/util/parse-events.h | 1 + tools/perf/util/parse-events.l | 1 + tools/perf/util/session.c | 3 +++ 8 files changed, 29 insertions(+), 1 deletion(-) diff --git a/tools/include/uapi/linux/perf_event.h b/tools/include/uapi/linux/perf_event.h index 362493a2f950..79655228dd9b 100644 --- a/tools/include/uapi/linux/perf_event.h +++ b/tools/include/uapi/linux/perf_event.h @@ -141,8 +141,9 @@ enum perf_event_sample_format { PERF_SAMPLE_TRANSACTION = 1U << 17, PERF_SAMPLE_REGS_INTR = 1U << 18, PERF_SAMPLE_PHYS_ADDR = 1U << 19, + PERF_SAMPLE_SKID_IP = 1U << 20, - PERF_SAMPLE_MAX = 1U << 20, /* non-ABI */ + PERF_SAMPLE_MAX = 1U << 21, /* non-ABI */ }; /* @@ -817,6 +818,7 @@ enum perf_event_type { * { u64 abi; # enum perf_sample_regs_abi * u64 regs[weight(mask)]; } && PERF_SAMPLE_REGS_INTR * { u64 phys_addr;} && PERF_SAMPLE_PHYS_ADDR + * { u64 skid_ip; } && PERF_SAMPLE_SKID_IP * }; */ PERF_RECORD_SAMPLE = 9, diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h index 1ae95efbfb95..41622a7ed649 100644 --- a/tools/perf/util/event.h +++ b/tools/perf/util/event.h @@ -202,6 +202,7 @@ struct perf_sample { u32 raw_size; u64 data_src; u64 phys_addr; + u64 skid_ip; u32 flags; u16 insn_len; u8 cpumode; diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index f894893c203d..679954ed2201 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -775,6 +775,10 @@ static void apply_config_terms(struct perf_evsel *evsel, case PERF_EVSEL__CONFIG_TERM_OVERWRITE: attr->write_backward = term->val.overwrite ? 1 : 0; break; + case PERF_EVSEL__CONFIG_TERM_SKID_IP: + if (term->val.skid_ip) + perf_evsel__set_sample_bit(evsel, SKID_IP); + break; default: break; } @@ -1478,6 +1482,7 @@ static void __p_sample_type(char *buf, size_t size, u64 value) bit_name(BRANCH_STACK), bit_name(REGS_USER), bit_name(STACK_USER), bit_name(IDENTIFIER), bit_name(REGS_INTR), bit_name(DATA_SRC), bit_name(WEIGHT), bit_name(PHYS_ADDR), + bit_name(SKID_IP), { .name = NULL, } }; #undef bit_name @@ -2225,6 +2230,12 @@ int perf_evsel__parse_sample(struct perf_evsel *evsel, union perf_event *event, array++; } + data->skid_ip = 0; + if (type & PERF_SAMPLE_SKID_IP) { + data->skid_ip = *array; + array++; + } + return 0; } diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index 9277df96ffda..8555095f0d48 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h @@ -49,6 +49,7 @@ enum { PERF_EVSEL__CONFIG_TERM_OVERWRITE, PERF_EVSEL__CONFIG_TERM_DRV_CFG, PERF_EVSEL__CONFIG_TERM_BRANCH, + PERF_EVSEL__CONFIG_TERM_SKID_IP, PERF_EVSEL__CONFIG_TERM_MAX, }; @@ -66,6 +67,7 @@ struct perf_evsel_config_term { bool inherit; bool overwrite; char *branch; + bool skid_ip; } val; }; diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index a7fcd95961ef..1a1d9fc509bd 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -918,6 +918,7 @@ static const char *config_term_names[__PARSE_EVENTS__TERM_TYPE_NR] = { [PARSE_EVENTS__TERM_TYPE_OVERWRITE] = "overwrite", [PARSE_EVENTS__TERM_TYPE_NOOVERWRITE] = "no-overwrite", [PARSE_EVENTS__TERM_TYPE_DRV_CFG] = "driver-config", + [PARSE_EVENTS__TERM_TYPE_SKID_IP] = "skid-ip", }; static bool config_term_shrinked; @@ -1026,6 +1027,9 @@ do { \ case PARSE_EVENTS__TERM_TYPE_MAX_STACK: CHECK_TYPE_VAL(NUM); break; + case PARSE_EVENTS__TERM_TYPE_SKID_IP: + CHECK_TYPE_VAL(NUM); + break; default: err->str = strdup("unknown term"); err->idx = term->err_term; @@ -1159,6 +1163,9 @@ do { \ case PARSE_EVENTS__TERM_TYPE_DRV_CFG: ADD_CONFIG_TERM(DRV_CFG, drv_cfg, term->val.str); break; + case PARSE_EVENTS__TERM_TYPE_SKID_IP: + ADD_CONFIG_TERM(SKID_IP, skid_ip, term->val.num ? 1 : 0); + break; default: break; } diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h index be337c266697..d331f078a389 100644 --- a/tools/perf/util/parse-events.h +++ b/tools/perf/util/parse-events.h @@ -74,6 +74,7 @@ enum { PARSE_EVENTS__TERM_TYPE_NOOVERWRITE, PARSE_EVENTS__TERM_TYPE_OVERWRITE, PARSE_EVENTS__TERM_TYPE_DRV_CFG, + PARSE_EVENTS__TERM_TYPE_SKID_IP, __PARSE_EVENTS__TERM_TYPE_NR, }; diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l index 241396cd059d..383443f4fe0d 100644 --- a/tools/perf/util/parse-events.l +++ b/tools/perf/util/parse-events.l @@ -257,6 +257,7 @@ inherit { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_INHERIT); } no-inherit { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_NOINHERIT); } overwrite { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_OVERWRITE); } no-overwrite { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_NOOVERWRITE); } +skid-ip { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_SKID_IP); } , { return ','; } "/" { BEGIN(INITIAL); return '/'; } {name_minus} { return str(yyscanner, PE_NAME); } diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 5c412310f266..223165055d41 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -1131,6 +1131,9 @@ static void dump_sample(struct perf_evsel *evsel, union perf_event *event, if (sample_type & PERF_SAMPLE_READ) sample_read__printf(sample, evsel->attr.read_format); + + if (sample_type & PERF_SAMPLE_SKID_IP) + printf("... skid_ip: %" PRIu64 "\n", sample->skid_ip); } static void dump_read(struct perf_evsel *evsel, union perf_event *event) -- 2.7.4 From 1583478242737858563@xxx Wed Nov 08 06:28:50 +0000 2017 X-GM-THRID: 1583459324964515829 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread