Message ID | 20230531125535.676098-9-hch@lst.de (mailing list archive) |
---|---|
State | Handled Elsewhere, archived |
Headers | show |
Series | [01/24] driver core: return bool from driver_probe_done | expand |
Hi, On Wed, May 31, 2023 at 02:55:19PM +0200, Christoph Hellwig wrote: > Instead of declaring root_device_name as a global variable pass it as an > argument to the functions using it. > > Signed-off-by: Christoph Hellwig <hch@lst.de> This patch results in the following build error when trying to build xtensa:tinyconfig. WARNING: modpost: vmlinux: section mismatch in reference: strcpy.isra.0+0x14 (section: .text.unlikely) -> initcall_level_names (section: .init.data) ERROR: modpost: Section mismatches detected. Unfortunately, reverting it is not possible due to conflicts, so I can not confirm the bisect results. Bisect log attached. Guenter --- # bad: [8d2be868b42c08290509c60515865f4de24ea704] Add linux-next specific files for 20230623 # good: [45a3e24f65e90a047bef86f927ebdc4c710edaa1] Linux 6.4-rc7 git bisect start 'HEAD' 'v6.4-rc7' # good: [a5838c78db6a3a02e8d221e588c948f792e7f256] Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git git bisect good a5838c78db6a3a02e8d221e588c948f792e7f256 # bad: [cca41cc0b5485a0ec20707316c1a00082c01a2af] Merge branch 'for-next' of git://git.kernel.dk/linux-block.git git bisect bad cca41cc0b5485a0ec20707316c1a00082c01a2af # good: [901bdf5ea1a836400ee69aa32b04e9c209271ec7] Merge tag 'amd-drm-next-6.5-2023-06-09' of https://gitlab.freedesktop.org/agd5f/linux into drm-next git bisect good 901bdf5ea1a836400ee69aa32b04e9c209271ec7 # good: [b4666c320b8113d94b3f4624054562e7add57e4a] Merge branch 'for-next' of https://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394.git git bisect good b4666c320b8113d94b3f4624054562e7add57e4a # good: [b2c28785b125acb28a681462510297410cbbabd7] ASoC: dt-bindings: microchip,sama7g5-pdmc: Simplify "microchip,mic-pos" constraints git bisect good b2c28785b125acb28a681462510297410cbbabd7 # bad: [9d217fb0e778d69b2e3988efbc441976c0fb29b5] nvme: reorder fields in 'struct nvme_ctrl' git bisect bad 9d217fb0e778d69b2e3988efbc441976c0fb29b5 # good: [20d099756b98fa6b5b838448b1ffbce46f4f3283] block: Replace all non-returning strlcpy with strscpy git bisect good 20d099756b98fa6b5b838448b1ffbce46f4f3283 # bad: [93c8f6f38be67e30adf8d8eb5e7e9ccb89326119] pktcdvd: Drop redundant castings for sector_t git bisect bad 93c8f6f38be67e30adf8d8eb5e7e9ccb89326119 # bad: [c8643c72bc42781fc169c6498a3902bec447099e] init: pass root_device_name explicitly git bisect bad c8643c72bc42781fc169c6498a3902bec447099e # good: [87efb39075be6a288cd7f23858f15bd01c83028a] fs: add a method to shut down the file system git bisect good 87efb39075be6a288cd7f23858f15bd01c83028a # good: [aa5f6ed8c21ec1aa5fd688118d8d5cd87c5ffc1d] driver core: return bool from driver_probe_done git bisect good aa5f6ed8c21ec1aa5fd688118d8d5cd87c5ffc1d # good: [cc89c63e2fe37d476357c82390dfb12edcd41cdd] PM: hibernate: move finding the resume device out of software_resume git bisect good cc89c63e2fe37d476357c82390dfb12edcd41cdd # good: [e3102722ffe77094ba9e7e46380792b3dd8a7abd] init: rename mount_block_root to mount_root_generic git bisect good e3102722ffe77094ba9e7e46380792b3dd8a7abd # good: [a6a41d39c2d91ff2543d31b6cc6070f3957e3aea] init: refactor mount_root git bisect good a6a41d39c2d91ff2543d31b6cc6070f3957e3aea # first bad commit: [c8643c72bc42781fc169c6498a3902bec447099e] init: pass root_device_name explicitly
On Fri, Jun 23, 2023 at 05:08:59PM -0700, Guenter Roeck wrote: > Hi, > > On Wed, May 31, 2023 at 02:55:19PM +0200, Christoph Hellwig wrote: > > Instead of declaring root_device_name as a global variable pass it as an > > argument to the functions using it. > > > > Signed-off-by: Christoph Hellwig <hch@lst.de> > > This patch results in the following build error when trying to build > xtensa:tinyconfig. > > WARNING: modpost: vmlinux: section mismatch in reference: strcpy.isra.0+0x14 (section: .text.unlikely) -> initcall_level_names (section: .init.data) > ERROR: modpost: Section mismatches detected. I can reproduce these with gcc 13.1 on xtensa, but the report makes no sense to me. If I disable CONFIG_CC_OPTIMIZE_FOR_SIZE it now reports a similar warning for put_page intead of strcpy which seems just as arcance.
On 6/26/23 00:53, Christoph Hellwig wrote: > On Fri, Jun 23, 2023 at 05:08:59PM -0700, Guenter Roeck wrote: >> Hi, >> >> On Wed, May 31, 2023 at 02:55:19PM +0200, Christoph Hellwig wrote: >>> Instead of declaring root_device_name as a global variable pass it as an >>> argument to the functions using it. >>> >>> Signed-off-by: Christoph Hellwig <hch@lst.de> >> >> This patch results in the following build error when trying to build >> xtensa:tinyconfig. >> >> WARNING: modpost: vmlinux: section mismatch in reference: strcpy.isra.0+0x14 (section: .text.unlikely) -> initcall_level_names (section: .init.data) >> ERROR: modpost: Section mismatches detected. > > I can reproduce these with gcc 13.1 on xtensa, but the report makes > no sense to me. If I disable CONFIG_CC_OPTIMIZE_FOR_SIZE it now reports > a similar warning for put_page intead of strcpy which seems just as > arcance. > I don't see that (I tried 11.3, 11.4, 12.3, and 13.1), but then I am not sure if this is worth tracking down. I just force CONFIG_SECTION_MISMATCH_WARN_ONLY=y for xtensa builds instead. Guenter
On Mon, Jun 26, 2023 at 8:10 AM Guenter Roeck <linux@roeck-us.net> wrote: > > On 6/26/23 00:53, Christoph Hellwig wrote: > > On Fri, Jun 23, 2023 at 05:08:59PM -0700, Guenter Roeck wrote: > >> Hi, > >> > >> On Wed, May 31, 2023 at 02:55:19PM +0200, Christoph Hellwig wrote: > >>> Instead of declaring root_device_name as a global variable pass it as an > >>> argument to the functions using it. > >>> > >>> Signed-off-by: Christoph Hellwig <hch@lst.de> > >> > >> This patch results in the following build error when trying to build > >> xtensa:tinyconfig. > >> > >> WARNING: modpost: vmlinux: section mismatch in reference: strcpy.isra.0+0x14 (section: .text.unlikely) -> initcall_level_names (section: .init.data) > >> ERROR: modpost: Section mismatches detected. > > > > I can reproduce these with gcc 13.1 on xtensa, but the report makes > > no sense to me. If I disable CONFIG_CC_OPTIMIZE_FOR_SIZE it now reports > > a similar warning for put_page intead of strcpy which seems just as > > arcance. > > > > I don't see that (I tried 11.3, 11.4, 12.3, and 13.1), but then I am not sure > if this is worth tracking down. I just force CONFIG_SECTION_MISMATCH_WARN_ONLY=y > for xtensa builds instead. I believe it's yet another manifestation of the following issue: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92938 Hunting is still on my todo list, but it's quite low, so I guess forcing CONFIG_SECTION_MISMATCH_WARN_ONLY=y for xtensa is the right thing to do for now.
diff --git a/init/do_mounts.c b/init/do_mounts.c index e708b02d9d6566..1405ee7218bf00 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c @@ -28,7 +28,6 @@ #include "do_mounts.h" int root_mountflags = MS_RDONLY | MS_SILENT; -static char * __initdata root_device_name; static char __initdata saved_root_name[64]; static int root_wait; @@ -391,7 +390,7 @@ static int __init do_mount_root(const char *name, const char *fs, return ret; } -void __init mount_root_generic(char *name, int flags) +void __init mount_root_generic(char *name, char *pretty_name, int flags) { struct page *page = alloc_page(GFP_KERNEL); char *fs_names = page_address(page); @@ -425,7 +424,7 @@ void __init mount_root_generic(char *name, int flags) * and give them a list of the available devices */ printk("VFS: Cannot open root device \"%s\" or %s: error %d\n", - root_device_name, b, err); + pretty_name, b, err); printk("Please append a correct \"root=\" boot option; here are the available partitions:\n"); printk_all_partitions(); @@ -541,7 +540,7 @@ static bool __init fs_is_nodev(char *fstype) return ret; } -static int __init mount_nodev_root(void) +static int __init mount_nodev_root(char *root_device_name) { char *fs_names, *fstype; int err = -EINVAL; @@ -569,21 +568,21 @@ static int __init mount_nodev_root(void) } #ifdef CONFIG_BLOCK -static void __init mount_block_root(void) +static void __init mount_block_root(char *root_device_name) { int err = create_dev("/dev/root", ROOT_DEV); if (err < 0) pr_emerg("Failed to create /dev/root: %d\n", err); - mount_root_generic("/dev/root", root_mountflags); + mount_root_generic("/dev/root", root_device_name, root_mountflags); } #else -static inline void mount_block_root(void) +static inline void mount_block_root(char *root_device_name) { } #endif /* CONFIG_BLOCK */ -void __init mount_root(void) +void __init mount_root(char *root_device_name) { switch (ROOT_DEV) { case Root_NFS: @@ -593,11 +592,12 @@ void __init mount_root(void) mount_cifs_root(); break; case 0: - if (root_device_name && root_fs_names && mount_nodev_root() == 0) + if (root_device_name && root_fs_names && + mount_nodev_root(root_device_name) == 0) break; fallthrough; default: - mount_block_root(); + mount_block_root(root_device_name); break; } } @@ -607,6 +607,8 @@ void __init mount_root(void) */ void __init prepare_namespace(void) { + char *root_device_name; + if (root_delay) { printk(KERN_INFO "Waiting %d sec before mounting root device...\n", root_delay); @@ -628,7 +630,8 @@ void __init prepare_namespace(void) root_device_name = saved_root_name; if (!strncmp(root_device_name, "mtd", 3) || !strncmp(root_device_name, "ubi", 3)) { - mount_root_generic(root_device_name, root_mountflags); + mount_root_generic(root_device_name, root_device_name, + root_mountflags); goto out; } ROOT_DEV = name_to_dev_t(root_device_name); @@ -636,7 +639,7 @@ void __init prepare_namespace(void) root_device_name += 5; } - if (initrd_load()) + if (initrd_load(root_device_name)) goto out; /* wait for any asynchronous scanning to complete */ @@ -649,7 +652,7 @@ void __init prepare_namespace(void) async_synchronize_full(); } - mount_root(); + mount_root(root_device_name); out: devtmpfs_mount(); init_mount(".", "/", NULL, MS_MOVE, NULL); diff --git a/init/do_mounts.h b/init/do_mounts.h index 33623025f6951a..15e372b00ce704 100644 --- a/init/do_mounts.h +++ b/init/do_mounts.h @@ -10,8 +10,8 @@ #include <linux/root_dev.h> #include <linux/init_syscalls.h> -void mount_root_generic(char *name, int flags); -void mount_root(void); +void mount_root_generic(char *name, char *pretty_name, int flags); +void mount_root(char *root_device_name); extern int root_mountflags; static inline __init int create_dev(char *name, dev_t dev) @@ -33,11 +33,11 @@ static inline int rd_load_image(char *from) { return 0; } #endif #ifdef CONFIG_BLK_DEV_INITRD - -bool __init initrd_load(void); - +bool __init initrd_load(char *root_device_name); #else - -static inline bool initrd_load(void) { return false; } +static inline bool initrd_load(char *root_device_name) +{ + return false; + } #endif diff --git a/init/do_mounts_initrd.c b/init/do_mounts_initrd.c index 686d1ff3af4bb1..425f4bcf4b77e0 100644 --- a/init/do_mounts_initrd.c +++ b/init/do_mounts_initrd.c @@ -83,7 +83,7 @@ static int __init init_linuxrc(struct subprocess_info *info, struct cred *new) return 0; } -static void __init handle_initrd(void) +static void __init handle_initrd(char *root_device_name) { struct subprocess_info *info; static char *argv[] = { "linuxrc", NULL, }; @@ -95,7 +95,8 @@ static void __init handle_initrd(void) real_root_dev = new_encode_dev(ROOT_DEV); create_dev("/dev/root.old", Root_RAM0); /* mount initrd on rootfs' /root */ - mount_root_generic("/dev/root.old", root_mountflags & ~MS_RDONLY); + mount_root_generic("/dev/root.old", root_device_name, + root_mountflags & ~MS_RDONLY); init_mkdir("/old", 0700); init_chdir("/old"); @@ -117,7 +118,7 @@ static void __init handle_initrd(void) init_chdir("/"); ROOT_DEV = new_decode_dev(real_root_dev); - mount_root(); + mount_root(root_device_name); printk(KERN_NOTICE "Trying to move old root to /initrd ... "); error = init_mount("/old", "/root/initrd", NULL, MS_MOVE, NULL); @@ -133,7 +134,7 @@ static void __init handle_initrd(void) } } -bool __init initrd_load(void) +bool __init initrd_load(char *root_device_name) { if (mount_initrd) { create_dev("/dev/ram", Root_RAM0); @@ -145,7 +146,7 @@ bool __init initrd_load(void) */ if (rd_load_image("/initrd.image") && ROOT_DEV != Root_RAM0) { init_unlink("/initrd.image"); - handle_initrd(); + handle_initrd(root_device_name); return true; } }
Instead of declaring root_device_name as a global variable pass it as an argument to the functions using it. Signed-off-by: Christoph Hellwig <hch@lst.de> --- init/do_mounts.c | 29 ++++++++++++++++------------- init/do_mounts.h | 14 +++++++------- init/do_mounts_initrd.c | 11 ++++++----- 3 files changed, 29 insertions(+), 25 deletions(-)