Skip to contentSkip to conversation

ring-buffer: Last minute updates for 6.11

PATCH New Steven Rostedt 1 participant 3 messages Jul 16, 2024

Subsystems (2)
lore
Share & tools
lore
author maintainer
#2 lore raw

PATCH 2/2 ring-buffer: Use vma_pages() helper function

In reply to Steven Rostedt

From: Thorsten Blum <[email protected]>

Use the vma_pages() helper function and fix the following Coccinelle/coccicheck warning reported by vma_pages.cocci:

WARNING: Consider using vma_pages helper on vma

Rename the local variable vma_pages accordingly.

---
 kernel/trace/ring_buffer.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/trace/ring_buffer.c +4 -4
index f3d772461a60..d59cf0023e38 100644
@@ -6920,7 +6920,7 @@ static int __rb_inc_dec_mapped(struct ring_buffer_per_cpu *cpu_buffer,
 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;
+	unsigned long nr_subbufs, nr_pages, nr_vma_pages, pgoff = vma->vm_pgoff;
 	unsigned int subbuf_pages, subbuf_order;
 	struct page **pages;
 	int p = 0, s = 0;
@@ -6946,11 +6946,11 @@ static int __rb_map_vma(struct ring_buffer_per_cpu *cpu_buffer,
 	nr_subbufs = cpu_buffer->nr_pages + 1; /* + reader-subbuf */
 	nr_pages = ((nr_subbufs) << subbuf_order) - pgoff + 1; /* + meta-page */
 
-	vma_pages = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
-	if (!vma_pages || vma_pages > nr_pages)
+	nr_vma_pages = vma_pages(vma);
+	if (!nr_vma_pages || nr_vma_pages > nr_pages)
 		return -EINVAL;
 
-	nr_pages = vma_pages;
+	nr_pages = nr_vma_pages;
 
 	pages = kcalloc(nr_pages, sizeof(*pages), GFP_KERNEL);
 	if (!pages)
Signature · 1 line
2.43.0
author maintainer
#1 lore raw

PATCH 1/2 tracing: Fix NULL vs IS_ERR() check in enable_instances()

In reply to Steven Rostedt

From: Dan Carpenter <[email protected]>

The trace_array_create_systems() function returns error pointers, not NULL. Fix the check to match.

Cc Masami Hiramatsu <[email protected]>
Cc Mathieu Desnoyers <[email protected]>
Fixes e645535a954a ("tracing: Add option to use memmapped memory for trace boot instance")
---
 kernel/trace/trace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace.c +1 -1
index 71cca10581d6..5462fb10ff64 100644
@@ -10507,7 +10507,7 @@ __init static void enable_instances(void)
 		}
 
 		tr = trace_array_create_systems(name, NULL, addr, size);
-		if (!tr) {
+		if (IS_ERR(tr)) {
 			pr_warn("Tracing: Failed to create instance buffer %s\n", curr_str);
 			continue;
 		}
Signature · 1 line
2.43.0

Steven Rostedt

author maintainer
#0 lore raw

cover ring-buffer: Last minute updates for 6.11

git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
ring-buffer/for-next

Head SHA1: b96c312551b241bc17226c5347c6d6b38a1efd3e

Dan Carpenter (1):
tracing: Fix NULL vs IS_ERR() check in enable_instances()

Thorsten Blum (1):
ring-buffer: Use vma_pages() helper function

----

 kernel/trace/ring_buffer.c | 8 ++++----
 kernel/trace/trace.c       | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)