Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2029427ybh; Fri, 17 Jul 2020 07:39:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwki+EhHN/bjTaIWU+2m81ox74a4piFL2piI8VCggOosWU0P8kHF60CzB5RTHqZU7BQrRuU X-Received: by 2002:a17:906:1254:: with SMTP id u20mr9283746eja.540.1594996765675; Fri, 17 Jul 2020 07:39:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594996765; cv=none; d=google.com; s=arc-20160816; b=MfyC01zSupJvsfCp7cw9SDgw7NTrc5tpnFThst/tddJaFrBj/cdKmorDNjeFNSETuh LLV5qRI7uKEzxyc8pirp5NMsgoBeGLcYNIENQ6PWaEkLpJ4vbTp7mids7HvD1qxU5fLn eiJ/PQs/AQXWKinf8I0xM3ltAa7Q93yqxmVjkeWVNbd7uFKCQlQ8crFqML8AqETQOj4X LeCIqHiBUfN17tas0eo/IPogfjn7vk3YlM+nkXhLxOebmn5TIf/QQbdT0V4rFGyVIxYe puVQXSTY5UjtbiePG4cXrH+NiE4EJVTQfHEfq9KF1iLNxjIba/ETMZY8EtAdSB57znLo ehGA== 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=CPCZkzgvYsNx67LrNj9/kDqAKiM3/VI4Z3LHYpW0hPM=; b=ekw45M0Ajvj6GIknmNTHRtpifBQvnL2ZznthHEdRas/FTBWi2ZcK9I/UMaiUAvw/Th lI3v3N/OiQbO0fkfGmAM0nxnqFBAZvxg/E9K10DE73xVTwlF6GWoIyenLTGDUBPoULzI 2UILqDfzG3Vn2OGQgmL1QNzf0BOLR4ScrE5zBHiyVhwniWqKykizFym6GgmX7BgYExJO L4RMhKIG/xZeb/J9mtLY8Cq/474y51y7RcoJQW0DA+zkqEmNudbuLOv5h+QOn4fKE6iu 55+aBDRAL008WYpCqysUxtwSgIPBh4Pd8bM5TmJMg2Lv2exEb43bCtwpvseglZY9lNP5 v6ZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=e4A5RSHJ; 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 s27si5208975ejd.181.2020.07.17.07.39.02; Fri, 17 Jul 2020 07:39:25 -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=e4A5RSHJ; 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 S1727820AbgGQOiF (ORCPT + 99 others); Fri, 17 Jul 2020 10:38:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726201AbgGQOiE (ORCPT ); Fri, 17 Jul 2020 10:38:04 -0400 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 858BCC0619D2 for ; Fri, 17 Jul 2020 07:38:04 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id o13so6777529pgf.0 for ; Fri, 17 Jul 2020 07:38:04 -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=CPCZkzgvYsNx67LrNj9/kDqAKiM3/VI4Z3LHYpW0hPM=; b=e4A5RSHJzLKYYmJIAuDtrFFUsjcVRNq/2nWdZ6hWoALGfeYSv+A9PrfkR805dg5FvG UkGtCo80/8Afl/K4AObFhfOzR1ZIJztSlr3u9DkeHsoW794RUpjDv1l4KEzIDzv4DSiJ f2DtDt4ikbqncwNxBON5b/RjolYNu47H1hwKhwnufBM4MIo/+I8nr/IL47rFSOiSgHy3 QGhtQ9675XB4iM3xG8nnrb6CONH/F2V4wq+gwIQg3JTpt+NnnA5X7nyTpkVf773137tO ALhRGQvCZPAabOtCRSKirAJcQcRH5//mOZKRnzqprOabFW9PW0s3SvbJ6TXT0wK48bRn jIyQ== 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=CPCZkzgvYsNx67LrNj9/kDqAKiM3/VI4Z3LHYpW0hPM=; b=q9yUVF54Dck2LPJ2b9kCfQM8LgALLs5ur0C0dqJqZphre28CuBrrwOPgM8rgNeOg8P E1hTo0iHuoWwU2gnLHJexvThmgN5BTOaoql9dNmLETFBEvhK7AqojoHYIk131f8fUx4r c+o0ZKV2gbIJvVSQMkDn7JJ/LyfFfHRDTuyObF7hPpoHpa096q+5vrGziWrA0Ryi/MN4 vpgcrCVDiugkIJZO2zP/f7Jgdai4sMOjT3DqXyHgfR6RiRiCtFXCLdcqbYgnJFQNcP+z TMoQWia4iJv9xR7Bfcy3+mcHdqCi6LHbro04V7BkHQOYY3C+GhhM7YGl9xHq78bUXire eMFQ== X-Gm-Message-State: AOAM531KbrQ7YSsIysUYT9GCE3u/RSq1j6Wl0/J8GYOmigFhK4cF4cn2 fPxtY1lWH2K5YOt9kfkUYRU= X-Received: by 2002:a63:7c42:: with SMTP id l2mr9192309pgn.35.1594996684084; Fri, 17 Jul 2020 07:38:04 -0700 (PDT) Received: from vultr.guest ([149.248.10.52]) by smtp.gmail.com with ESMTPSA id a68sm3214689pje.35.2020.07.17.07.37.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jul 2020 07:38:03 -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 10/17] perf ftrace: add support for trace option funcgraph-irqs Date: Fri, 17 Jul 2020 22:36:21 +0800 Message-Id: <20200717143628.47721-11-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 an option '--graph-opts noirqs' to filter out functions executed in irq context. Signed-off-by: Changbin Du --- v2: option name '--nofuncgraph-irqs' -> '--graph-noirqs'. --- 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 2968a34239a4..21d3b444587a 100644 --- a/tools/perf/Documentation/perf-ftrace.txt +++ b/tools/perf/Documentation/perf-ftrace.txt @@ -101,6 +101,7 @@ OPTIONS --graph-opts:: List of options allowed to set: nosleep-time - Measure on-CPU time only for function_graph tracer. + noirqs - Ignore functions that happen inside interrupt. SEE ALSO -------- diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c index 835f810985f0..6402df3984c0 100644 --- a/tools/perf/builtin-ftrace.c +++ b/tools/perf/builtin-ftrace.c @@ -43,6 +43,7 @@ struct perf_ftrace { bool inherit; int func_stack_trace; int graph_nosleep_time; + int graph_noirqs; }; struct filter_entry { @@ -205,6 +206,7 @@ static void reset_tracing_options(struct perf_ftrace *ftrace __maybe_unused) write_tracing_option_file("function-fork", "0"); write_tracing_option_file("func_stack_trace", "0"); write_tracing_option_file("sleep-time", "1"); + write_tracing_option_file("funcgraph-irqs", "1"); } static int reset_tracing_files(struct perf_ftrace *ftrace __maybe_unused) @@ -397,6 +399,17 @@ static int set_tracing_sleep_time(struct perf_ftrace *ftrace) return 0; } +static int set_tracing_funcgraph_irqs(struct perf_ftrace *ftrace) +{ + if (!ftrace->graph_noirqs) + return 0; + + if (write_tracing_option_file("funcgraph-irqs", "0") < 0) + return -1; + + return 0; +} + static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv) { char *trace_file; @@ -481,6 +494,11 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv) goto out_reset; } + if (set_tracing_funcgraph_irqs(ftrace) < 0) { + pr_err("failed to set tracing option funcgraph-irqs\n"); + goto out_reset; + } + if (write_tracing_file("current_tracer", ftrace->tracer) < 0) { pr_err("failed to set current_tracer to %s\n", ftrace->tracer); goto out_reset; @@ -661,6 +679,7 @@ static int parse_graph_tracer_opts(const struct option *opt, struct perf_ftrace *ftrace = (struct perf_ftrace *) opt->value; struct sublevel_option graph_tracer_opts[] = { { .name = "nosleep-time", .value_ptr = &ftrace->graph_nosleep_time }, + { .name = "noirqs", .value_ptr = &ftrace->graph_noirqs }, { .name = NULL, } }; @@ -715,7 +734,7 @@ int cmd_ftrace(int argc, const char **argv) OPT_INTEGER('D', "graph-depth", &ftrace.graph_depth, "Max depth for function graph tracer"), OPT_CALLBACK(0, "graph-opts", &ftrace, "options", - "graph tracer options, available options: nosleep-time", + "graph tracer options, available options: nosleep-time,noirqs", parse_graph_tracer_opts), OPT_CALLBACK('m', "buffer-size", &ftrace.percpu_buffer_size, "size", "size of per cpu buffer", parse_buffer_size), -- 2.25.1