Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp713850ybt; Wed, 8 Jul 2020 09:51:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpfxRnMsbANOghJCha1sgXwx4nGo7yLC3xQDQF5lBS+NhFhQfhi2omxt0I34eDv5UnS6nT X-Received: by 2002:a17:906:2714:: with SMTP id z20mr52747868ejc.469.1594227117018; Wed, 08 Jul 2020 09:51:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594227117; cv=none; d=google.com; s=arc-20160816; b=wSwWBBwe5o2YkG68w8KkD+KCJPeAbksnaDf+B6kN8fR+uunSj/Jkb/WPz/II1gvFf4 uLRtJlyKxEca2QEE6AtHWaWVGKK0RT4XU6wCHaY855oXjd6xdIpeQHp7XOu/93SzWdX7 VIvkzYI36agyXYjvmqOZ8cjAQPBUSbtu9hhMVhZQoJ528VSWA7oMv9IeVacK9LvB4b5L I18pj+4ppCqgH2hRksJCOVHGUofI2/srmLakRrPaX/9gsv+AKhKicYUcspbzDSn2AWZR gji5rCT+uGiPBh5WhAdepga08OEU4PIlYnblzP1gY9ssk4GJ5Mx/c0HTkOT2OQYydLXg CPdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=IYZ44erC//O5NgDxZQDY3YbDYA2m4mu+vUUINjHyycI=; b=0ELDIbQAcTucsCUHvvqISWhTbsOCoZtJA0g5SLxCJdkZNV8prdNk2FdkAvyiDUtcbP 80oIzD2XP91JsBGg1Rkr7uTybkhlIwKguBVWiW0E2mL7cIQEwDM2v7eVpEvc7Jm//W0r yxe4fCxknHEH/c5tV0vkiEXc/YIqgfeAPel3PNdV+edmjD6ZuHxHyU2uA8OQSYpxItBO n58MLfs+pOLrJwoha/mb/WlZ4KMQetgXah9V6AYtbTK+J2nMFYnrw8fqK96Fq06y++bG YZc2wfXEWJuFZFfeVfDgtUKYqOWKYl6BMmJsKwaZ2BTMyM3cLUKR2qorhL443CN2+q/G NLkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=eEdzZ3Qq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bx17si307264edb.559.2020.07.08.09.51.34; Wed, 08 Jul 2020 09:51:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=eEdzZ3Qq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730877AbgGHQsQ (ORCPT + 99 others); Wed, 8 Jul 2020 12:48:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730859AbgGHQsO (ORCPT ); Wed, 8 Jul 2020 12:48:14 -0400 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BC2EC061A0B for ; Wed, 8 Jul 2020 09:48:14 -0700 (PDT) Received: by mail-pl1-x642.google.com with SMTP id f2so18411217plr.8 for ; Wed, 08 Jul 2020 09:48:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IYZ44erC//O5NgDxZQDY3YbDYA2m4mu+vUUINjHyycI=; b=eEdzZ3Qq2MBAqxJeFuWLW/2OtaJBvtUT4haJZhAhbOKfRRZqDbfyq/ywCAv8aiyMjJ MobMvtLv8RcWk5hbwemzueVJbjxIHoiutdcbBcUzrE40jVytzOyHdECN8+4wpV5XCLkn 9Sfqf8vjzS0U0zpmMtTpRcwXvtlq5q+2DJxk8hSMTb3in2OCB/B64NSeR+QQlNrelmyN jQCCXZ5depMwpBm/iQ1TahxC6v/Q3Ipm1IQp1dZ3hy/qvkO2eAcykoiaBeTpu+bQjcOQ nMMb5q7b3ltFF1C7gvVCWgna6xXy1eYmKN1RNKOOL2qhlYoHDvJWIM4ZYtjZD0khEHiM x0KQ== 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:mime-version:content-transfer-encoding; bh=IYZ44erC//O5NgDxZQDY3YbDYA2m4mu+vUUINjHyycI=; b=jKiKAbjeOXP1SkYvRrr/AxjMIKlqwTBccGxUY5JiBgojBST7VWRjJr969i7+7B/Jn0 D3XBtu3whyykvksvGw+Un+gyJMpxARMInenqYRHpNPeoELfuFMZ9754WRVqBMZqyftrm dDwbVCAlPrpLGmRmg3IEWjfzYLcyWufVx7HSJ2EDGRrLWG/0O87FrTRtf18fOSynqz8q uMQsswdfCZWp57a2KTQxVJINxC0lqZiZnqNDUlT2iqPAuoWPnf4bQ4wb+cR8/p56I3DA +gtMyqsajJkDGFKlGZMSPJI1iiKyGX9cTtOTS/TXWRyFhhrlRu+qLas2D7Ltt6ebW3uP chjQ== X-Gm-Message-State: AOAM533dPDZC7a8v6EJLG2x8q3R0HVFmr1SCSJCStvutnh/ENIP2Fq03 40LAZaosM3J+KgWbJrqlKLM= X-Received: by 2002:a17:902:446:: with SMTP id 64mr6674136ple.157.1594226894152; Wed, 08 Jul 2020 09:48:14 -0700 (PDT) Received: from vultr.guest ([149.248.10.52]) by smtp.gmail.com with ESMTPSA id r8sm310803pfg.147.2020.07.08.09.48.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jul 2020 09:48:13 -0700 (PDT) From: Changbin Du To: Jiri Olsa , Arnaldo Carvalho de Melo Cc: Peter Zijlstra , Ingo Molnar , Namhyung Kim , Steven Rostedt , linux-kernel@vger.kernel.org, Changbin Du Subject: [PATCH v3 13/17] perf ftrace: add support for tracing option 'irq-info' Date: Thu, 9 Jul 2020 00:46:01 +0800 Message-Id: <20200708164605.31245-14-changbin.du@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200708164605.31245-1-changbin.du@gmail.com> References: <20200708164605.31245-1-changbin.du@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This adds support to display irq context info for function tracer. To do this, just specify a '--func-opts irq-info' option. Signed-off-by: Changbin Du --- tools/perf/Documentation/perf-ftrace.txt | 1 + tools/perf/builtin-ftrace.c | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/tools/perf/Documentation/perf-ftrace.txt b/tools/perf/Documentation/perf-ftrace.txt index 5cc1f83795f5..b157566e54a2 100644 --- a/tools/perf/Documentation/perf-ftrace.txt +++ b/tools/perf/Documentation/perf-ftrace.txt @@ -85,6 +85,7 @@ OPTIONS --func-opts:: List of options allowed to set: call-graph - Display kernel stack trace for function tracer. + irq-info - Display irq context info for function tracer. -G:: --graph-funcs=:: diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c index 330dac9ffe3d..a750ee78db4f 100644 --- a/tools/perf/builtin-ftrace.c +++ b/tools/perf/builtin-ftrace.c @@ -43,6 +43,7 @@ struct perf_ftrace { unsigned long percpu_buffer_size; bool inherit; int func_stack_trace; + int func_irq_info; int graph_nosleep_time; int graph_noirqs; }; @@ -205,6 +206,7 @@ static void reset_tracing_options(struct perf_ftrace *ftrace __maybe_unused) write_tracing_option_file("func_stack_trace", "0"); write_tracing_option_file("sleep-time", "1"); write_tracing_option_file("funcgraph-irqs", "1"); + write_tracing_option_file("irq-info", "0"); } static int reset_tracing_files(struct perf_ftrace *ftrace __maybe_unused) @@ -292,6 +294,17 @@ static int set_tracing_func_stack_trace(struct perf_ftrace *ftrace) return 0; } +static int set_tracing_func_irqinfo(struct perf_ftrace *ftrace) +{ + if (!ftrace->func_irq_info) + return 0; + + if (write_tracing_option_file("irq-info", "1") < 0) + return -1; + + return 0; +} + static int reset_tracing_cpu(void) { struct perf_cpu_map *cpumap = perf_cpu_map__new(NULL); @@ -467,6 +480,11 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv) goto out_reset; } + if (set_tracing_func_irqinfo(ftrace) < 0) { + pr_err("failed to set tracing option irq-info\n"); + goto out_reset; + } + if (set_tracing_filters(ftrace) < 0) { pr_err("failed to set tracing filters\n"); goto out_reset; @@ -667,6 +685,7 @@ static int parse_func_tracer_opts(const struct option *opt, struct perf_ftrace *ftrace = (struct perf_ftrace *) opt->value; struct sublevel_option func_tracer_opts[] = { { .name = "call-graph", .value_ptr = &ftrace->func_stack_trace }, + { .name = "irq-info", .value_ptr = &ftrace->func_irq_info }, { .name = NULL, } }; @@ -734,7 +753,7 @@ int cmd_ftrace(int argc, const char **argv) OPT_CALLBACK('N', "notrace-funcs", &ftrace.notrace, "func", "do not trace given functions", parse_filter_func), OPT_CALLBACK(0, "func-opts", &ftrace, "options", - "function tracer options, available options: call-graph", + "function tracer options, available options: call-graph,irq-info", parse_func_tracer_opts), OPT_CALLBACK('G', "graph-funcs", &ftrace.graph_funcs, "func", "trace given functions using function_graph tracer", -- 2.25.1