Skip to contentSkip to conversation

linux-next: build warning after merge of the ftrace tree

DISCUSSION Stephen Rothwell 2 participants 5 messages May 15, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi all,

After merging the ftrace tree, today's linux-next build (powerpc ppc64_defconfig) produced this warning:

In file included from arch/powerpc/include/asm/page.h:332,
from arch/powerpc/include/asm/mmu.h:144,
from arch/powerpc/include/asm/paca.h:18,
from arch/powerpc/include/asm/current.h:13,
from include/linux/thread_info.h:23,
from include/asm-generic/preempt.h:5,
from ./arch/powerpc/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:79,
from include/linux/alloc_tag.h:11,
from include/linux/percpu.h:5,
from include/linux/context_tracking_state.h:5,
from include/linux/hardirq.h:5,
from include/linux/interrupt.h:11,
from include/linux/trace_recursion.h:5,
from kernel/trace/ring_buffer.c:7:
kernel/trace/ring_buffer.c: In function '__rb_map_vma':
kernel/trace/ring_buffer.c:6286:72: warning: passing argument 1 of 'virt_to_pfn' makes pointer from integer without a cast [-Wint-conversion]

 6286 |                 struct page *page = virt_to_page(cpu_buffer->subbuf_ids[s]);
      |                                                  ~~~~~~~~~~~~~~~~~~~~~~^~~
      |                                                                        |
      |                                                                        long unsigned int

include/asm-generic/memory_model.h:37:45: note: in definition of macro '__pfn_to_page'
37 | #define __pfn_to_page(pfn) (vmemmap + (pfn))
| ^~~
kernel/trace/ring_buffer.c:6286:37: note: in expansion of macro 'virt_to_page'

 6286 |                 struct page *page = virt_to_page(cpu_buffer->subbuf_ids[s]);
      |                                     ^~~~~~~~~~~~
arch/powerpc/include/asm/page.h:228:53: note: expected 'const void *' but argument is of type 'long unsigned int'
  228 | static inline unsigned long virt_to_pfn(const void *kaddr)
      |                                         ~~~~~~~~~~~~^~~~~

Introduced by commit

117c39200d9d ("ring-buffer: Introducing ring-buffer mapping functions")

My arm multi_v7_defconfig build produced a similar warning.

Is this really intended for v6.10? It seems a bit late.

Signature · 2 lines
Cheers,
Stephen Rothwell
maintainer
#1 lore raw
Quoted 4 lines · On Wed, 15 May 2024 12:48:08 +1000 Stephen Rothwell <[email protected]>…

Hi all,

After merging the ftrace tree, today's linux-next build (powerpc ppc64_defconfig) produced this warning:

Interesting, as I didn't get reports from it via zero-day bot.

Quoted 32 lines

In file included from arch/powerpc/include/asm/page.h:332,
from arch/powerpc/include/asm/mmu.h:144,
from arch/powerpc/include/asm/paca.h:18,
from arch/powerpc/include/asm/current.h:13,
from include/linux/thread_info.h:23,
from include/asm-generic/preempt.h:5,
from ./arch/powerpc/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:79,
from include/linux/alloc_tag.h:11,
from include/linux/percpu.h:5,
from include/linux/context_tracking_state.h:5,
from include/linux/hardirq.h:5,
from include/linux/interrupt.h:11,
from include/linux/trace_recursion.h:5,
from kernel/trace/ring_buffer.c:7:
kernel/trace/ring_buffer.c: In function '__rb_map_vma':
kernel/trace/ring_buffer.c:6286:72: warning: passing argument 1 of 'virt_to_pfn' makes pointer from integer without a cast [-Wint-conversion]

 6286 |                 struct page *page = virt_to_page(cpu_buffer->subbuf_ids[s]);
      |                                                  ~~~~~~~~~~~~~~~~~~~~~~^~~
      |                                                                        |
      |                                                                        long unsigned int

include/asm-generic/memory_model.h:37:45: note: in definition of macro '__pfn_to_page'
37 | #define __pfn_to_page(pfn) (vmemmap + (pfn))
| ^~~
kernel/trace/ring_buffer.c:6286:37: note: in expansion of macro 'virt_to_page'

 6286 |                 struct page *page = virt_to_page(cpu_buffer->subbuf_ids[s]);
      |                                     ^~~~~~~~~~~~
arch/powerpc/include/asm/page.h:228:53: note: expected 'const void *' but argument is of type 'long unsigned int'
  228 | static inline unsigned long virt_to_pfn(const void *kaddr)
      |                                         ~~~~~~~~~~~~^~~~~
Quoted 8 lines

Introduced by commit

117c39200d9d ("ring-buffer: Introducing ring-buffer mapping functions")

My arm multi_v7_defconfig build produced a similar warning.

Is this really intended for v6.10? It seems a bit late.

Well, I submitted this for the v6.9 merge window, and Linus had issues with it. So we've been tweaking it for the entire time and it was ready a bit earlier, but due to my vacation and traveling I missed pushing it to next. :-p

Most the code has been well tested, but because it is late, I kept it as a separate topic branch in case Linus still isn't happy with it.

-- Steve

maintainer
#2 lore raw
Quoted 24 lines · On Wed, 15 May 2024 00:49:31 -0400 Steven Rostedt <[email protected]> wrote:
Quoted 15 lines

kernel/trace/ring_buffer.c:6286:72: warning: passing argument 1 of 'virt_to_pfn' makes pointer from integer without a cast [-Wint-conversion]

 6286 |                 struct page *page = virt_to_page(cpu_buffer->subbuf_ids[s]);
      |                                                  ~~~~~~~~~~~~~~~~~~~~~~^~~
      |                                                                        |
      |                                                                        long unsigned int

include/asm-generic/memory_model.h:37:45: note: in definition of macro '__pfn_to_page'
37 | #define __pfn_to_page(pfn) (vmemmap + (pfn))
| ^~~
kernel/trace/ring_buffer.c:6286:37: note: in expansion of macro 'virt_to_page'

 6286 |                 struct page *page = virt_to_page(cpu_buffer->subbuf_ids[s]);
      |                                     ^~~~~~~~~~~~
arch/powerpc/include/asm/page.h:228:53: note: expected 'const void *' but argument is of type 'long unsigned int'
  228 | static inline unsigned long virt_to_pfn(const void *kaddr)
      |                                         ~~~~~~~~~~~~^~~~~
Quoted 8 lines

Introduced by commit

117c39200d9d ("ring-buffer: Introducing ring-buffer mapping functions")

My arm multi_v7_defconfig build produced a similar warning.

Is this really intended for v6.10? It seems a bit late.

Quoted 7 lines

Well, I submitted this for the v6.9 merge window, and Linus had issues with it. So we've been tweaking it for the entire time and it was ready a bit earlier, but due to my vacation and traveling I missed pushing it to next. :-p

Most the code has been well tested, but because it is late, I kept it as a separate topic branch in case Linus still isn't happy with it.

And it looks like one of the "tweaks" dropped a (void *) cast.

This should fixed it:

kernel/trace/ring_buffer.c +1 -1
index a02c7a52a0f5..7345a8b625fb 100644
@@ -6283,7 +6283,7 @@ static int __rb_map_vma(struct ring_buffer_per_cpu *cpu_buffer,
 	}
 
 	while (p < nr_pages) {
-		struct page *page = virt_to_page(cpu_buffer->subbuf_ids[s]);
+		struct page *page = virt_to_page((void *)cpu_buffer->subbuf_ids[s]);
 		int off = 0;
 
 		if (WARN_ON_ONCE(s >= nr_subbufs)) {

-- Steve

#3 lore raw
In reply to Stephen Rothwell

Hi all,

Quoted 35 lines · On Wed, 15 May 2024 12:48:08 +1000 Stephen Rothwell <[email protected]>…

After merging the ftrace tree, today's linux-next build (powerpc ppc64_defconfig) produced this warning:

In file included from arch/powerpc/include/asm/page.h:332,
from arch/powerpc/include/asm/mmu.h:144,
from arch/powerpc/include/asm/paca.h:18,
from arch/powerpc/include/asm/current.h:13,
from include/linux/thread_info.h:23,
from include/asm-generic/preempt.h:5,
from ./arch/powerpc/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:79,
from include/linux/alloc_tag.h:11,
from include/linux/percpu.h:5,
from include/linux/context_tracking_state.h:5,
from include/linux/hardirq.h:5,
from include/linux/interrupt.h:11,
from include/linux/trace_recursion.h:5,
from kernel/trace/ring_buffer.c:7:
kernel/trace/ring_buffer.c: In function '__rb_map_vma':
kernel/trace/ring_buffer.c:6286:72: warning: passing argument 1 of 'virt_to_pfn' makes pointer from integer without a cast [-Wint-conversion]

 6286 |                 struct page *page = virt_to_page(cpu_buffer->subbuf_ids[s]);
      |                                                  ~~~~~~~~~~~~~~~~~~~~~~^~~
      |                                                                        |
      |                                                                        long unsigned int

include/asm-generic/memory_model.h:37:45: note: in definition of macro '__pfn_to_page'
37 | #define __pfn_to_page(pfn) (vmemmap + (pfn))
| ^~~
kernel/trace/ring_buffer.c:6286:37: note: in expansion of macro 'virt_to_page'

 6286 |                 struct page *page = virt_to_page(cpu_buffer->subbuf_ids[s]);
      |                                     ^~~~~~~~~~~~
arch/powerpc/include/asm/page.h:228:53: note: expected 'const void *' but argument is of type 'long unsigned int'
  228 | static inline unsigned long virt_to_pfn(const void *kaddr)
      |                                         ~~~~~~~~~~~~^~~~~
Quoted 5 lines

Introduced by commit

117c39200d9d ("ring-buffer: Introducing ring-buffer mapping functions")

My arm multi_v7_defconfig build produced a similar warning.

This became a build failure on my powerpc allyesconfig build, so I have used the ftrace tree from next-20240414 for today.

Signature · 2 lines
Cheers,
Stephen Rothwell
#4 lore raw

Hi all,

Quoted 2 lines · On Wed, 15 May 2024 15:11:14 +1000 Stephen Rothwell <[email protected]>…

This became a build failure on my powerpc allyesconfig build, so I have used the ftrace tree from next-20240414 for today.

                            ^^^^^^^^^^^^^

I meant next-20240514, of course.

Signature · 2 lines
Cheers,
Stephen Rothwell