From: Jamie Dolan <jldolan@linux.ibm.com>
To: linux-trace-devel@vger.kernel.org
Cc: frank.heimes@canonical.com, Jamie Dolan <jldolan@linux.ibm.com>
Subject: [PATCH] libtracefs utest: Limit trace cpu read test to available sub-buffers
Date: Fri, 4 Dec 2026 20:11:54 +0000 [thread overview]
Message-ID: <20261204201154.141569-1-jldolan@linux.ibm.com> (raw)
Commit 65f629e ("libtracefs utest: Do not test more events than
what the ring buffer can hold") added a check to limit the number
of events generated during the "trace cpu read" test.
However, on architectures with larger page sizes, such as ppc64el
with a 64K PAGE_SIZE, the ring buffer may contain fewer than 50
sub-buffers. This can cause the buffer to overflow and the test to
read fewer events than expected.
Use data.nr_subbufs to limit the number of events generated when
50 or fewer sub-buffers are available.
This follows the approach suggested by Adrien Nader and Steven
Rostedt in the upstream Bugzilla discussion, which was
subsequently tested successfully on arm64 and ppc64el.
Fixes: 65f629e0933b ("libtracefs utest: Do not test more events than what the ring buffer can hold")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=219358
Bug-Ubuntu: https://launchpad.net/bugs/2062119
Signed-off-by: Jamie Dolan <jldolan@linux.ibm.com>
---
utest/tracefs-utest.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/utest/tracefs-utest.c b/utest/tracefs-utest.c
index e48232c..2eb4897 100644
--- a/utest/tracefs-utest.c
+++ b/utest/tracefs-utest.c
@@ -1271,8 +1271,6 @@ static void test_cpu_read(struct test_cpu_data *data, int expect)
static void test_instance_trace_cpu_read(struct tracefs_instance *instance, bool map)
{
struct test_cpu_data data;
- size_t buffer_size;
- int big_num = 50;
if (setup_trace_cpu(instance, &data, true, map))
return;
@@ -1281,14 +1279,7 @@ static void test_instance_trace_cpu_read(struct tracefs_instance *instance, bool
test_cpu_read(&data, data.events_per_buf / 2);
test_cpu_read(&data, data.events_per_buf);
test_cpu_read(&data, data.events_per_buf + 1);
-
- buffer_size = tracefs_instance_get_buffer_size(instance, 0) * 1024;
- if (data.events_per_buf * big_num > (buffer_size - data.events_per_buf)) {
- big_num = (buffer_size / data.events_per_buf);
- big_num -= data.events_per_buf * 2;
- CU_TEST(big_num > 0);
- }
- test_cpu_read(&data, data.events_per_buf * big_num);
+ test_cpu_read(&data, data.events_per_buf * (50 < data.nr_subbufs ? 50 : data.nr_subbufs - 1));
shutdown_trace_cpu(&data);
}
--
2.43.0
reply other threads:[~2026-12-04 20:11 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261204201154.141569-1-jldolan@linux.ibm.com \
--to=jldolan@linux.ibm.com \
--cc=frank.heimes@canonical.com \
--cc=linux-trace-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.