Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1289987ybt; Sat, 11 Jul 2020 05:44:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw1ucb/7lG+YZwgIy+PSJdfx2WNZYPt+5FGDSF0td4wJdC8wCOR7JfzIYzpkuqbWI2ENDH6 X-Received: by 2002:a50:9e02:: with SMTP id z2mr79401002ede.87.1594471485221; Sat, 11 Jul 2020 05:44:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594471485; cv=none; d=google.com; s=arc-20160816; b=k/NHoQ+cIpXoZUTwE7NwtyQqJJMYcbDDdGDXgJ30S/bhD31dLc/7QroLijJHuZJUgZ xEJIe4fY8mdvlvcUfJtwFSvGnqDVEHNWr4gGn4x/8TdywnbUHDom/lgJO43neBsmhIK8 DLEh0nOa6wtCOe7KUQ7bnHR7K4SQfWrV4N8Ypi54z7HAcGacJRtFBC7vTBB7ui216leC AfvatHvIMNtabj4S3dz2PRfs5H8qQANQLGJOAyoSPfD4uzoDbbF2KjggAH+O/8PmJYCy GAkwJs8gwEzuMSuKqvv7jx/+rmQInJePAs4z9eDgHeWjbVddytzpsz11d+a2ftZUHQyf z1dg== 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=grZiNUXxO5Gku/+KU2rnghwGFFTqDfKaKvmZrXKFOAs=; b=Tj579cxSFb/Az4CgzsmTf5ESLMb9esTL23P2eiVTLlF4A/8+UKGC0Nu2fU/9fK8k9x SJQTp863fYXoa80EOcbrVUnR3MHx9Dr4NGJCbd4QSVTrwM5ZPCX9QE6bS0pfdPrVEc0+ SNGCsKsCv9325nPrPAYrgGDDJ+GWEgzAmIYz9bkoKr2PwoEVw7J/tq1TQ5R5i3+asGdk vyt5fd5tCQ5NCbJe5t3Yhfv8SuoX8jIY0M7pebvN5YSXXvZprUE27sDscII7IR3Aqjdi rT2sUwfj1t+DQfPw/gy/IBENIAvWVjhb3aBX26EG7kNrXxvoh7+CawoNxv0VQE5PeH62 8k3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="UzN/MWw9"; 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 ni7si5201861ejb.725.2020.07.11.05.44.22; Sat, 11 Jul 2020 05:44:45 -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="UzN/MWw9"; 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 S1728454AbgGKMnU (ORCPT + 99 others); Sat, 11 Jul 2020 08:43:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726281AbgGKMnU (ORCPT ); Sat, 11 Jul 2020 08:43:20 -0400 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E1E2C08C5DD for ; Sat, 11 Jul 2020 05:43:20 -0700 (PDT) Received: by mail-pl1-x643.google.com with SMTP id q17so3352419pls.9 for ; Sat, 11 Jul 2020 05:43:20 -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=grZiNUXxO5Gku/+KU2rnghwGFFTqDfKaKvmZrXKFOAs=; b=UzN/MWw9fN+4+7PMwmgNMlorPWVYQlIihWihfWBPfv+cI8qSofSOLBKFzHIiXsukvx kw6596WutKsHsuvnas6roMht0RNR2vGjtg19NAkG+qbJ/34MsdwM/IEWW5THmGLLJZlh hbpFG0cyj8Kd6k6OiIxPw85hmvXTZ8D/830Cw8PknmvKAcxWpxLuBLt+yPZ2PAiNjpGo YvqJKuaqcuxc6je4YNXYkY3t+diiYqNPahO/u7IMQwCRKGIOvt7z5Zp/Jt6Z3l/u7j8G dJ2LHZ5fczxwqF0s7R2GXOuB6NaYRezUxAfYjuny9h+T8gcpLFcX7O+s0IhBqNPWCjNX BQHw== 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=grZiNUXxO5Gku/+KU2rnghwGFFTqDfKaKvmZrXKFOAs=; b=AwJL04lMdsBAEgVL1KTpJq/fqT5xNxyG4DiXprDeBuPjujRwDnCb+WLEEBQ/Sx8jwx df4yFOYqPRa5xCF03gMGkC5SA/w54GIkh+EOIx0m/piRR4fs6N/HB+ZfTmMNnESP24Zc HAYtHV5NDVhz7emYMKpS/iZM6UHzoKNKBV7roNhxXY9QpwULsRbkZca1TB+iS06Cocyc +M6Rw9Zek+uTg5aXjgVAskhrZ4o5x2C36aChZHSiBmVpeGj5RXRyrkmbSjvsibrn3zQ6 BeqcDCwl2JbXWgYV1ChA9686wh5HzR14ZLjXl84x8LFBNHWuG5paxvIUASR+/44uCKYB P+2A== X-Gm-Message-State: AOAM530SL0yzJw3UXpw1c+hr/7b43sAi+VHeCVD0D/BJZJiZ/KPnMh26 chwGxMPiVtTC9oCn5sVCkTs= X-Received: by 2002:a17:902:aa0c:: with SMTP id be12mr64436744plb.45.1594471399621; Sat, 11 Jul 2020 05:43:19 -0700 (PDT) Received: from vultr.guest ([149.248.10.52]) by smtp.gmail.com with ESMTPSA id c19sm8352899pjs.11.2020.07.11.05.43.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Jul 2020 05:43:18 -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 v5 11/17] perf ftrace: add support for trace option funcgraph-irqs Date: Sat, 11 Jul 2020 20:40:29 +0800 Message-Id: <20200711124035.6513-12-changbin.du@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200711124035.6513-1-changbin.du@gmail.com> References: <20200711124035.6513-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 760c2b78c305..2e16e1e588d9 100644 --- a/tools/perf/Documentation/perf-ftrace.txt +++ b/tools/perf/Documentation/perf-ftrace.txt @@ -105,6 +105,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 b4eda459ba78..179c5da678e3 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 { @@ -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) @@ -394,6 +396,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; @@ -478,6 +491,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; @@ -658,6 +676,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, } }; @@ -714,7 +733,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