Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1381640ybt; Sat, 27 Jun 2020 06:41:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwo4VpR8GCkLDyyThb5FYYLtvr6DUn7zZhh2SzWh2pHjwUqj5fw/rMne5pHS8VN6gVX7MI2 X-Received: by 2002:a17:906:a0c8:: with SMTP id bh8mr6018494ejb.190.1593265307323; Sat, 27 Jun 2020 06:41:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593265307; cv=none; d=google.com; s=arc-20160816; b=QbEpjwvlvSI7SxmXdOpKmyzguv5snAhrTdQ8ZntC7FES5iExtaUkTEDiSZCpIhsSZM ecfKtHJg176d6NotNzTxDk/1rHlZwez0mHdqsygR4fAKH1H5k/t5Ff3ewfr18Iq/EuJQ go3biKg366Epk7paVBQTB74HQClAcC9Ckyq5Q9g2+IH0WaJtReVM9LZWSVwLHjvZA/Ef HU/ZWV5qxTG1UbhikB5orcz09RJkUVqrWzKgDNn3QwjCQI1AjVzMOPvYxTToIkdm7LJr Hkr/ZF2B0kQxQifqFW9Ija4iNqaR5B0hZ3ONxj/sgs9dRPT5rU1/dNI54Q1T8d/MXaU4 9Uag== 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=yU6gt4VEMD8sdwbXjlPOd/0aIjuAkcKiJZIXO4mnnmI=; b=M75byCA6WMvcYpfHfgMIU0cOvDKL3cx8IXI1vBm0S4lMQW15IrHMZvxQB6X+zx4FTe kmDpds895WD7L3YrS6LjByEb5Pd9XMP7AoXf+NxsVZivAMQvldzlOawb7VwoKeJ/5u7s LHtKTkqBRQohvCb0B2iZ4bVhroEW2nXta7AuFJfpv8ZnopzE0PxMHAfENTVtHNkIapwN irlQyvmcO/d0jFdwnJ78KFy+5dgpD06Wwu4ux+6vBIobhHN2BsL7EejoiSzNFWSe61Xj beGqBdpqqO722rt8q450Lasj84tt81uIDwD9QsH6AKFSjEmz2mNfZzN0O6Q/DkXaELN4 gOew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DZhISPqL; 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 x70si6272489ede.405.2020.06.27.06.41.24; Sat, 27 Jun 2020 06:41:47 -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=DZhISPqL; 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 S1726887AbgF0Nil (ORCPT + 99 others); Sat, 27 Jun 2020 09:38:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726576AbgF0Nii (ORCPT ); Sat, 27 Jun 2020 09:38:38 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54B43C03E979 for ; Sat, 27 Jun 2020 06:38:38 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id f6so2086850pjq.5 for ; Sat, 27 Jun 2020 06:38:38 -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=yU6gt4VEMD8sdwbXjlPOd/0aIjuAkcKiJZIXO4mnnmI=; b=DZhISPqLfic1EPi/eiDN2pEicUiE0mFwQdWxtIXDrTNMvmuBKQzOGyB97PH3j+YHw/ 88CJkdzvNcgoxVTN2vEhwI5YtzYW6NWmZav1I1ULhNhBVkD6F/Ks5yV8tzsHsF2VJ3cm qZGJ5Cga2mwB4bz3sLbe1iFDJzlByoixLKGwLQDPFjgWiHGi2XyDRPfhLPCz+8k3TfMM 8Ykn4ucsJZ62TLtkMSKI//YUjFi7erGyYN11VBBecXjKSt5s8J76pB+bhuWZBHIkpBP/ qm2ZZjgeXsr90k9F8SCo7D3W/o0z5IR0p2F6EuunQTaBY5BO1etgDLzlod8V9F+2Mp9N B9gA== 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=yU6gt4VEMD8sdwbXjlPOd/0aIjuAkcKiJZIXO4mnnmI=; b=CANYclCRRyxAScnFEOOl6qO7tBDfjb9oZk/jlWqZO8Dc7D1cQagi4R5hDIV8PacWne llMwKodN6GCStAR+zVSABHdKv4+IXTwutpikowwYvs4Pe8rncPqCPxnhr/D9rW1NhqWP OOFYzRjQ/3nakuEyunvKDiXAGCHtpQvFp6of665PEBPwOqRYaHkLtrWlQOsDrcZF8Uba c1KaOqpzKHut+CNlLpbLwV9Q6FTMHWSMCTj3x+ldAWM/yRHxdqjwJt4Wmil22LbJ9AiN X4QApHPuxoO7Hzg7I8cEV95TnodLltqYOgydHnIAZchJTiCrscRoM0zrjuMtgL1oa2/0 jNDg== X-Gm-Message-State: AOAM530yFY3sbDpPRGJFIV/3TS1X5W3mrt1uR0wzJJZbyUPiLMR846/D hXLnh5xSISMuCwnz1cOcPwk= X-Received: by 2002:a17:902:8c84:: with SMTP id t4mr6503522plo.315.1593265117938; Sat, 27 Jun 2020 06:38:37 -0700 (PDT) Received: from vultr.guest ([149.248.10.52]) by smtp.gmail.com with ESMTPSA id x8sm15060086pje.31.2020.06.27.06.38.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Jun 2020 06:38:37 -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 v2 12/15] perf ftrace: add support for tracing option 'irq-info' Date: Sat, 27 Jun 2020 21:36:51 +0800 Message-Id: <20200627133654.64863-13-changbin.du@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200627133654.64863-1-changbin.du@gmail.com> References: <20200627133654.64863-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-irq-info' option. Signed-off-by: Changbin Du --- 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 b616e05d5156..3c9eb044b7eb 100644 --- a/tools/perf/Documentation/perf-ftrace.txt +++ b/tools/perf/Documentation/perf-ftrace.txt @@ -84,6 +84,9 @@ OPTIONS --func-call-graph:: Display kernel stack trace for function tracer. +--func-irq-info:: + Display irq context info for function tracer. + -G:: --graph-funcs=:: Set graph filter on the given function (or a glob pattern). diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c index 876c8e800425..0a1e481b66a0 100644 --- a/tools/perf/builtin-ftrace.c +++ b/tools/perf/builtin-ftrace.c @@ -42,6 +42,7 @@ struct perf_ftrace { unsigned buffer_size_kb; bool inherit; bool func_stack_trace; + bool func_irq_info; bool graph_nosleep_time; bool graph_noirqs; }; @@ -204,6 +205,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) @@ -291,6 +293,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); @@ -465,6 +478,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; @@ -661,6 +679,8 @@ int cmd_ftrace(int argc, const char **argv) "do not trace given functions", parse_filter_func), OPT_BOOLEAN(0, "func-call-graph", &ftrace.func_stack_trace, "show kernel stack trace for function tracer"), + OPT_BOOLEAN(0, "func-irq-info", &ftrace.func_irq_info, + "display irq info for function tracer"), OPT_CALLBACK_DEFAULT('G', "graph-funcs", &ftrace.graph_funcs, "func", "trace given functions using function_graph tracer", parse_filter_func, "*"), -- 2.25.1