Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1168406ybk; Sun, 10 May 2020 08:12:36 -0700 (PDT) X-Google-Smtp-Source: APiQypKeEgUIijkShzTgNL7GkGH4F4j3mGyTRwqixbpuQ6SCakBVj0BgINC4Or79yTcWVimPYdcS X-Received: by 2002:a17:906:cf8a:: with SMTP id um10mr9626266ejb.60.1589123556191; Sun, 10 May 2020 08:12:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589123556; cv=none; d=google.com; s=arc-20160816; b=FmjITyRIeYcEXhT/EY0NNewehpTPKtuWigCYrQGqOcNf7oK1RHI2eajgklZzq3Dfhb xfNFIrPg8HJQ/dBnGQ3Krv6SkRU3a3SfJQgGQUTrbp5ttuOSHu8OVELk2hyrwmON0hvd NVsxUqqeHj+TSYRDcG/T7Hv3ztYzPVk91nscHlpmT5/9HTersm0B1ItGM43q7Ue+vNM2 pv41EsFudu5JcYq/9KdbdUqPnBKFlJO5xvPOTBk6I0AxsgFwsObfRSJPk+h2BKuJ2T8N pvjzd96Vf18jRfMnnwKAlshFyQh3rdLm6wxmtMp1/WF4jzmmE5oRqNem0cM7+ypPurgY d9UQ== 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=6NpM/ijFwbSoPlLQVQ01gf0hqXiBa151ApMA2ShJDAE=; b=0LgTBE2twF5Bn8H+MC7GR0V80wHOyG7y1v20AhJ8Cg1s+2fRC9b2IfRJN3EiJmKjbb qAlOqgnEUsZCR8T2XPyQohU9/xL/XiGw5N/RK4yXduhlYkuLAw7fECDsRqHZn1hDN7OY 3Qy+9O0t9fAIv02ebkWvyt3cRczOvPZIv+OvdbC/2w3u0KEClYeX8+mIUrREQaZUm+Y0 cpqbitwKw230DZ7ZKEbjmeLIafjJ/+bYvWeuivpbp4UmSUPtwKaWyxws3jqlUgKOfqHA lxwN+BKf2l3QDt/tTsVqHDegElnaZ5hrs7tKdZxF3oTFgG+6mPEtK0odNW9XaodC/c6P rr0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qyGmyvFV; 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 ch10si4432225edb.454.2020.05.10.08.12.12; Sun, 10 May 2020 08:12:36 -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=qyGmyvFV; 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 S1729206AbgEJPIX (ORCPT + 99 others); Sun, 10 May 2020 11:08:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729200AbgEJPIX (ORCPT ); Sun, 10 May 2020 11:08:23 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A7E9C061A0C for ; Sun, 10 May 2020 08:08:23 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id f15so2816179plr.3 for ; Sun, 10 May 2020 08:08:23 -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=6NpM/ijFwbSoPlLQVQ01gf0hqXiBa151ApMA2ShJDAE=; b=qyGmyvFVxdI1tt3UUACq/6PHoEQ7KstS6iicTyDfB2h6TdHVQKBOWPJJQVwa5UqlVj gwZW+Z22uCgn4Kw9Y488YJ4KINDVWmlEk+xYJ9xMduzWY6jkslwolUNI395Pmv+JO50z OHmA5HXqdbN8U1rVrf0wV6y9WGqGiI6UTHh7po5KDZGbYt2XCqvsiIhuJPAHxa20z4ji lwpLPy12QTC5M6JQKjRBdld6gbqJfG7NL+uuIUhxET6u9yxKw25Of56ReVUkalgtxTYr Q33Au/8vfyW6QbbY3QUAlRGywN1Cctvg3v+kDRGf1X4ZZOl12kk8aIlB0z8Ma/aWzErK OtQA== 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=6NpM/ijFwbSoPlLQVQ01gf0hqXiBa151ApMA2ShJDAE=; b=CpzHljfwAcdBcr+z0mscOK/BKea/2F4l1JEz2clxQ8wCSvaLv5CD8Cs+aGrpXrty8a fyBVmxyuyvw8/hj0lu0vRjD2cOuEawXmToGVJ/XGR2xbI0qzUHmbdtUe5YVec5YRaR1Y WNbDVyD3urEv3fPZ3CVqGJcArkbsORyoCCmXizOrM6TvzfP0rhJ1iLAQK0LnslKNMlTr F8ocrLNNYgq1SlRdmchXXXl6n8o8YuXqdbrc8PaGfVvt9zyUCUEDksYQs8d/x5FZV1uE YCYqOhc5szJvMpeyk+ZDVb1V4AKC0X9ShdylcmRo3dl3JkiH5O9G/8KUlhTqAqZPLNLN YIsQ== X-Gm-Message-State: AGi0PuaBrTL3ltmK7M9hoKopsvwbq1mFUwTVkIYHpq45n5GBJ0PMcNoY FBFVF6jSxRTK01Q28mwMpWo= X-Received: by 2002:a17:90a:f995:: with SMTP id cq21mr16511616pjb.56.1589123302608; Sun, 10 May 2020 08:08:22 -0700 (PDT) Received: from vultr.guest ([149.248.10.52]) by smtp.gmail.com with ESMTPSA id v7sm6870909pfm.146.2020.05.10.08.08.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 May 2020 08:08:21 -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 07/19] perf ftrace: add support for trace option funcgraph-irqs Date: Sun, 10 May 2020 23:06:16 +0800 Message-Id: <20200510150628.16610-8-changbin.du@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200510150628.16610-1-changbin.du@gmail.com> References: <20200510150628.16610-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 '--nofuncgraph-irqs' to filter out functions executed in irq context. Signed-off-by: Changbin Du --- tools/perf/builtin-ftrace.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c index d3fcf3b0b792..b16600a16efa 100644 --- a/tools/perf/builtin-ftrace.c +++ b/tools/perf/builtin-ftrace.c @@ -41,6 +41,7 @@ struct perf_ftrace { int graph_depth; bool func_stack_trace; bool nosleep_time; + bool nofuncgraph_irqs; }; struct filter_entry { @@ -188,6 +189,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"); } static int reset_tracing_files(struct perf_ftrace *ftrace __maybe_unused) @@ -358,6 +360,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->nofuncgraph_irqs) + 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; @@ -431,6 +444,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; @@ -568,6 +586,8 @@ int cmd_ftrace(int argc, const char **argv) "Max depth for function graph tracer"), OPT_BOOLEAN(0, "nosleep-time", &ftrace.nosleep_time, "Measure on-CPU time only (function_graph only)"), + OPT_BOOLEAN(0, "nofuncgraph-irqs", &ftrace.nofuncgraph_irqs, + "Ignore functions that happen inside interrupt (function_graph only)"), OPT_END() }; -- 2.25.1