From patchwork Tue Oct 10 11:59:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frederic Weisbecker X-Patchwork-Id: 150706 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp140632vqb; Tue, 10 Oct 2023 05:01:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEveqFQPKtwbofb4acJei8WCB8jRggluJ+OBPpx510tVF2Bts4mzP562BUbBksZed+du9Vc X-Received: by 2002:a05:6a20:5482:b0:16b:afc2:3b68 with SMTP id i2-20020a056a20548200b0016bafc23b68mr14974662pzk.25.1696939279405; Tue, 10 Oct 2023 05:01:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696939279; cv=none; d=google.com; s=arc-20160816; b=ruPMJ6GIH8PxeMWZM2n+pwx0Sj8tHhPWUm1diZP7iEI9Gru/VerZj77zeR94dmUTEU /Gq094T+TBDJNgY8CdHlQ7XooanQ6vQqomHxAvYyjYttcYIyYQmvfu63bJAKK2q/Q7MC +6Hqmlw5lKOMavFg2RnlkCoS8LJzBcIZtm78TE/yBLLp+idwLxct89njVN+XuRpt+kBf UQZvMtCKyehVog1KDSxzpVtbegr/x2MCUwVNJOJ7wJGNVTvwJqwtmun5kblgaTP5F06W l9/qaRgdgRgwsIMwGcddlo/J4a9vxUkRyjrahuWHIiefA8YhE0O4IhMcRYhgym/ZtOIE 0tpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VswOKhGS5Xjk6AJ/BDbiTSDhZ4+tXsP6kauYJBBRePE=; fh=QyKVx5sQ6a0Rye+jmuSl6ocZCOg2PmQ9bDVx4c3R8jE=; b=cne1ds4x94TBNQi9WTiwsEbkA+zUn8RX87KoHxFmCxhXJtxsmsJ01HDdxeL6Olv6Qy Ot0+XAo1tdZ6nn1OgQxmvWvVeRCOs64rKPn6I6VInMrqZK2MXg9O4VKQifQh9K0irQIK OXXqveRAq4uRRmltoHMOyEqAmGR2A8xp1uc90GDzG6RTe6PqhGni+YKiD8k2IizjOytF d2evsmH+XjAiYIdipW8Ci5aUdEUWbvxM09OuoAxuYOBTiS3Tn7n1e5U6gaYAD8j/xWDY vNcHX9MBrNHJTL+F7g0qEkS667tS1pQvL+hCdFZohewj5SflLr/1bApurzPIGOzYUCBL DjHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nGu1acjQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id bx10-20020a056a02050a00b00565f611a1f8si13138620pgb.263.2023.10.10.05.01.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 05:01:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nGu1acjQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id EEB1F826EC26; Tue, 10 Oct 2023 05:01:16 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231724AbjJJMAs (ORCPT + 20 others); Tue, 10 Oct 2023 08:00:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231824AbjJJMA2 (ORCPT ); Tue, 10 Oct 2023 08:00:28 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5309C109; Tue, 10 Oct 2023 05:00:08 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98984C433CB; Tue, 10 Oct 2023 12:00:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696939207; bh=6HRXnuZZAf08Uj6BoCK0KS/GQ+u3twUB+rz7vaUHqM4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nGu1acjQr68zRAdzvRvlJ0zXkBTnIfdZhKPJ64JvOkf7eY1qKpHrPcZ/Q4CTd3nCS ciPo7Ivo3sDwTvdmQbygXimMeJY2HpZj/YXC6tXyscOt3YO9CuJBTsURFIMQnvsyYk BSlQ6ecnu08bkaZD0+3UNdL4+kb3ZUvNrbKgQRuKftvMGsko6jL8jZmxgesc9u1m55 HYJ8Fx3sxhRvYXjziLPp4EWsLRVd7DkIuNMMcf5JI75yLvdZrT4Yk2u3zK3fNCT2dG 4T/jYXj0BeUopT92Xm/tQDvS75lTxALgio8xWk15+RmM+yljAd0poVFB4YJ5p95OO3 CKNLkn/NizYpA== From: Frederic Weisbecker To: LKML Cc: "Joel Fernandes (Google)" , Boqun Feng , Josh Triplett , Mathieu Desnoyers , Neeraj Upadhyay , "Paul E . McKenney" , Steven Rostedt , Uladzislau Rezki , rcu , Frederic Weisbecker Subject: [PATCH 12/23] rcutorture: Copy out ftrace into its own console file Date: Tue, 10 Oct 2023 13:59:10 +0200 Message-Id: <20231010115921.988766-13-frederic@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231010115921.988766-1-frederic@kernel.org> References: <20231010115921.988766-1-frederic@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 10 Oct 2023 05:01:17 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779369802250736830 X-GMAIL-MSGID: 1779369802250736830 From: "Joel Fernandes (Google)" When debugging, it can be difficult to quickly find the ftrace dump within the console log, which in turn makes it difficult to process it independent of the rest of the console output. This commit therefore copies the contents of the buffers into its own file to make it easier to locate and process the ftrace dump. The original ftrace dump is still available in the console log in cases because it can be more convenient to process it in situ, for example, for scripts that process console output as well as ftrace-dump data. Also handle the case of multiple ftrace dumps potentially showing up in the log. Example for a file like [1], it will extract as [2]. [1]: foo foo Dumping ftrace buffer: --------------------------------- blah blah --------------------------------- more bar baz Dumping ftrace buffer: --------------------------------- blah2 blah2 --------------------------------- bleh bleh [2]: Ftrace dump 1: blah blah Ftrace dump 2: blah2 blah2 [ paulmck: Fixed awk indentation, input up front. ] Signed-off-by: Joel Fernandes (Google) Signed-off-by: Paul E. McKenney Signed-off-by: Frederic Weisbecker --- .../selftests/rcutorture/bin/functions.sh | 29 +++++++++++++++++++ .../selftests/rcutorture/bin/parse-console.sh | 7 +++++ 2 files changed, 36 insertions(+) mode change 100644 => 100755 tools/testing/selftests/rcutorture/bin/functions.sh diff --git a/tools/testing/selftests/rcutorture/bin/functions.sh b/tools/testing/selftests/rcutorture/bin/functions.sh old mode 100644 new mode 100755 index b8e2ea23cb3f..6e415ddb206f --- a/tools/testing/selftests/rcutorture/bin/functions.sh +++ b/tools/testing/selftests/rcutorture/bin/functions.sh @@ -331,3 +331,32 @@ specify_qemu_net () { echo $1 -net none fi } + +# Extract the ftrace output from the console log output +# The ftrace output in the original logs look like: +# Dumping ftrace buffer: +# --------------------------------- +# [...] +# --------------------------------- +extract_ftrace_from_console() { + awk < "$1" ' + + /Dumping ftrace buffer:/ { + buffer_count++ + print "Ftrace dump " buffer_count ":" + capture = 1 + next + } + + /---------------------------------/ { + if(capture == 1) { + capture = 2 + next + } else if(capture == 2) { + capture = 0 + print "" + } + } + + capture == 2' +} diff --git a/tools/testing/selftests/rcutorture/bin/parse-console.sh b/tools/testing/selftests/rcutorture/bin/parse-console.sh index 9ab0f6bc172c..e3d2f69ec0fb 100755 --- a/tools/testing/selftests/rcutorture/bin/parse-console.sh +++ b/tools/testing/selftests/rcutorture/bin/parse-console.sh @@ -182,3 +182,10 @@ if ! test -s $file.diags then rm -f $file.diags fi + +# Call extract_ftrace_from_console function, if the output is empty, +# don't create $file.ftrace. Otherwise output the results to $file.ftrace +extract_ftrace_from_console $file > $file.ftrace +if [ ! -s $file.ftrace ]; then + rm -f $file.ftrace +fi