Message ID | 20230404230308.501833715@goodmis.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp214225vqo; Tue, 4 Apr 2023 16:17:20 -0700 (PDT) X-Google-Smtp-Source: AKy350ZUBazWl5ZIITnseB7phCj/OT05SYR3KxCzzvd8P7sQVjken360GaT8zcWPIMLUqkDaMJNV X-Received: by 2002:a17:902:cecc:b0:19a:ad2f:2df9 with SMTP id d12-20020a170902cecc00b0019aad2f2df9mr5326243plg.55.1680650240463; Tue, 04 Apr 2023 16:17:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680650240; cv=none; d=google.com; s=arc-20160816; b=06rNdMF6HN9B/DQJpT3RSyfCaKKzDfRiLXHk/LwqGOwF7lsQHjWHo8wXnuXejjvzCW BKMHfv0dciL87NfZrAYUISnqu/aZbxyP/gqvL8qpDBs/Aja9tIwNidT0ULqmxNsk1eOi lqBZ2kjXA2Sj1h5JZQGuhaz25+w2pnqqfgMnakWkUUQg1nsWrldh0cw1M+YIjSC1/Dq0 Asz7Pi+CWNpKjtWdRNzw9b4i0bGw6iDG+akf348rQ949VCTgL8rictamcCYHN9ehzXI5 z0j2ck7Sdp89okwM3Smf8n/XwAOmaERkkYFOuLtgw2Dc1JnGe2GPfqtSK/tObANOwIj9 zN4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id; bh=0PifspPBUKfrlV/ddoeq2uq1YgBiGycNuJkereXOS9c=; b=Gm873KJJX4u9nT5YEb9pIFsI/W+0TmVctHl5jcZm0BhNR+/+2hkQS+i5nHKUwhJhoq KarmO8R5PdSRGlGI6l5G3EvQhPtSndHDOH6iYlnbjrBoJRjZeA2StJssNlwfGdFcGSlF D3DmtVarwG+eBHHqAD0Df3LywT/N5vtuIalAR68imeMFv7gkSZZWZ8EBhmr+mBVfz1oa TY36pnnD+GIXBSK93bqhnBqOxmTA+1a7ioXBaqVTkM5ZdHcVPMKzxhfvIKHB3h/rC1NB Eju2qrg7FLlXM3DPmdvXs7mYFVHF3Fyo+J62q+Yw02Qd/ApXdmuANJsH2yzc42S34fBy oMvA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 31-20020a630e5f000000b00507766aea63si10745951pgo.864.2023.04.04.16.17.04; Tue, 04 Apr 2023 16:17:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236682AbjDDXDR (ORCPT <rfc822;lkml4gm@gmail.com> + 99 others); Tue, 4 Apr 2023 19:03:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236398AbjDDXDM (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 4 Apr 2023 19:03:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D7FF1999; Tue, 4 Apr 2023 16:03:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4E278639A7; Tue, 4 Apr 2023 23:03:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A95A8C4339B; Tue, 4 Apr 2023 23:03:09 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.96) (envelope-from <rostedt@goodmis.org>) id 1pjpgC-000emM-2F; Tue, 04 Apr 2023 19:03:08 -0400 Message-ID: <20230404230308.501833715@goodmis.org> User-Agent: quilt/0.66 Date: Tue, 04 Apr 2023 19:00:13 -0400 From: Steven Rostedt <rostedt@goodmis.org> To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Cc: Masami Hiramatsu <mhiramat@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Andrew Morton <akpm@linux-foundation.org>, Ross Zwisler <zwisler@google.com>, stable@vger.kernel.org Subject: [PATCH 2/2] tracing: Fix ftrace_boot_snapshot command line logic References: <20230404230011.757302390@goodmis.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Spam-Status: No, score=-2.1 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762289506473740423?= X-GMAIL-MSGID: =?utf-8?q?1762289506473740423?= |
Series |
tracing: Fix ftrace_boot_snapshot command line
|
|
Commit Message
Steven Rostedt
April 4, 2023, 11 p.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org> The kernel command line ftrace_boot_snapshot by itself is supposed to trigger a snapshot at the end of boot up of the main top level trace buffer. A ftrace_boot_snapshot=foo will do the same for an instance called foo that was created by trace_instance=foo,... The logic was broken where if ftrace_boot_snapshot was by itself, it would trigger a snapshot for all instances that had tracing enabled, regardless if it asked for a snapshot or not. When a snapshot is requested for a buffer, the buffer's tr->allocated_snapshot is set to true. Use that to know if a trace buffer wants a snapshot at boot up or not. Since the top level buffer is part of the ftrace_trace_arrays list, there's no reason to treat it differently than the other buffers. Just iterate the list if ftrace_boot_snapshot was specified. Cc: stable@vger.kernel.org Fixes: 9c1c251d670bc ("tracing: Allow boot instances to have snapshot buffers") Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org> --- kernel/trace/trace.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
Comments
Hi Steven,
kernel test robot noticed the following build errors:
[auto build test ERROR on akpm-mm/mm-everything]
[also build test ERROR on linus/master v6.3-rc5 next-20230404]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Steven-Rostedt/tracing-Have-tracing_snapshot_instance_cond-write-errors-to-the-appropriate-instance/20230405-070406
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/20230404230308.501833715%40goodmis.org
patch subject: [PATCH 2/2] tracing: Fix ftrace_boot_snapshot command line logic
config: arc-buildonly-randconfig-r003-20230403 (https://download.01.org/0day-ci/archive/20230405/202304051001.dL3Fvaxd-lkp@intel.com/config)
compiler: arceb-elf-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/ac5e916ec8d65b5e0c13719694efd3084105f416
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Steven-Rostedt/tracing-Have-tracing_snapshot_instance_cond-write-errors-to-the-appropriate-instance/20230405-070406
git checkout ac5e916ec8d65b5e0c13719694efd3084105f416
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arc olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arc SHELL=/bin/bash kernel/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304051001.dL3Fvaxd-lkp@intel.com/
All errors (new ones prefixed by >>):
kernel/trace/trace.c: In function 'ftrace_boot_snapshot':
>> kernel/trace/trace.c:10402:24: error: 'struct trace_array' has no member named 'allocated_snapshot'
10402 | if (!tr->allocated_snapshot)
| ^~
vim +10402 kernel/trace/trace.c
10393
10394 void __init ftrace_boot_snapshot(void)
10395 {
10396 struct trace_array *tr;
10397
10398 if (!snapshot_at_boot)
10399 return;
10400
10401 list_for_each_entry(tr, &ftrace_trace_arrays, list) {
10402 if (!tr->allocated_snapshot)
10403 continue;
10404
10405 tracing_snapshot_instance(tr);
10406 trace_array_puts(tr, "** Boot snapshot taken **\n");
10407 }
10408 }
10409
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index ed1d1093f5e9..8ae51f1dea8e 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -10395,16 +10395,15 @@ void __init ftrace_boot_snapshot(void) { struct trace_array *tr; - if (snapshot_at_boot) { - tracing_snapshot(); - internal_trace_puts("** Boot snapshot taken **\n"); - } + if (!snapshot_at_boot) + return; list_for_each_entry(tr, &ftrace_trace_arrays, list) { - if (tr == &global_trace) + if (!tr->allocated_snapshot) continue; - trace_array_puts(tr, "** Boot snapshot taken **\n"); + tracing_snapshot_instance(tr); + trace_array_puts(tr, "** Boot snapshot taken **\n"); } }