Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2711165pxa; Fri, 7 Aug 2020 19:40:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqZOxZQ2e+Moo1HusMwQsGVeiiiiNM1dCDmO1ZKDV1kk3Qbh0zm+snX+GKlklqbQwerWC6 X-Received: by 2002:a50:eac5:: with SMTP id u5mr11856983edp.6.1596854452401; Fri, 07 Aug 2020 19:40:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596854452; cv=none; d=google.com; s=arc-20160816; b=mryZlFTMae4eSKyhmvJGEmqbVUhicMjrWGuePgf6xmEw39QgEgyj2yNmo1hnFfeWTV YgannBad4HnjT3avYbBNz+uYVIAhDCX0xJQMpZ4EZ6opImXBS24LCmFjGhp0luq5lK+g 1BeEmXeFWWfmFjlcB0IflkXFe4QOCEDomVh4jCKBmknpqlHREZjvvmvgmEbn2Cm96KWt W2+WKWWXxJF5UxKCib7hapNaDglQHteIpmJHhBQgqcePbXlV+hZ43yojHjM9dL79abh0 9n7WmlKWZS3ljKnDjcdTBM55xDgVKt++6qRmLKkhdX2bx7wSLFPoFS+o+29JfTA96Icm 5Wag== 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=EbyEsk7nlJHntsOEMlFsah0Ii+ve+07Y76zgwo3ks28=; b=vZ1qDvW1a6Z9VdmootcM59yvcDCbl2XTWKfoRicOzaMAoWt6MmLvd5sMgPw5d8m21m I6Oasnv78+1ObmE/AHVgIWPcI1eYz4Y4JMDJQ1BA/Fmm/6mno9ye5vZzEGiQA+0u/yQ6 wSIctBFt/YSPNU3z635G7GQzL9DdBuz3c+ockgh/yC9Bhg2C4QA/JrCQDvPsy2R9gkOE d10b6obNtD0DYrbTyGjh1Ly84PnzIxMBEdPTlZFHLaacKcbr6H++XB1gnXh7/7NN+qIG a6o0qUHu/HaC0tEMffqyVJ9TJ2Wp7ebAR4CpFjv5wwIVBrQ2O6nteZgnDrDEeRA9iaZI ob3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WkHcArsk; 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 nv5si6358915ejb.144.2020.08.07.19.40.29; Fri, 07 Aug 2020 19:40:52 -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=WkHcArsk; 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 S1726629AbgHHCji (ORCPT + 99 others); Fri, 7 Aug 2020 22:39:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726200AbgHHCjh (ORCPT ); Fri, 7 Aug 2020 22:39:37 -0400 Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6680DC061756 for ; Fri, 7 Aug 2020 19:39:37 -0700 (PDT) Received: by mail-qk1-x743.google.com with SMTP id b14so3522431qkn.4 for ; Fri, 07 Aug 2020 19:39:37 -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=EbyEsk7nlJHntsOEMlFsah0Ii+ve+07Y76zgwo3ks28=; b=WkHcArskJti7RPa+RSbl7S70yvObwi/inTmOTfVHN+nFeZwOHKSi5DER6W8mdBdIOT okljRL9sDJQwf/izjI8etRFPFGa4LSY483KuHFe/THr5NFToxv0JUXGBZl+EqhB5jTA6 yXmhTkR/ZLf+ps3ZlDYQkt7yy4dKQcG5pS76jebs8o+Bi33n+CFBDkYDQm8WiO5Y9PV4 oaWqqKOr1DQaNPvuPcbIApnmXe65/n9YM7IN33E7fUmaPieIdAKUyGiuMiQn7pPl/2t3 E5P4/+GjykdCi64ShYgnyc7JL5e2Vq7PA8fP7SgZKUdOMapgtxa2v3iEIoBgqSNv1rBe LIDg== 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=EbyEsk7nlJHntsOEMlFsah0Ii+ve+07Y76zgwo3ks28=; b=hT8Zz+k5YYO5abYwptA/5LV33F66fgyi9iZaUfqQ2PDBokVprRuu2PI5+Dfn9xcplL bSg8KDB6ZVxWGx5LtlcJx3yMMBUhDOihC2SBm2yQ5tclz7mlX9GGNPLcpvPMl2s/odb4 wz/59E7HEGDVTiycI/UKaXpEZqUvUVbU85ylMoML7oJXcQKAysCnmhM2FAei4pYZb2/S 0wVs1zgeDmt5Mv9LwVg1U024BG+H7iSJrIta+60XObEryMFc0g/FAZgCYEiFWwBUJt9x 5VxeNuDYMInKKd7hxxvMXDyT0wROsJ4DSAcoDxdLPTZv4CVntZrO/j54Enub3YLhC3K/ EMVA== X-Gm-Message-State: AOAM531EJH+HdLNY4zOqPOKiHGmq00xGkNRwf4xCCVFmlS1OLdppCK6Q d01lctzxk7I9zRL2Fy8Yzc4= X-Received: by 2002:a37:62cc:: with SMTP id w195mr17097619qkb.33.1596854376660; Fri, 07 Aug 2020 19:39:36 -0700 (PDT) Received: from vultr.guest ([66.42.85.36]) by smtp.gmail.com with ESMTPSA id n33sm7818702qtd.43.2020.08.07.19.39.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Aug 2020 19:39:36 -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 v8 11/18] perf ftrace: add support for tracing option 'irq-info' Date: Sat, 8 Aug 2020 10:31:34 +0800 Message-Id: <20200808023141.14227-12-changbin.du@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200808023141.14227-1-changbin.du@gmail.com> References: <20200808023141.14227-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 fca55ac55ff3..37ea3ea97922 100644 --- a/tools/perf/Documentation/perf-ftrace.txt +++ b/tools/perf/Documentation/perf-ftrace.txt @@ -79,6 +79,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 b4c821be4fb5..d1241febe143 100644 --- a/tools/perf/builtin-ftrace.c +++ b/tools/perf/builtin-ftrace.c @@ -44,6 +44,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; }; @@ -209,6 +210,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) @@ -296,6 +298,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); @@ -471,6 +484,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; @@ -660,6 +678,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, } }; @@ -742,7 +761,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