Re: [PATCH v22 2/5] ring-buffer: Introducing ring-buffer mapping functions

2024-05-10 Thread Steven Rostedt
On Fri, 10 May 2024 12:03:12 +0100 Vincent Donnefort wrote: > > I'm not particularly happy about us calling vm_insert_pages with NULL > > pointers stored in pages. > > > > Should we instead do > > > > if (WARN_ON_ONCE(s >= nr_subbufs)) { > > err = -EINVAL; > > goto out; > > } > > > >

Re: [PATCH v22 2/5] ring-buffer: Introducing ring-buffer mapping functions

2024-05-10 Thread Vincent Donnefort
[...] > > > + > > > + while (s < nr_subbufs && p < nr_pages) { > > > + struct page *page = virt_to_page(cpu_buffer->subbuf_ids[s]); > > > + int off = 0; > > > + > > > + for (; off < (1 << (subbuf_order)); off++, page++) { > > > + if (p >= nr_pages) > > > +

Re: [PATCH v22 2/5] ring-buffer: Introducing ring-buffer mapping functions

2024-05-10 Thread Vincent Donnefort
On Fri, May 10, 2024 at 11:15:59AM +0200, David Hildenbrand wrote: > On 09.05.24 13:05, Vincent Donnefort wrote: > > On Tue, May 07, 2024 at 10:34:02PM -0400, Steven Rostedt wrote: > > > On Tue, 30 Apr 2024 12:13:51 +0100 > > > Vincent Donnefort wrote: > > > > > > > +#ifdef CONFIG_MMU > > > >

Re: [PATCH v22 2/5] ring-buffer: Introducing ring-buffer mapping functions

2024-05-10 Thread David Hildenbrand
On 08.05.24 04:34, Steven Rostedt wrote: On Tue, 30 Apr 2024 12:13:51 +0100 Vincent Donnefort wrote: +#ifdef CONFIG_MMU +static int __rb_map_vma(struct ring_buffer_per_cpu *cpu_buffer, + struct vm_area_struct *vma) +{ + unsigned long nr_subbufs, nr_pages,

Re: [PATCH v22 2/5] ring-buffer: Introducing ring-buffer mapping functions

2024-05-10 Thread David Hildenbrand
On 09.05.24 13:05, Vincent Donnefort wrote: On Tue, May 07, 2024 at 10:34:02PM -0400, Steven Rostedt wrote: On Tue, 30 Apr 2024 12:13:51 +0100 Vincent Donnefort wrote: +#ifdef CONFIG_MMU +static int __rb_map_vma(struct ring_buffer_per_cpu *cpu_buffer, + struct

Re: [PATCH v22 2/5] ring-buffer: Introducing ring-buffer mapping functions

2024-05-09 Thread Vincent Donnefort
On Tue, May 07, 2024 at 10:34:02PM -0400, Steven Rostedt wrote: > On Tue, 30 Apr 2024 12:13:51 +0100 > Vincent Donnefort wrote: > > > +#ifdef CONFIG_MMU > > +static int __rb_map_vma(struct ring_buffer_per_cpu *cpu_buffer, > > + struct vm_area_struct *vma) > > +{ > > +

Re: [PATCH v22 2/5] ring-buffer: Introducing ring-buffer mapping functions

2024-05-07 Thread Steven Rostedt
On Tue, 30 Apr 2024 12:13:51 +0100 Vincent Donnefort wrote: > +#ifdef CONFIG_MMU > +static int __rb_map_vma(struct ring_buffer_per_cpu *cpu_buffer, > + struct vm_area_struct *vma) > +{ > + unsigned long nr_subbufs, nr_pages, vma_pages, pgoff = vma->vm_pgoff; > +

Re: [PATCH v22 2/5] ring-buffer: Introducing ring-buffer mapping functions

2024-05-02 Thread Steven Rostedt
On Thu, 2 May 2024 14:38:32 +0100 Vincent Donnefort wrote: > > > + while (s < nr_subbufs && p < nr_pages) { > > > + struct page *page = virt_to_page(cpu_buffer->subbuf_ids[s]); > > > + int off = 0; > > > + > > > + for (; off < (1 << (subbuf_order)); off++, page++) { > > >

Re: [PATCH v22 2/5] ring-buffer: Introducing ring-buffer mapping functions

2024-05-02 Thread Vincent Donnefort
On Thu, May 02, 2024 at 03:30:32PM +0200, David Hildenbrand wrote: > On 30.04.24 13:13, Vincent Donnefort wrote: > > In preparation for allowing the user-space to map a ring-buffer, add > > a set of mapping functions: > > > >ring_buffer_{map,unmap}() > > > > And controls on the ring-buffer:

Re: [PATCH v22 2/5] ring-buffer: Introducing ring-buffer mapping functions

2024-05-02 Thread David Hildenbrand
On 30.04.24 13:13, Vincent Donnefort wrote: In preparation for allowing the user-space to map a ring-buffer, add a set of mapping functions: ring_buffer_{map,unmap}() And controls on the ring-buffer: ring_buffer_map_get_reader() /* swap reader and head */ Mapping the ring-buffer also

[PATCH v22 2/5] ring-buffer: Introducing ring-buffer mapping functions

2024-04-30 Thread Vincent Donnefort
In preparation for allowing the user-space to map a ring-buffer, add a set of mapping functions: ring_buffer_{map,unmap}() And controls on the ring-buffer: ring_buffer_map_get_reader() /* swap reader and head */ Mapping the ring-buffer also involves: A unique ID for each subbuf of the