Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2029445ybh; Fri, 17 Jul 2020 07:39:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4VJ+k8Olh76DShDZu7mgNJ6yMVmjNZXKsCnVYiGGmgZ+fvZuq0Z2aMizt0Nne59OWjgGs X-Received: by 2002:a17:906:7f90:: with SMTP id f16mr8703422ejr.507.1594996767367; Fri, 17 Jul 2020 07:39:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594996767; cv=none; d=google.com; s=arc-20160816; b=Rza1viZBRlgw0vI6krbrHrkTZ5lE7xXzeTWD0QhlrRGKuSngpx4sj7rtTwDi9w2aZP T3XPVnj3tVbOhPn3p68SSkHGASZOH3rDJ5NOtsMTR5UV9IlcLwjPm7g2eVXUeVR4mdfM aeMwP8G+U3vOkwm2NeJHXIcsT4hLX8TNnFSZ9xQ4ixXcrOxYvFwgRm0AUUUWJINi//sT cAVl3MUgoIsVl/OStivs7ZvJy6hLz8QP7i5tfUKhnRjq2PrqLwMvRtTJ18Zx1QGRYknf 4nmY6woh14tzUBLfR4agONwtkGDxY2bLVmsokk9H//XwWzeQ0DgiTCSmQq6wKoCARE47 uUiQ== 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=SCBLcrGRp+pdOgjKOYl4FCLc+/ip6fXMEGxXzBrd2Vs=; b=W77CTJ6DMhKbvrSJrPkDmSlYw+9r/heHWnhbxTEP5YMTpDDxYEfYifo/fTI6ATeJBP 3DswmHv1opwS4WENdiR6/dxwHq3dueCsLauMLPDyYhF605MvGj3GGnDwQQtCmOZdjdmG E7zOa14GWksslSn4LtxbdxWL9HYHK6TZ4xc0H94mHFLJc89RYTThCDp/1WqEf9b6jDuG kzA5hbUw0v8FeZwAAOYM/bC4AUfBJfMbashsUEtK/ryx+cC5nd/m5gruaMzgHOHamUsF uPQggWs/DoQhO7kqX/gd4OR4RxVev8otPlFRulffOUC91e05i7VzHsJYWkCf1jOd5Tx/ 90Tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mMOWGTNN; 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 a5si5269787edy.550.2020.07.17.07.39.04; Fri, 17 Jul 2020 07:39:27 -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=mMOWGTNN; 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 S1727840AbgGQOiL (ORCPT + 99 others); Fri, 17 Jul 2020 10:38:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726201AbgGQOiK (ORCPT ); Fri, 17 Jul 2020 10:38:10 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBF78C0619D2 for ; Fri, 17 Jul 2020 07:38:10 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id s189so6745971pgc.13 for ; Fri, 17 Jul 2020 07:38:10 -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=SCBLcrGRp+pdOgjKOYl4FCLc+/ip6fXMEGxXzBrd2Vs=; b=mMOWGTNNn+pgk5njSD+N2N2YUDy6thYRO5s9ZE1B6IqFTW7DzthTYR84hZ0ANQ/+Wa aMM1ZnokRmLP4tQdCmsoDQF3Z+cArMFhv14wU87ixwS3eZ6i7+Viz+rBiINB34rerXBm on+ERIP4rCX0NUIVXLF//5eEQ9LjUTNGgHM9bSZDuKXz+tfpOcwjDSZnLyAcfD6HUeoZ 8Fgev+Jk6re6NemP51P/X4ghUgon0OcJbBm+VwX4mqwlxX0uKXD7XjtizHP/p/ML7p1d naRvJ4doER1mUAWMEVrLS0hrdVlPeRtVyMqCWPHyZdyZAdtAfy3WyiaHmGjI+ewa/uhF H+7w== 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=SCBLcrGRp+pdOgjKOYl4FCLc+/ip6fXMEGxXzBrd2Vs=; b=fknHxs2Kj3KpX3wa9ZOwbchiyRMigFI+KFawpLnuRuaGBjHnwP0wF02s8QBeqcz8SA 0gV6sT9CwP0EslRfOYRpuUGx1i4YUSSPTpET3/FwNDd5XGyAnVO2WqQr8Q3zV7DVHFdW tBJkHl6nJOKbqVovJo5SURU1ZYYz6jkhwLs+nlmdyJSRAI30NhVat9rtxUxCvzsgwb7U VaDYwF/LFwY+Elsc7TI21wLVtAEA1Oth7Q/ylKnRLQf/513MlKFBU6rpo4fbpQpm4oSN XYPoHsTQu59Yrod9EAlp5wFN7Qh8PUabnU/6I3EMES19OsS2/nMeeCE7ahqtcdzEbDMz JHVg== X-Gm-Message-State: AOAM533Vp1OA/530yxoBfXwcR+yHZ3pGxP+yiHRJOdUbrW1FRJFz2uQE LxAX9IWt3FP7VAxJ++x/wClOLeFKpkw= X-Received: by 2002:aa7:9ec5:: with SMTP id r5mr7881849pfq.86.1594996690399; Fri, 17 Jul 2020 07:38:10 -0700 (PDT) Received: from vultr.guest ([149.248.10.52]) by smtp.gmail.com with ESMTPSA id a68sm3214689pje.35.2020.07.17.07.38.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jul 2020 07:38:09 -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 v6 11/17] perf ftrace: add support for tracing option 'irq-info' Date: Fri, 17 Jul 2020 22:36:22 +0800 Message-Id: <20200717143628.47721-12-changbin.du@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200717143628.47721-1-changbin.du@gmail.com> References: <20200717143628.47721-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 21d3b444587a..3ab1fe040994 100644 --- a/tools/perf/Documentation/perf-ftrace.txt +++ b/tools/perf/Documentation/perf-ftrace.txt @@ -77,6 +77,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 6402df3984c0..95d87c5966ad 100644 --- a/tools/perf/builtin-ftrace.c +++ b/tools/perf/builtin-ftrace.c @@ -42,6 +42,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; }; @@ -207,6 +208,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) @@ -294,6 +296,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); @@ -469,6 +482,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; @@ -659,6 +677,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, } }; @@ -724,7 +743,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