Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2081366ybt; Thu, 2 Jul 2020 23:46:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwF8klP9UKVOr2pGEQongNWiOagrwJGePV8oa1jETM7v2jNddVYzyyfu0oem2ZjbovtZTzy X-Received: by 2002:a17:906:b45:: with SMTP id v5mr29934708ejg.464.1593758811443; Thu, 02 Jul 2020 23:46:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593758811; cv=none; d=google.com; s=arc-20160816; b=Y4ymfBIYU7OVuLakFa5rqJmn3zzNCMLZYF4v7Mhhmu5lLc00+wHDNlujPfv8gxr2r8 ftln3tDflOh9Qrz0ipknq/5JdvakDK9omVRXd4uQWxwjsiPnqernCetpqtSnBwSXRCOu bj8J6mI4dty+hvXKJTvFxqQtqSZOl2fcRdxaV8eCvCjCLchJ2Rse0agCqcbIBSHLArFv 3ekSaumoyJ/78YDTXAThjlcQLqDsdAsHjEJHgfEAxFnNq0sbv09nqyJQNQFQQLgXAe9L ONY8WZYBnVBXDNyI7ilSZqK7s/6l6vjl0AFwIr9Q7PkVud9Jd9R/IQwZeJ/JnDicpk/l +w0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=MZq9MpoAdPD5UWC2CLSSHKSsbw3XN/pMdjELns1KMFw=; b=yk6iRiQtqrxLBC7AQRB7MhdjkI11nvkX2toq+hmLpa5kdEK3TwxaybDKx1jqy8NuVa KOKdFiXLLtktP7MRPOC1LOevP+PnXaFjROGaKK1Mq0wD/oFhqWK0hCJJ1PghEz7Bmqzc +x53AoH+usWlMyG5WDMPh2D+eHvYk7rnfFfFySeKTXOziNXj/N2Gf3LkK1fC0h2l7E2B YutwI5/rG+jK0K5VkgYGWGGvmgZJYVCwlACymYBRigZKVzf4V2R14dsVzx9fy/ujqrpK UayYs+zVeEOcPixcFQkt6JtBgGngAdQWZ/4pdtKPrCrx+GlBsZiii5Lt615rNUJVe4p9 D5MA== ARC-Authentication-Results: i=1; mx.google.com; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q23si7905824edg.348.2020.07.02.23.46.27; Thu, 02 Jul 2020 23:46:51 -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; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726352AbgGCGn5 (ORCPT + 99 others); Fri, 3 Jul 2020 02:43:57 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:40106 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725764AbgGCGn5 (ORCPT ); Fri, 3 Jul 2020 02:43:57 -0400 Received: by mail-wr1-f67.google.com with SMTP id f2so3475430wrp.7 for ; Thu, 02 Jul 2020 23:43:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=MZq9MpoAdPD5UWC2CLSSHKSsbw3XN/pMdjELns1KMFw=; b=sEI8wb0hQJcZPG9WsqrQS5qN++mvDXOlA9DGBKG9FXAKqMJpCG7LgrFaxB0EDYGzxj Tc7zZYg2VCch5o0fJg21MmzFiqGSkO+dkU6xo9LlXYj8JrmtGDniWbZjyOJhm0pMTOSY uOemfL4wHAh/TAKCEWKMa3ca3FuywBxanJH/BfpgmAyduWQFk0qTcI3Z9EfileeyLjvJ c6hEjReVYvmqPaxbC4JvGTA3Tvj+xSedyK+9l//9ABTbgkj7lPywNvua6gytPGDsWUeR Bs+bvZ+avsELrlSxm8ON8sw8i1fXKUFJcpi2MVF+aWpW9aA/doaOJGL4dPZS5ZtoKGK/ 5Vog== X-Gm-Message-State: AOAM531/69o8tBGG9vwNlfqT5q8jFjilG/ajHw5Zo588pM6Y5eduiJaq O8i3azOg9mydhB98ZphWzg7krjzTRnIhWnavKxM= X-Received: by 2002:adf:fcc5:: with SMTP id f5mr39041360wrs.60.1593758635438; Thu, 02 Jul 2020 23:43:55 -0700 (PDT) MIME-Version: 1.0 References: <20200627133654.64863-1-changbin.du@gmail.com> <20200627133654.64863-12-changbin.du@gmail.com> In-Reply-To: <20200627133654.64863-12-changbin.du@gmail.com> From: Namhyung Kim Date: Fri, 3 Jul 2020 15:43:38 +0900 Message-ID: Subject: Re: [PATCH v2 11/15] perf ftrace: add support for trace option funcgraph-irqs To: Changbin Du Cc: Jiri Olsa , Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Steven Rostedt , linux-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jun 27, 2020 at 10:38 PM Changbin Du wrote: > > This adds an option '--graph-noirqs' to filter out functions executed > in irq context. Ditto. > > Signed-off-by: Changbin Du > > --- > v2: option name '--nofuncgraph-irqs' -> '--graph-noirqs'. > --- > tools/perf/Documentation/perf-ftrace.txt | 3 +++ > tools/perf/builtin-ftrace.c | 20 ++++++++++++++++++++ > 2 files changed, 23 insertions(+) > > diff --git a/tools/perf/Documentation/perf-ftrace.txt b/tools/perf/Documentation/perf-ftrace.txt > index a3000436f80b..b616e05d5156 100644 > --- a/tools/perf/Documentation/perf-ftrace.txt > +++ b/tools/perf/Documentation/perf-ftrace.txt > @@ -107,6 +107,9 @@ OPTIONS > --graph-nosleep-time:: > Measure on-CPU time only for function_graph tracer. > > +--graph-noirqs:: > + Ignore functions that happen inside interrupt for function_graph tracer. > + > SEE ALSO > -------- > linkperf:perf-record[1], linkperf:perf-trace[1] > diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c > index eba125a60820..876c8e800425 100644 > --- a/tools/perf/builtin-ftrace.c > +++ b/tools/perf/builtin-ftrace.c > @@ -43,6 +43,7 @@ struct perf_ftrace { > bool inherit; > bool func_stack_trace; > bool graph_nosleep_time; > + bool graph_noirqs; > }; > > struct filter_entry { > @@ -202,6 +203,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) > @@ -393,6 +395,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; > @@ -477,6 +490,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; > + } Why not add set_tracing_options() which calls these individual functions to handle option processing altogether? It seems consistent to its 'reset' counterpart. Thanks Namhyung > + > if (write_tracing_file("current_tracer", ftrace->tracer) < 0) { > pr_err("failed to set current_tracer to %s\n", ftrace->tracer); > goto out_reset; > @@ -658,6 +676,8 @@ int cmd_ftrace(int argc, const char **argv) > "trace children processes"), > OPT_BOOLEAN(0, "graph-nosleep-time", &ftrace.graph_nosleep_time, > "measure on-CPU time only for function_graph tracer"), > + OPT_BOOLEAN(0, "graph-noirqs", &ftrace.graph_noirqs, > + "ignore functions that happen inside interrupt for function_graph tracer"), > OPT_END() > }; > > -- > 2.25.1 >