Message ID | 20231210040452.274868572@goodmis.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp6354085vqy; Sat, 9 Dec 2023 20:05:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IEMo4sZbaviyoQL6qthBNz1m97BVbmOQIhFAcsabiEUgPkDRqrIlheD5QZNj32eYpL/Cvds X-Received: by 2002:a05:6359:608c:b0:170:17eb:9c40 with SMTP id ry12-20020a056359608c00b0017017eb9c40mr2400063rwb.33.1702181138274; Sat, 09 Dec 2023 20:05:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702181138; cv=none; d=google.com; s=arc-20160816; b=AcunfpUsh7eNwho7OxYd6KQJ0LaxP1X8++yD2tIV+xi/8OVcI9XH8hw4mfBrE03Jtt P9TWbfIvuNcd52pyrmRXQoXUL2sAVhs8KrZaHqPA3kcqE9WJ3k4TxZziv7XdJ/W5LoZj ZbyRYoX4deBPjVqJt7u+b2OKY66etg8EgjNuOZZZ7i7ebIkANARPe7GGvJv40UkzMA2l XjRiJyhNDoYYFmS5377R7PX1tUNPA6a8l7TJiwdnU45i/5LzsPJ9YTD9mv1yrNVwzOjN Vt+ZOEv8E7uocpXNgf3CJymrvMYXWsN1N2ZH9tzfDHz/ZnzbKXzOr7r8IoYUxIJ4F8Km QPtQ== 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=LL+M6cFVrFxl6tvP0L/d8dotBikTYSybMvyiJ88/0uw=; fh=pL1t9p0RxD5qCgSUniSa3P4+XmpksJYPzX6TE+dndao=; b=UuM997Mg415Iz7pn2B1HRniqDmloBhf8UY8tC9uiyvoxW+JGuOqUuBdHipW1niRYnK B+21+8BbFZen4j/UqYwLPX24BQU5N5uGsg2uEDIS/YYF0e7aj6MyAYLWT2E5Lbde8N6M IbQqVA0nqBxuLKXmoimESRZ4pnmYBx6vYuAA4TaniUKzACSxd62+NCwXn+0w72q/tFSV DhF6dWHUR3VihyvAUORaXjrIvq6p5BheAXnCrgc9TbkiFiATxaWc72ZYg8WIuLSBPWLa FsEG9/dCV73/j4GSeL25rxk9/CkKeM6QH/3ptAb0g4pt5LS7jN3Ioewtw78p4XHDuA8B VXxg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id c37-20020a634e25000000b005c645e1ff20si3891169pgb.73.2023.12.09.20.05.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Dec 2023 20:05:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id E3EEB805FD55; Sat, 9 Dec 2023 20:05:25 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231978AbjLJEFH (ORCPT <rfc822;kartikey406@gmail.com> + 99 others); Sat, 9 Dec 2023 23:05:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231512AbjLJEEI (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 9 Dec 2023 23:04:08 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8900310E for <linux-kernel@vger.kernel.org>; Sat, 9 Dec 2023 20:04:15 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C84EC433C9; Sun, 10 Dec 2023 04:04:15 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from <rostedt@goodmis.org>) id 1rCB3k-000000021SI-24ci; Sat, 09 Dec 2023 23:04:52 -0500 Message-ID: <20231210040452.274868572@goodmis.org> User-Agent: quilt/0.67 Date: Sat, 09 Dec 2023 22:54:18 -0500 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>, Mathieu Desnoyers <mathieu.desnoyers@efficios.com>, Andrew Morton <akpm@linux-foundation.org>, Tzvetomir Stoyanov <tz.stoyanov@gmail.com>, Vincent Donnefort <vdonnefort@google.com>, Kent Overstreet <kent.overstreet@gmail.com> Subject: [PATCH 14/14] ringbuffer/selftest: Add basic selftest to test chaning subbuf order References: <20231210035404.053677508@goodmis.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Sat, 09 Dec 2023 20:05:26 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784866288963597598 X-GMAIL-MSGID: 1784866288963597598 |
Series |
ring-buffer/tracing: Allow ring buffer to have bigger sub buffers
|
|
Commit Message
Steven Rostedt
Dec. 10, 2023, 3:54 a.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org> Add a self test that will write into the trace buffer with differ trace sub buffer order sizes. Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org> --- .../ftrace/test.d/00basic/ringbuffer_order.tc | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 tools/testing/selftests/ftrace/test.d/00basic/ringbuffer_order.tc
Comments
On 2023-12-09 22:54, Steven Rostedt wrote: [...] > +get_buffer_data_size() { > + sed -ne 's/^.*data.*size:\([0-9][0-9]*\).*/\1/p' events/header_page > +} > + > +a="1234567890" > + > +make_str() { > + cnt=$1 > + s="" > + while [ $cnt -gt 10 ]; do > + s="${s}${a}" > + cnt=$((cnt-10)) > + done > + while [ $cnt -gt 0 ]; do > + s="${s}X" > + cnt=$((cnt-1)) > + done > + echo -n $s > +} > + > +test_buffer() { > + > + size=`get_buffer_data_size` > + > + str=`make_str $size` > + > + echo $str > trace_marker > + > + grep -q $a trace This test has no clue if the record was truncated or not. It basically repeats the string "1234567890" until it fills the subbuffer size and pads with XXXX as needed as trace marker payload, but the grep looks for the "1234567890" pattern only. The test should be extended to validate whether the trace marker payload was truncated or not, otherwise it is of limited value. Thanks, Mathieu
On Sun, 10 Dec 2023 09:26:13 -0500 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> wrote: > This test has no clue if the record was truncated or not. > > It basically repeats the string > > "1234567890" until it fills the subbuffer size and pads with > XXXX as needed as trace marker payload, but the grep looks for the > "1234567890" pattern only. > > The test should be extended to validate whether the trace marker > payload was truncated or not, otherwise it is of limited value. It can be, but for now it's just testing to make sure it doesn't crash. I ran out of time, and if someone else wants to extend this, go ahead. Currently, my testing has been just manual observations. I threw this in just to have some kind of smoke test applied. I agree with the API changes, and will update that. But given that this has been two years and never applied, is because nobody has the time to work on this. The reason I'm pushing for this now, is because Kent hit the limit in his work. Knowing that he would not have hit this limit if these patches were applied, I feel more urgency on getting them in. But this is all on my own time, not part of my Employer (hence why I'm working on the weekend). -- Steve
diff --git a/tools/testing/selftests/ftrace/test.d/00basic/ringbuffer_order.tc b/tools/testing/selftests/ftrace/test.d/00basic/ringbuffer_order.tc new file mode 100644 index 000000000000..c0d76dc724d3 --- /dev/null +++ b/tools/testing/selftests/ftrace/test.d/00basic/ringbuffer_order.tc @@ -0,0 +1,46 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# description: Change the ringbuffer size +# requires: buffer_subbuf_order +# flags: instance + +get_buffer_data_size() { + sed -ne 's/^.*data.*size:\([0-9][0-9]*\).*/\1/p' events/header_page +} + +a="1234567890" + +make_str() { + cnt=$1 + s="" + while [ $cnt -gt 10 ]; do + s="${s}${a}" + cnt=$((cnt-10)) + done + while [ $cnt -gt 0 ]; do + s="${s}X" + cnt=$((cnt-1)) + done + echo -n $s +} + +test_buffer() { + + size=`get_buffer_data_size` + + str=`make_str $size` + + echo $str > trace_marker + + grep -q $a trace +} + +ORIG=`cat buffer_subbuf_order` + +for a in `seq 0 4`; do + echo 0 > buffer_subbuf_order + test_buffer +done + +echo $ORIG > buffer_subbuf_order +