Messages in this thread | | | Date | Tue, 21 Mar 2023 16:20:42 +0000 | From | Vincent Donnefort <> | Subject | Re: [PATCH 1/2] ring-buffer: Introducing ring-buffer mapping functions |
| |
On Tue, Mar 21, 2023 at 11:40:47AM -0400, Steven Rostedt wrote: > On Tue, 21 Mar 2023 15:17:15 +0000 > Vincent Donnefort <vdonnefort@google.com> wrote: > > > On Mon, Mar 20, 2023 at 09:45:16PM -0400, Steven Rostedt wrote: > > > On Fri, 17 Mar 2023 14:33:09 +0000 > > > Vincent Donnefort <vdonnefort@google.com> wrote: > > > > > > > Also, the meta-page being... a single page, this limits at the moment the > > > > number of pages in the ring-buffer that can be mapped: ~3MB on a 4K pages > > > > system. > > > > > > I hate this limitation, so I fixed it ;-) > > > > Thanks a lot for having a look. Do you mind if I fold this in my patch for a V2? > > Hold off, I found some bugs that I'm fixing ;-) > > > > > > > > > I added a meta_page_size field to the meta page, and user space can do: > > > > > > meta = mmap(NULL, page_size, PROT_READ, MAP_SHARED, fd, 0); > > > if (meta == MAP_FAILED) > > > pdie("mmap"); > > > > > > map = meta; > > > meta_len = map->meta_page_size; > > > > > > if (meta_len > page_size) { > > > munmap(meta, page_size); > > > meta = mmap(NULL, meta_len, PROT_READ, MAP_SHARED, fd, 0); > > > if (meta == MAP_FAILED) > > > pdie("mmap"); > > > map = meta; > > > } > > > > > > This appears to work (but I'm still testing it). > > > > > > -- Steve > > > > > > diff --git a/include/uapi/linux/trace_mmap.h b/include/uapi/linux/trace_mmap.h > > > index 24bcec754a35..12f3f7ee33d9 100644 > > > --- a/include/uapi/linux/trace_mmap.h > > > +++ b/include/uapi/linux/trace_mmap.h > > > @@ -18,6 +18,7 @@ struct ring_buffer_meta_page { > > > __u32 reader_page; > > > __u32 nr_data_pages; /* doesn't take into account the reader_page */ > > > __u32 data_page_head; /* index of data_pages[] */ > > > + __u32 meta_page_size; /* size of the meta page */ > > > > Do we want a specific field here? That could be deduced from nr_data_pages() > > quite easily? > > I rather not have too much implementation detail knowledge in user space. > It only removes a single entry, and it makes user space easier. In fact,
Ack.
> I'm thinking we should not include "__u32 data_pages[]" but instead add a: > "__u32 data_start" where user space does: > > __u32 *data_pages = (_u32 *)meta_page + meta_page->data_start; > > That way we could extend the data provided by the meta_page in the future.
That'd be nice. Couldn't we keep both to simplify the code for the kernel side?
> > -- Steve >
| |