Message ID | 20250401203332.072456470@goodmis.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | ring-buffer: Allow persistent memory to be user space mmapped | expand |
On Tue, 01 Apr 2025 16:25:53 -0400 Steven Rostedt <rostedt@goodmis.org> wrote: > > static void > @@ -7319,7 +7319,8 @@ int ring_buffer_map_get_reader(struct trace_buffer *buffer, int cpu) > > out: > /* Some archs do not have data cache coherency between kernel and user-space */ > - flush_dcache_folio(virt_to_folio(cpu_buffer->reader_page->page)); > + flush_kernel_vmap_range(cpu_buffer->reader_page->page, > + buffer->subbuf_size + BUF_PAGE_HDR_SIZE); > > rb_update_meta_page(cpu_buffer); > This patch actually fixes a bug (I need to update the change log). The previous code only flushed a page. But if the sub-buffer size was 2 or more pages, it would not flush the rest of the sub-buffer. -- Steve
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index f25966b3a1fc..d4b0f7b55cce 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -6016,7 +6016,7 @@ static void rb_update_meta_page(struct ring_buffer_per_cpu *cpu_buffer) meta->read = cpu_buffer->read; /* Some archs do not have data cache coherency between kernel and user-space */ - flush_dcache_folio(virt_to_folio(cpu_buffer->meta_page)); + flush_kernel_vmap_range(cpu_buffer->meta_page, PAGE_SIZE); } static void @@ -7319,7 +7319,8 @@ int ring_buffer_map_get_reader(struct trace_buffer *buffer, int cpu) out: /* Some archs do not have data cache coherency between kernel and user-space */ - flush_dcache_folio(virt_to_folio(cpu_buffer->reader_page->page)); + flush_kernel_vmap_range(cpu_buffer->reader_page->page, + buffer->subbuf_size + BUF_PAGE_HDR_SIZE); rb_update_meta_page(cpu_buffer);