* [PATCH 0/2] ring-buffer/selftest: Meta-page testing improvements
@ 2024-09-10 14:43 Vincent Donnefort
2024-09-10 14:43 ` [PATCH 1/2] ring-buffer/selftest: Verify the entire meta-page padding Vincent Donnefort
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Vincent Donnefort @ 2024-09-10 14:43 UTC (permalink / raw)
To: rostedt
Cc: mhiramat, linux-kernel, linux-trace-kernel, kernel-team,
Vincent Donnefort
Following the comments on the original patch [1] here's a set of 2 patches to
improve the selftest.
[1] https://lore.kernel.org/all/20240628104611.1443542-1-vdonnefort@google.com/
Vincent Donnefort (2):
ring-buffer/selftest: Verify the entire meta-page padding
ring-buffer/selftest: Handle meta-page bigger than the system
tools/testing/selftests/ring-buffer/map_test.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
base-commit: 2fcd5aff92aab479a9a89cfce2dbc9c6a9455b4f
--
2.46.0.598.g6f2099f65c-goog
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] ring-buffer/selftest: Verify the entire meta-page padding
2024-09-10 14:43 [PATCH 0/2] ring-buffer/selftest: Meta-page testing improvements Vincent Donnefort
@ 2024-09-10 14:43 ` Vincent Donnefort
2024-09-10 14:43 ` [PATCH 2/2] ring-buffer/selftest: Handle meta-page bigger than the system Vincent Donnefort
2024-09-10 15:45 ` [PATCH 0/2] ring-buffer/selftest: Meta-page testing improvements Steven Rostedt
2 siblings, 0 replies; 4+ messages in thread
From: Vincent Donnefort @ 2024-09-10 14:43 UTC (permalink / raw)
To: rostedt
Cc: mhiramat, linux-kernel, linux-trace-kernel, kernel-team,
Vincent Donnefort
Improve the ring-buffer meta-page test coverage by checking for the
entire padding region to be 0 instead of just looking at the first 4
bytes.
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
diff --git a/tools/testing/selftests/ring-buffer/map_test.c b/tools/testing/selftests/ring-buffer/map_test.c
index 4bb0192e43f3..ba12fd31de87 100644
--- a/tools/testing/selftests/ring-buffer/map_test.c
+++ b/tools/testing/selftests/ring-buffer/map_test.c
@@ -231,15 +231,15 @@ TEST_F(map, data_mmap)
/* Verify meta-page padding */
if (desc->meta->meta_page_size > getpagesize()) {
- void *addr;
-
data_len = desc->meta->meta_page_size;
data = mmap(NULL, data_len,
PROT_READ, MAP_SHARED, desc->cpu_fd, 0);
ASSERT_NE(data, MAP_FAILED);
- addr = (void *)((unsigned long)data + getpagesize());
- ASSERT_EQ(*((int *)addr), 0);
+ for (int i = desc->meta->meta_struct_len;
+ i < desc->meta->meta_page_size; i += sizeof(int))
+ ASSERT_EQ(*(int *)(data + i), 0);
+
munmap(data, data_len);
}
}
--
2.46.0.598.g6f2099f65c-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] ring-buffer/selftest: Handle meta-page bigger than the system
2024-09-10 14:43 [PATCH 0/2] ring-buffer/selftest: Meta-page testing improvements Vincent Donnefort
2024-09-10 14:43 ` [PATCH 1/2] ring-buffer/selftest: Verify the entire meta-page padding Vincent Donnefort
@ 2024-09-10 14:43 ` Vincent Donnefort
2024-09-10 15:45 ` [PATCH 0/2] ring-buffer/selftest: Meta-page testing improvements Steven Rostedt
2 siblings, 0 replies; 4+ messages in thread
From: Vincent Donnefort @ 2024-09-10 14:43 UTC (permalink / raw)
To: rostedt
Cc: mhiramat, linux-kernel, linux-trace-kernel, kernel-team,
Vincent Donnefort
Handle the case where the meta-page content is bigger than the system
page-size. This prepares the ground for extending features covered by
the meta-page.
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
diff --git a/tools/testing/selftests/ring-buffer/map_test.c b/tools/testing/selftests/ring-buffer/map_test.c
index ba12fd31de87..d10a847130fb 100644
--- a/tools/testing/selftests/ring-buffer/map_test.c
+++ b/tools/testing/selftests/ring-buffer/map_test.c
@@ -92,12 +92,22 @@ int tracefs_cpu_map(struct tracefs_cpu_map_desc *desc, int cpu)
if (desc->cpu_fd < 0)
return -ENODEV;
+again:
map = mmap(NULL, page_size, PROT_READ, MAP_SHARED, desc->cpu_fd, 0);
if (map == MAP_FAILED)
return -errno;
desc->meta = (struct trace_buffer_meta *)map;
+ /* the meta-page is bigger than the original mapping */
+ if (page_size < desc->meta->meta_struct_len) {
+ int meta_page_size = desc->meta->meta_page_size;
+
+ munmap(desc->meta, page_size);
+ page_size = meta_page_size;
+ goto again;
+ }
+
return 0;
}
--
2.46.0.598.g6f2099f65c-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] ring-buffer/selftest: Meta-page testing improvements
2024-09-10 14:43 [PATCH 0/2] ring-buffer/selftest: Meta-page testing improvements Vincent Donnefort
2024-09-10 14:43 ` [PATCH 1/2] ring-buffer/selftest: Verify the entire meta-page padding Vincent Donnefort
2024-09-10 14:43 ` [PATCH 2/2] ring-buffer/selftest: Handle meta-page bigger than the system Vincent Donnefort
@ 2024-09-10 15:45 ` Steven Rostedt
2 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2024-09-10 15:45 UTC (permalink / raw)
To: Vincent Donnefort; +Cc: mhiramat, linux-kernel, linux-trace-kernel, kernel-team
On Tue, 10 Sep 2024 15:43:21 +0100
Vincent Donnefort <vdonnefort@google.com> wrote:
> Following the comments on the original patch [1] here's a set of 2 patches to
> improve the selftest.
>
> [1] https://lore.kernel.org/all/20240628104611.1443542-1-vdonnefort@google.com/
This looks good, but can you resend this and Cc:
Shuah Khan <skhan@linuxfoundation.org>
linux-kselftest@vger.kernel.org
Thanks,
-- Steve
>
> Vincent Donnefort (2):
> ring-buffer/selftest: Verify the entire meta-page padding
> ring-buffer/selftest: Handle meta-page bigger than the system
>
> tools/testing/selftests/ring-buffer/map_test.c | 18 ++++++++++++++----
> 1 file changed, 14 insertions(+), 4 deletions(-)
>
>
> base-commit: 2fcd5aff92aab479a9a89cfce2dbc9c6a9455b4f
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-09-10 15:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-10 14:43 [PATCH 0/2] ring-buffer/selftest: Meta-page testing improvements Vincent Donnefort
2024-09-10 14:43 ` [PATCH 1/2] ring-buffer/selftest: Verify the entire meta-page padding Vincent Donnefort
2024-09-10 14:43 ` [PATCH 2/2] ring-buffer/selftest: Handle meta-page bigger than the system Vincent Donnefort
2024-09-10 15:45 ` [PATCH 0/2] ring-buffer/selftest: Meta-page testing improvements Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox