On 1/27/22 10:22 AM, Anshuman Khandual wrote: > > > On 1/27/22 9:37 AM, Andrew Morton wrote: >> On Tue, 25 Jan 2022 15:58:34 +0530 Anshuman Khandual <anshuman.khandual@xxxxxxx> wrote: >> >>> >>> >>> >>> The following change should fix both the reported build problems. >>> >>> diff --git a/mm/rmap.c b/mm/rmap.c >>> index cce5dbae07f2..cae1c46440d6 100644 >>> --- a/mm/rmap.c >>> +++ b/mm/rmap.c >>> @@ -76,6 +76,7 @@ >>> >>> #include <asm/tlbflush.h> >>> >>> +#define CREATE_TRACE_POINTS >>> #include <trace/events/tlb.h> >>> #include <trace/events/migrate.h> >> >> My x86_64 allmodconfig is unhappy. >> >> lib/strncpy_from_user.o: warning: objtool: strncpy_from_user()+0x129: call to do_strncpy_from_user() with UACCESS enabled >> lib/strnlen_user.o: warning: objtool: strnlen_user()+0xc9: call to do_strnlen_user() with UACCESS enabled >> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/rmap.o:(.data+0x13e0): multiple definition of `__SCK__tp_func_tlb_flush'; arch/x86/mm/init.o:(.data+0x980): first defined here >> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/rmap.o: in function `__traceiter_tlb_flush': >> (.text+0x0): multiple definition of `__traceiter_tlb_flush'; arch/x86/mm/init.o:(.text+0x0): first defined here >> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/rmap.o:(__tracepoints+0x180): multiple definition of `__tracepoint_tlb_flush'; arch/x86/mm/init.o:(__tracepoints+0x0): first defined here >> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/rmap.o: in function `__SCT__tp_func_tlb_flush': >> (.static_call.text+0x0): multiple definition of `__SCT__tp_func_tlb_flush'; arch/x86/mm/init.o:(.static_call.text+0x0): first defined here >> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o: in function `__SCT__tp_func_mm_migrate_pages': >> (.static_call.text+0x0): multiple definition of `__SCT__tp_func_mm_migrate_pages'; mm/rmap.o:(.static_call.text+0x8): first defined here >> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o:(.data+0x13a0): multiple definition of `__SCK__tp_func_remove_migration_pte'; mm/rmap.o:(.data+0xfe0): first defined here >> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o: in function `__traceiter_set_migration_pte': >> (.text+0x140): multiple definition of `__traceiter_set_migration_pte'; mm/rmap.o:(.text+0x1c0): first defined here >> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o:(__tracepoints+0x120): multiple definition of `__tracepoint_mm_migrate_pages'; mm/rmap.o:(__tracepoints+0x120): first defined here >> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o: in function `__traceiter_mm_migrate_pages': >> (.text+0x0): multiple definition of `__traceiter_mm_migrate_pages'; mm/rmap.o:(.text+0x80): first defined here >> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o: in function `__SCT__tp_func_mm_migrate_pages_start': >> (.static_call.text+0x8): multiple definition of `__SCT__tp_func_mm_migrate_pages_start'; mm/rmap.o:(.static_call.text+0x10): first defined here >> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o:(.data+0x1420): multiple definition of `__SCK__tp_func_mm_migrate_pages_start'; mm/rmap.o:(.data+0x1060): first defined here >> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o:(.data+0x1460): multiple definition of `__SCK__tp_func_mm_migrate_pages'; mm/rmap.o:(.data+0x10a0): first defined here >> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o: in function `__traceiter_mm_migrate_pages_start': >> (.text+0xc0): multiple definition of `__traceiter_mm_migrate_pages_start'; mm/rmap.o:(.text+0x140): first defined here >> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o: in function `__SCT__tp_func_remove_migration_pte': >> (.static_call.text+0x18): multiple definition of `__SCT__tp_func_remove_migration_pte'; mm/rmap.o:(.static_call.text+0x20): first defined here >> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o:(__tracepoints+0x60): multiple definition of `__tracepoint_set_migration_pte'; mm/rmap.o:(__tracepoints+0x60): first defined here >> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o:(__tracepoints+0x0): multiple definition of `__tracepoint_remove_migration_pte'; mm/rmap.o:(__tracepoints+0x0): first defined here >> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o: in function `__traceiter_remove_migration_pte': >> (.text+0x1c0): multiple definition of `__traceiter_remove_migration_pte'; mm/rmap.o:(.text+0x240): first defined here >> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o: in function `__SCT__tp_func_set_migration_pte': >> (.static_call.text+0x10): multiple definition of `__SCT__tp_func_set_migration_pte'; mm/rmap.o:(.static_call.text+0x18): first defined here >> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o:(.data+0x13e0): multiple definition of `__SCK__tp_func_set_migration_pte'; mm/rmap.o:(.data+0x1020): first defined here >> /opt/crosstool/gcc-10.3.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: mm/migrate.o:(__tracepoints+0xc0): multiple definition of `__tracepoint_mm_migrate_pages_start'; mm/rmap.o:(__tracepoints+0xc0): first defined here >> make: *** [vmlinux] Error 1 >> > > This also seems to be a problem for existing trace points as well like tlb_flush > <events/tlb.h>, mm_migrate_pages_start and mm_migrate_pages <events/migrate.h>. > Is there some cyclic dependency ? Regardless, I can recreate the build problem. > Will look into it. CREATE_TRACE_POINTS should be defined just once, even if the corresponding trace header file is included in multiple C files. mm/rmap.c is a better place to have CREATE_TRACE_POINTS defined as it gets built always with CONFIG_MMU. Because the file mm/rmap.c now includes both <trace/events/migrate.h> and <trace/events/tlb.h> , all existing CREATE_TRACE_POINTS (including inside platforms) for them need to be dropped. A similar problem got created for <trace/events/thp.h> on powerpc as well, after the first patch. The following patch here fixes this problem. But I will do some more testing and respin the series. diff --git a/arch/powerpc/mm/book3s64/trace.c b/arch/powerpc/mm/book3s64/trace.c index b86e7b906257..ccd64b5e6cac 100644 --- a/arch/powerpc/mm/book3s64/trace.c +++ b/arch/powerpc/mm/book3s64/trace.c @@ -3,6 +3,5 @@ * This file is for defining trace points and trace related helpers. */ #ifdef CONFIG_TRANSPARENT_HUGEPAGE -#define CREATE_TRACE_POINTS #include <trace/events/thp.h> #endif diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index 4ba024d5b63a..d8cfce221275 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c @@ -31,7 +31,6 @@ * We need to define the tracepoints somewhere, and tlb.c * is only compiled when SMP=y. */ -#define CREATE_TRACE_POINTS #include <trace/events/tlb.h> #include "mm_internal.h" diff --git a/mm/migrate.c b/mm/migrate.c index 253dc5812949..79e3a553923a 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -54,7 +54,6 @@ #include <asm/tlbflush.h> -#define CREATE_TRACE_POINTS #include <trace/events/migrate.h> #include "internal.h"