From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934020AbdKBSQg (ORCPT ); Thu, 2 Nov 2017 14:16:36 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:55551 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932438AbdKBSQI (ORCPT ); Thu, 2 Nov 2017 14:16:08 -0400 X-Google-Smtp-Source: ABhQp+RRSL0h6ZOl0oiOdNafkTgQrwjUyYE5ordxC1nUFFLgK16zbl4cvW/qA06umNkd4QTbGE5I1g== 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 v2 4/5] perf/record: add support for sampling skid ip Date: Thu, 2 Nov 2017 11:15:58 -0700 Message-Id: <1509646559-919-5-git-send-email-eranian@google.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1509646559-919-1-git-send-email-eranian@google.com> References: <1509646559-919-1-git-send-email-eranian@google.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch adds a new --skid-ip option to perf record to capture the unmodified interrupted instruction pointer in each sample. With this option, the kernel captures both the ip and skid ip. Unless precise mode is enabled both ip are the same. They may be different in precise mode depending on the event and precise sampling mode. $ perf record --skid-ip ..... Signed-off-by: Stephane Eranian --- tools/perf/Documentation/perf-record.txt | 8 ++++++++ tools/perf/builtin-record.c | 2 ++ 2 files changed, 10 insertions(+) diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt index 5a626ef666c2..1b2f37776d90 100644 --- a/tools/perf/Documentation/perf-record.txt +++ b/tools/perf/Documentation/perf-record.txt @@ -483,6 +483,14 @@ config terms. For example: 'cycles/overwrite/' and 'instructions/no-overwrite/'. Implies --tail-synthesize. +--skid-ip:: +Capture the unmodified interrupt instruction pointer (IP) in each sample. Usually +with event-based sampling, the ip has skid and rarely point to the instruction which +caused the event to overflow. On some architectures, the hardware can eliminate the +skid and perf_events returns it as the IP with precise sampling is enabled. But for +certain measurements, it may be useful to have both the correct and skid ip. This +option enable capturing the skid ip in additional to the corrected ip. Default: off + SEE ALSO -------- linkperf:perf-stat[1], linkperf:perf-list[1] diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index a6cbf1640269..d318c0721484 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -1585,6 +1585,8 @@ static struct option __record_options[] = { "signal"), OPT_BOOLEAN(0, "dry-run", &dry_run, "Parse options then exit"), + OPT_BOOLEAN(0, "skid-ip", &record.opts.skid_ip, + "capture skid ip in additional to ip"), OPT_END() }; -- 2.7.4