2023-08-08 19:52:57

by Stephen Rothwell

[permalink] [raw]
Subject: linux-next: build failure after merge of the mm tree

Hi all,

After merging the mm tree, today's linux-next build (powerpc
ppc44x_defconfig) failed like this:

In file included from kernel/crash_core.c:23:
kernel/kexec_internal.h:11:54: warning: 'struct kexec_segment' declared inside parameter list will not be visible outside of this definition or declaration
11 | int kimage_load_segment(struct kimage *image, struct kexec_segment *segment);
| ^~~~~~~~~~~~~
kernel/crash_core.c:321:40: warning: 'struct crash_mem' declared inside parameter list will not be visible outside of this definition or declaration
321 | int crash_prepare_elf64_headers(struct crash_mem *mem, int need_kernel_map,
| ^~~~~~~~~
kernel/crash_core.c: In function 'crash_prepare_elf64_headers':
kernel/crash_core.c:334:23: error: invalid use of undefined type 'struct crash_mem'
334 | nr_phdr += mem->nr_ranges;
| ^~
In file included from include/vdso/const.h:5,
from include/linux/const.h:4,
from include/linux/bits.h:5,
from include/linux/ratelimit_types.h:5,
from include/linux/printk.h:9,
from include/asm-generic/bug.h:22,
from arch/powerpc/include/asm/bug.h:116,
from include/linux/bug.h:5,
from arch/powerpc/include/asm/cmpxchg.h:8,
from arch/powerpc/include/asm/atomic.h:11,
from include/linux/atomic.h:7,
from include/linux/mm_types_task.h:13,
from include/linux/mm_types.h:5,
from include/linux/buildid.h:5,
from kernel/crash_core.c:7:
kernel/crash_core.c:346:32: error: 'ELF_CORE_HEADER_ALIGN' undeclared (first use in this function)
346 | elf_sz = ALIGN(elf_sz, ELF_CORE_HEADER_ALIGN);
| ^~~~~~~~~~~~~~~~~~~~~
include/uapi/linux/const.h:32:50: note: in definition of macro '__ALIGN_KERNEL_MASK'
32 | #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
| ^~~~
include/linux/align.h:8:33: note: in expansion of macro '__ALIGN_KERNEL'
8 | #define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
| ^~~~~~~~~~~~~~
kernel/crash_core.c:346:18: note: in expansion of macro 'ALIGN'
346 | elf_sz = ALIGN(elf_sz, ELF_CORE_HEADER_ALIGN);
| ^~~~~
kernel/crash_core.c:346:32: note: each undeclared identifier is reported only once for each function it appears in
346 | elf_sz = ALIGN(elf_sz, ELF_CORE_HEADER_ALIGN);
| ^~~~~~~~~~~~~~~~~~~~~
include/uapi/linux/const.h:32:50: note: in definition of macro '__ALIGN_KERNEL_MASK'
32 | #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
| ^~~~
include/linux/align.h:8:33: note: in expansion of macro '__ALIGN_KERNEL'
8 | #define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
| ^~~~~~~~~~~~~~
kernel/crash_core.c:346:18: note: in expansion of macro 'ALIGN'
346 | elf_sz = ALIGN(elf_sz, ELF_CORE_HEADER_ALIGN);
| ^~~~~
kernel/crash_core.c:396:28: error: invalid use of undefined type 'struct crash_mem'
396 | for (i = 0; i < mem->nr_ranges; i++) {
| ^~
kernel/crash_core.c:397:29: error: invalid use of undefined type 'struct crash_mem'
397 | mstart = mem->ranges[i].start;
| ^~
kernel/crash_core.c:398:27: error: invalid use of undefined type 'struct crash_mem'
398 | mend = mem->ranges[i].end;
| ^~
kernel/crash_core.c: At top level:
kernel/crash_core.c:420:36: warning: 'struct crash_mem' declared inside parameter list will not be visible outside of this definition or declaration
420 | int crash_exclude_mem_range(struct crash_mem *mem,
| ^~~~~~~~~
kernel/crash_core.c: In function 'crash_exclude_mem_range':
kernel/crash_core.c:427:28: error: invalid use of undefined type 'struct crash_mem'
427 | for (i = 0; i < mem->nr_ranges; i++) {
| ^~
kernel/crash_core.c:428:28: error: invalid use of undefined type 'struct crash_mem'
428 | start = mem->ranges[i].start;
| ^~
kernel/crash_core.c:429:26: error: invalid use of undefined type 'struct crash_mem'
429 | end = mem->ranges[i].end;
| ^~
kernel/crash_core.c:444:28: error: invalid use of undefined type 'struct crash_mem'
444 | mem->ranges[i].start = 0;
| ^~
kernel/crash_core.c:445:28: error: invalid use of undefined type 'struct crash_mem'
445 | mem->ranges[i].end = 0;
| ^~
kernel/crash_core.c:446:36: error: invalid use of undefined type 'struct crash_mem'
446 | if (i < mem->nr_ranges - 1) {
| ^~
kernel/crash_core.c:448:52: error: invalid use of undefined type 'struct crash_mem'
448 | for (j = i; j < mem->nr_ranges - 1; j++) {
| ^~
kernel/crash_core.c:449:44: error: invalid use of undefined type 'struct crash_mem'
449 | mem->ranges[j].start =
| ^~
kernel/crash_core.c:450:52: error: invalid use of undefined type 'struct crash_mem'
450 | mem->ranges[j+1].start;
| ^~
kernel/crash_core.c:451:44: error: invalid use of undefined type 'struct crash_mem'
451 | mem->ranges[j].end =
| ^~
kernel/crash_core.c:452:60: error: invalid use of undefined type 'struct crash_mem'
452 | mem->ranges[j+1].end;
| ^~
kernel/crash_core.c:461:36: error: invalid use of undefined type 'struct crash_mem'
461 | mem->nr_ranges--;
| ^~
kernel/crash_core.c:464:28: error: invalid use of undefined type 'struct crash_mem'
464 | mem->nr_ranges--;
| ^~
kernel/crash_core.c:470:28: error: invalid use of undefined type 'struct crash_mem'
470 | mem->ranges[i].end = p_start - 1;
| ^~
kernel/crash_core.c:474:28: error: invalid use of undefined type 'struct crash_mem'
474 | mem->ranges[i].end = p_start - 1;
| ^~
kernel/crash_core.c:476:28: error: invalid use of undefined type 'struct crash_mem'
476 | mem->ranges[i].start = p_end + 1;
| ^~
kernel/crash_core.c:485:21: error: invalid use of undefined type 'struct crash_mem'
485 | if (i == mem->max_nr_ranges - 1)
| ^~
kernel/crash_core.c:490:20: error: invalid use of undefined type 'struct crash_mem'
490 | if (j < mem->nr_ranges) {
| ^~
kernel/crash_core.c:492:29: error: invalid use of undefined type 'struct crash_mem'
492 | for (i = mem->nr_ranges - 1; i >= j; i--)
| ^~
kernel/crash_core.c:493:28: error: invalid use of undefined type 'struct crash_mem'
493 | mem->ranges[i + 1] = mem->ranges[i];
| ^~
kernel/crash_core.c:493:49: error: invalid use of undefined type 'struct crash_mem'
493 | mem->ranges[i + 1] = mem->ranges[i];
| ^~
kernel/crash_core.c:496:12: error: invalid use of undefined type 'struct crash_mem'
496 | mem->ranges[j].start = temp_range.start;
| ^~
kernel/crash_core.c:497:12: error: invalid use of undefined type 'struct crash_mem'
497 | mem->ranges[j].end = temp_range.end;
| ^~
kernel/crash_core.c:498:12: error: invalid use of undefined type 'struct crash_mem'
498 | mem->nr_ranges++;
| ^~

I am not sure exactly which commit caused but I have revreted these
for today:

6a41fd4665e6 ("x86/crash: optimize CPU changes")
add3b7e011e9 ("crash: change crash_prepare_elf64_headers() to for_each_possible_cpu()")
4a7eed40a7bc ("crash: hotplug support for kexec_load()")
8ce41bc6b147 ("x86/crash: add x86 crash hotplug support")
2b765af0c14f ("crash: memory and CPU hotplug sysfs attributes")
36d2b573329b ("kexec: exclude elfcorehdr from the segment digest")
ccfe0040500f ("crash: add generic infrastructure for crash hotplug support")
626775922a57 ("crash: move a few code bits to setup support of crash hotplug")

--
Cheers,
Stephen Rothwell


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2023-08-11 18:18:36

by Eric DeVolder

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the mm tree

The build problem has been reproduced and solved in v27. Specifically the builds that fail are
because only PROC_KCORE has been set, which only enables CRASH_CORE by itself. I had to move a few
items to obtain the needed visibility.

"[PATCH v27 0/8] crash: Kernel handling of CPU and memory hot un/plug"
https://lore.kernel.org/lkml/[email protected]/

In addition, I've spot tested/built a few other architectures and do not encounter build errors.

Thanks!
eric

On 8/7/23 23:40, Stephen Rothwell wrote:
> Hi all,
>
> After merging the mm tree, today's linux-next build (powerpc
> ppc44x_defconfig) failed like this:
>
> In file included from kernel/crash_core.c:23:
> kernel/kexec_internal.h:11:54: warning: 'struct kexec_segment' declared inside parameter list will not be visible outside of this definition or declaration
> 11 | int kimage_load_segment(struct kimage *image, struct kexec_segment *segment);
> | ^~~~~~~~~~~~~
> kernel/crash_core.c:321:40: warning: 'struct crash_mem' declared inside parameter list will not be visible outside of this definition or declaration
> 321 | int crash_prepare_elf64_headers(struct crash_mem *mem, int need_kernel_map,
> | ^~~~~~~~~
> kernel/crash_core.c: In function 'crash_prepare_elf64_headers':
> kernel/crash_core.c:334:23: error: invalid use of undefined type 'struct crash_mem'
> 334 | nr_phdr += mem->nr_ranges;
> | ^~
> In file included from include/vdso/const.h:5,
> from include/linux/const.h:4,
> from include/linux/bits.h:5,
> from include/linux/ratelimit_types.h:5,
> from include/linux/printk.h:9,
> from include/asm-generic/bug.h:22,
> from arch/powerpc/include/asm/bug.h:116,
> from include/linux/bug.h:5,
> from arch/powerpc/include/asm/cmpxchg.h:8,
> from arch/powerpc/include/asm/atomic.h:11,
> from include/linux/atomic.h:7,
> from include/linux/mm_types_task.h:13,
> from include/linux/mm_types.h:5,
> from include/linux/buildid.h:5,
> from kernel/crash_core.c:7:
> kernel/crash_core.c:346:32: error: 'ELF_CORE_HEADER_ALIGN' undeclared (first use in this function)
> 346 | elf_sz = ALIGN(elf_sz, ELF_CORE_HEADER_ALIGN);
> | ^~~~~~~~~~~~~~~~~~~~~
> include/uapi/linux/const.h:32:50: note: in definition of macro '__ALIGN_KERNEL_MASK'
> 32 | #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
> | ^~~~
> include/linux/align.h:8:33: note: in expansion of macro '__ALIGN_KERNEL'
> 8 | #define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
> | ^~~~~~~~~~~~~~
> kernel/crash_core.c:346:18: note: in expansion of macro 'ALIGN'
> 346 | elf_sz = ALIGN(elf_sz, ELF_CORE_HEADER_ALIGN);
> | ^~~~~
> kernel/crash_core.c:346:32: note: each undeclared identifier is reported only once for each function it appears in
> 346 | elf_sz = ALIGN(elf_sz, ELF_CORE_HEADER_ALIGN);
> | ^~~~~~~~~~~~~~~~~~~~~
> include/uapi/linux/const.h:32:50: note: in definition of macro '__ALIGN_KERNEL_MASK'
> 32 | #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
> | ^~~~
> include/linux/align.h:8:33: note: in expansion of macro '__ALIGN_KERNEL'
> 8 | #define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
> | ^~~~~~~~~~~~~~
> kernel/crash_core.c:346:18: note: in expansion of macro 'ALIGN'
> 346 | elf_sz = ALIGN(elf_sz, ELF_CORE_HEADER_ALIGN);
> | ^~~~~
> kernel/crash_core.c:396:28: error: invalid use of undefined type 'struct crash_mem'
> 396 | for (i = 0; i < mem->nr_ranges; i++) {
> | ^~
> kernel/crash_core.c:397:29: error: invalid use of undefined type 'struct crash_mem'
> 397 | mstart = mem->ranges[i].start;
> | ^~
> kernel/crash_core.c:398:27: error: invalid use of undefined type 'struct crash_mem'
> 398 | mend = mem->ranges[i].end;
> | ^~
> kernel/crash_core.c: At top level:
> kernel/crash_core.c:420:36: warning: 'struct crash_mem' declared inside parameter list will not be visible outside of this definition or declaration
> 420 | int crash_exclude_mem_range(struct crash_mem *mem,
> | ^~~~~~~~~
> kernel/crash_core.c: In function 'crash_exclude_mem_range':
> kernel/crash_core.c:427:28: error: invalid use of undefined type 'struct crash_mem'
> 427 | for (i = 0; i < mem->nr_ranges; i++) {
> | ^~
> kernel/crash_core.c:428:28: error: invalid use of undefined type 'struct crash_mem'
> 428 | start = mem->ranges[i].start;
> | ^~
> kernel/crash_core.c:429:26: error: invalid use of undefined type 'struct crash_mem'
> 429 | end = mem->ranges[i].end;
> | ^~
> kernel/crash_core.c:444:28: error: invalid use of undefined type 'struct crash_mem'
> 444 | mem->ranges[i].start = 0;
> | ^~
> kernel/crash_core.c:445:28: error: invalid use of undefined type 'struct crash_mem'
> 445 | mem->ranges[i].end = 0;
> | ^~
> kernel/crash_core.c:446:36: error: invalid use of undefined type 'struct crash_mem'
> 446 | if (i < mem->nr_ranges - 1) {
> | ^~
> kernel/crash_core.c:448:52: error: invalid use of undefined type 'struct crash_mem'
> 448 | for (j = i; j < mem->nr_ranges - 1; j++) {
> | ^~
> kernel/crash_core.c:449:44: error: invalid use of undefined type 'struct crash_mem'
> 449 | mem->ranges[j].start =
> | ^~
> kernel/crash_core.c:450:52: error: invalid use of undefined type 'struct crash_mem'
> 450 | mem->ranges[j+1].start;
> | ^~
> kernel/crash_core.c:451:44: error: invalid use of undefined type 'struct crash_mem'
> 451 | mem->ranges[j].end =
> | ^~
> kernel/crash_core.c:452:60: error: invalid use of undefined type 'struct crash_mem'
> 452 | mem->ranges[j+1].end;
> | ^~
> kernel/crash_core.c:461:36: error: invalid use of undefined type 'struct crash_mem'
> 461 | mem->nr_ranges--;
> | ^~
> kernel/crash_core.c:464:28: error: invalid use of undefined type 'struct crash_mem'
> 464 | mem->nr_ranges--;
> | ^~
> kernel/crash_core.c:470:28: error: invalid use of undefined type 'struct crash_mem'
> 470 | mem->ranges[i].end = p_start - 1;
> | ^~
> kernel/crash_core.c:474:28: error: invalid use of undefined type 'struct crash_mem'
> 474 | mem->ranges[i].end = p_start - 1;
> | ^~
> kernel/crash_core.c:476:28: error: invalid use of undefined type 'struct crash_mem'
> 476 | mem->ranges[i].start = p_end + 1;
> | ^~
> kernel/crash_core.c:485:21: error: invalid use of undefined type 'struct crash_mem'
> 485 | if (i == mem->max_nr_ranges - 1)
> | ^~
> kernel/crash_core.c:490:20: error: invalid use of undefined type 'struct crash_mem'
> 490 | if (j < mem->nr_ranges) {
> | ^~
> kernel/crash_core.c:492:29: error: invalid use of undefined type 'struct crash_mem'
> 492 | for (i = mem->nr_ranges - 1; i >= j; i--)
> | ^~
> kernel/crash_core.c:493:28: error: invalid use of undefined type 'struct crash_mem'
> 493 | mem->ranges[i + 1] = mem->ranges[i];
> | ^~
> kernel/crash_core.c:493:49: error: invalid use of undefined type 'struct crash_mem'
> 493 | mem->ranges[i + 1] = mem->ranges[i];
> | ^~
> kernel/crash_core.c:496:12: error: invalid use of undefined type 'struct crash_mem'
> 496 | mem->ranges[j].start = temp_range.start;
> | ^~
> kernel/crash_core.c:497:12: error: invalid use of undefined type 'struct crash_mem'
> 497 | mem->ranges[j].end = temp_range.end;
> | ^~
> kernel/crash_core.c:498:12: error: invalid use of undefined type 'struct crash_mem'
> 498 | mem->nr_ranges++;
> | ^~
>
> I am not sure exactly which commit caused but I have revreted these
> for today:
>
> 6a41fd4665e6 ("x86/crash: optimize CPU changes")
> add3b7e011e9 ("crash: change crash_prepare_elf64_headers() to for_each_possible_cpu()")
> 4a7eed40a7bc ("crash: hotplug support for kexec_load()")
> 8ce41bc6b147 ("x86/crash: add x86 crash hotplug support")
> 2b765af0c14f ("crash: memory and CPU hotplug sysfs attributes")
> 36d2b573329b ("kexec: exclude elfcorehdr from the segment digest")
> ccfe0040500f ("crash: add generic infrastructure for crash hotplug support")
> 626775922a57 ("crash: move a few code bits to setup support of crash hotplug")
>

2023-08-22 08:30:01

by Darrick J. Wong

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the mm tree

On Tue, Aug 22, 2023 at 02:34:06AM +0100, Matthew Wilcox wrote:
> On Tue, Aug 22, 2023 at 11:22:17AM +1000, Stephen Rothwell wrote:
> > Hi Matthew,
> >
> > On Tue, 22 Aug 2023 02:11:44 +0100 Matthew Wilcox <[email protected]> wrote:
> > >
> > > On Tue, Aug 22, 2023 at 09:55:37AM +1000, Stephen Rothwell wrote:
> > > > In file included from include/trace/trace_events.h:27,
> > > > from include/trace/define_trace.h:102,
> > > > from fs/xfs/xfs_trace.h:4428,
> > > > from fs/xfs/xfs_trace.c:45:
> > > > include/linux/pgtable.h:8:25: error: initializer element is not constant
> > > > 8 | #define PMD_ORDER (PMD_SHIFT - PAGE_SHIFT)
> > >
> > > Ummm. PowerPC doesn't have a compile-time constant PMD size?
> >
> > Yeah, you are not the first (or probably the last) to be caught by that.
>
> I think this will do the trick. Any comments?
>
> diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
> index 1904eaf7a2e9..d5a4e6c2dcd1 100644
> --- a/fs/xfs/xfs_trace.h
> +++ b/fs/xfs/xfs_trace.h
> @@ -796,15 +796,6 @@ DEFINE_INODE_EVENT(xfs_inode_reclaiming);
> DEFINE_INODE_EVENT(xfs_inode_set_need_inactive);
> DEFINE_INODE_EVENT(xfs_inode_inactivating);
>
> -/*
> - * ftrace's __print_symbolic requires that all enum values be wrapped in the
> - * TRACE_DEFINE_ENUM macro so that the enum value can be encoded in the ftrace
> - * ring buffer. Somehow this was only worth mentioning in the ftrace sample
> - * code.
> - */

Please leave this ^^^ comment, because the need for TRACE_DEFINE_ENUM to
make enums work in tracepoints is not at all obvious.

> -TRACE_DEFINE_ENUM(PMD_ORDER);
> -TRACE_DEFINE_ENUM(PUD_ORDER);
> -
> TRACE_DEFINE_ENUM(XFS_REFC_DOMAIN_SHARED);
> TRACE_DEFINE_ENUM(XFS_REFC_DOMAIN_COW);
>
> @@ -823,13 +814,10 @@ TRACE_EVENT(xfs_filemap_fault,
> __entry->order = order;
> __entry->write_fault = write_fault;
> ),
> - TP_printk("dev %d:%d ino 0x%llx %s write_fault %d",
> + TP_printk("dev %d:%d ino 0x%llx order:%u write_fault %d",

"order %u" to match the (non dev_t) style of the rest of the xfs
tracepoints.

--D

> MAJOR(__entry->dev), MINOR(__entry->dev),
> __entry->ino,
> - __print_symbolic(__entry->order,
> - { 0, "PTE" },
> - { PMD_ORDER, "PMD" },
> - { PUD_ORDER, "PUD" }),
> + __entry->order,
> __entry->write_fault)
> )
>
>
>