* [PATCH] libtracefs utest: Limit trace cpu read test to available sub-buffers
@ 2026-12-04 20:11 Jamie Dolan
0 siblings, 0 replies; only message in thread
From: Jamie Dolan @ 2026-12-04 20:11 UTC (permalink / raw)
To: linux-trace-devel; +Cc: frank.heimes, Jamie Dolan
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-12-04 20:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 20:11 [PATCH] libtracefs utest: Limit trace cpu read test to available sub-buffers Jamie Dolan
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.