Commit 75d7ff9a authored by Vincent Donnefort's avatar Vincent Donnefort Committed by Steven Rostedt (Google)

selftests/ring-buffer: Handle meta-page bigger than the system

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.

Cc: Shuah Khan <skhan@linuxfoundation.org>
Cc: linux-kselftest@vger.kernel.org
Link: https://lore.kernel.org/20240910162335.2993310-3-vdonnefort@google.comAcked-by: default avatarShuah Khan <skhan@linuxfoundation.org>
Signed-off-by: default avatarVincent Donnefort <vdonnefort@google.com>
Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
parent 21ff365b
...@@ -92,12 +92,22 @@ int tracefs_cpu_map(struct tracefs_cpu_map_desc *desc, int cpu) ...@@ -92,12 +92,22 @@ int tracefs_cpu_map(struct tracefs_cpu_map_desc *desc, int cpu)
if (desc->cpu_fd < 0) if (desc->cpu_fd < 0)
return -ENODEV; return -ENODEV;
again:
map = mmap(NULL, page_size, PROT_READ, MAP_SHARED, desc->cpu_fd, 0); map = mmap(NULL, page_size, PROT_READ, MAP_SHARED, desc->cpu_fd, 0);
if (map == MAP_FAILED) if (map == MAP_FAILED)
return -errno; return -errno;
desc->meta = (struct trace_buffer_meta *)map; 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; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment