drivers/net: Makefile, fix netconsole link order
Subsystems (3)
PATCH 1/1 drivers/net: Makefile, fix netconsole link order
Commit 88491d8(drivers/net: Kconfig & Makefile cleanup) causes a regression that netconsole does not work if netconsole and network device driver are build into kernel, because netconsole is linked before network device driver.
Fixes it by moving netconsole.o after network device driver.
--- drivers/net/Makefile | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
drivers/net/Makefile +6 -1
@@ -14,7 +14,6 @@ obj-$(CONFIG_MACVTAP) += macvtap.o obj-$(CONFIG_MII) += mii.o obj-$(CONFIG_MDIO) += mdio.o obj-$(CONFIG_NET) += Space.o loopback.o -obj-$(CONFIG_NETCONSOLE) += netconsole.o obj-$(CONFIG_PHYLIB) += phy/ obj-$(CONFIG_RIONET) += rionet.o obj-$(CONFIG_TUN) += tun.o
@@ -66,3 +65,9 @@ obj-$(CONFIG_USB_USBNET) += usb/ obj-$(CONFIG_USB_ZD1201) += usb/ obj-$(CONFIG_USB_IPHETH) += usb/ obj-$(CONFIG_USB_CDC_PHONET) += usb/ + +# +# If netconsole and network device driver are build-in, +# netconsole must be linked after network device driver +# +obj-$(CONFIG_NETCONSOLE) += netconsole.o
Signature · 1 line
1.7.2.5
Quoted 25 lines · On Tue, 06 Sep 2011 16:35:29 +0800 Lin Ming <[email protected]> wrote:
Commit 88491d8(drivers/net:
Kconfig&Makefilecleanup) causes a regression that netconsole does not work if netconsole and network device driver are build into kernel, because netconsole is linked before network device driver.Fixes it by moving netconsole.o after network device driver.
Signed-off-by Lin Ming <[email protected]>--- drivers/net/Makefile | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)drivers/net/Makefile +0
-1@@ -14,7 +14,6 @@ obj-$(CONFIG_MACVTAP) += macvtap.o obj-$(CONFIG_MII) += mii.o obj-$(CONFIG_MDIO) += mdio.o obj-$(CONFIG_NET) += Space.o loopback.o -obj-$(CONFIG_NETCONSOLE) += netconsole.o obj-$(CONFIG_PHYLIB) += phy/ obj-$(CONFIG_RIONET) += rionet.o obj-$(CONFIG_TUN) += tun.o
drivers/net/Makefile obj-$(CONFIG_USB_USBNET) += usb/ · line 73
Quoted 9 lines
drivers/net/Makefile +6
-0@@ -66,3 +65,9 @@ obj-$(CONFIG_USB_USBNET) += usb/ obj-$(CONFIG_USB_ZD1201) += usb/ obj-$(CONFIG_USB_IPHETH) += usb/ obj-$(CONFIG_USB_CDC_PHONET) += usb/ + +# +# If netconsole and network device driver are build-in, +# netconsole must be linked after network device driver +# +obj-$(CONFIG_NETCONSOLE) += netconsole.o
It would be preferable to fix this with initcall ordering. Perhaps by switching init_netconsole() to subsys_initcall.
Quoted 32 lines · Andrew Morton
Quoted 29 lines · On Tue, 06 Sep 2011 16:35:29 +0800 Lin Ming <[email protected]> wrote:
Commit 88491d8(drivers/net:
Kconfig&Makefilecleanup) causes a regression that netconsole does not work if netconsole and network device driver are build into kernel, because netconsole is linked before network device driver.Fixes it by moving netconsole.o after network device driver.
Signed-off-by Lin Ming <[email protected]>--- drivers/net/Makefile | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)drivers/net/Makefile +1
-1@@ -14,7 +14,6 @@ obj-$(CONFIG_MACVTAP) += macvtap.o obj-$(CONFIG_MII) += mii.o obj-$(CONFIG_MDIO) += mdio.o obj-$(CONFIG_NET) += Space.o loopback.o -obj-$(CONFIG_NETCONSOLE) += netconsole.o obj-$(CONFIG_PHYLIB) += phy/ obj-$(CONFIG_RIONET) += rionet.o obj-$(CONFIG_TUN) += tun.o@@ -66,3 +65,9 @@ obj-$(CONFIG_USB_USBNET) += usb/ obj-$(CONFIG_USB_ZD1201) += usb/ obj-$(CONFIG_USB_IPHETH) += usb/ obj-$(CONFIG_USB_CDC_PHONET) += usb/ +
Quoted 8 lines
drivers/net/Makefile obj-$(CONFIG_USB_USBNET) += usb/ · line 73
Quoted 5 lines
drivers/net/Makefile +5
-0+# +# If netconsole and network device driver are build-in, +# netconsole must be linked after network device driver +# +obj-$(CONFIG_NETCONSOLE) += netconsole.oIt would be preferable to fix this with initcall ordering. Perhaps by switching
init_netconsole()tosubsys_initcall.
subsys_initcall is defined as __define_initcall("4",fn,4). In !MODULE case, device driver module_int() is defined as __define_initcall("6",fn,6)
If we use subsys_initcall for init_netconsole, it will still be called before network device driver is initialized.
How about late_initcall?
(Not tested yet)
Quoted 1 line
From
11f4f035e96ff430192d0a75552dd715acb5f3b8Mon Sep 17 00:00:00 2001
From: Lin Ming <[email protected]>
Date: Sat, 10 Sep 2011 10:36:10 +0800
Subject: [PATCH] drivers/net: Makefile, fix netconsole link order
Commit 88491d8(drivers/net: Kconfig & Makefile cleanup) causes a regression that netconsole does not work if netconsole and network device driver are build into kernel, because netconsole is linked before network device driver.
Fixes it by switching init_netconsole() to late_initcall if it's build-in.
--- drivers/net/netconsole.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/net/netconsole.c +4 -0
@@ -799,5 +799,9 @@ static void __exit cleanup_netconsole(void) } } +#ifdef MODULE module_init (init_netconsole);module_exit (cleanup_netconsole); +#else +late_initcall (init_netconsole); +#endif /* !MODULE */
Signature · 1 line
1.7.2.3
Quoted 10 lines · On Sat, 10 Sep 2011 10:43:32 +0800 Lin Ming <[email protected]> wrote:
Quoted 4 lines · Andrew Morton
Quoted 1 line
+obj-$(CONFIG_NETCONSOLE) += netconsole.o
It would be preferable to fix this with initcall ordering. Perhaps by switching
init_netconsole()tosubsys_initcall.
subsys_initcallis defined as__define_initcall("4",fn,4). In !MODULE case, device drivermodule_int()is defined as__define_initcall("6",fn,6)
oop, yes, I am chronologically challenged.
Quoted 30 lines
If we use
subsys_initcallforinit_netconsole, it will still be called before network device driver is initialized.How about
late_initcall?(Not tested yet)
Quoted 1 line
From
11f4f035e96ff430192d0a75552dd715acb5f3b8Mon Sep 17 00:00:00 2001From: Lin Ming <[email protected]>
Date: Sat, 10 Sep 2011 10:36:10 +0800
Subject: [PATCH]drivers/net:Makefile, fix netconsole link orderCommit 88491d8(drivers/net:
Kconfig&Makefilecleanup) causes a regression that netconsole does not work if netconsole and network device driver are build into kernel, because netconsole is linked before network device driver.Fixes it by switching
init_netconsole()tolate_initcallif it's build-in.Signed-off-by Lin Ming <[email protected]>--- drivers/net/netconsole.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)drivers/net/netconsole.c +0
-0
drivers/net/netconsole.c static void __exit cleanup_netconsole(void) · line 807
Quoted 9 lines
drivers/net/netconsole.c +4
-0@@ -799,5 +799,9 @@ static void __exit cleanup_netconsole(void) } } +#ifdef MODULE module_init (init_netconsole);module_exit (cleanup_netconsole); +#else +late_initcall (init_netconsole); +#endif /* !MODULE */
That should work, unless any net driver is weirdly also using late_initcall. But if there are such drivers, they would have failed with the old Makefile ordering.
Quoted 48 lines · Andrew Morton
Quoted 10 lines · On Sat, 10 Sep 2011 10:43:32 +0800 Lin Ming <[email protected]> wrote:
Quoted 4 lines · Andrew Morton
Quoted 1 line
+obj-$(CONFIG_NETCONSOLE) += netconsole.o
It would be preferable to fix this with initcall ordering. Perhaps by switching
init_netconsole()tosubsys_initcall.
subsys_initcallis defined as__define_initcall("4",fn,4). In !MODULE case, device drivermodule_int()is defined as__define_initcall("6",fn,6)oop, yes, I am chronologically challenged.
Quoted 33 lines
If we use
subsys_initcallforinit_netconsole, it will still be called before network device driver is initialized.How about
late_initcall?(Not tested yet)
Quoted 1 line
From
11f4f035e96ff430192d0a75552dd715acb5f3b8Mon Sep 17 00:00:00 2001From: Lin Ming <[email protected]>
Date: Sat, 10 Sep 2011 10:36:10 +0800
Subject: [PATCH]drivers/net:Makefile, fix netconsole link orderCommit 88491d8(drivers/net:
Kconfig&Makefilecleanup) causes a regression that netconsole does not work if netconsole and network device driver are build into kernel, because netconsole is linked before network device driver.Fixes it by switching
init_netconsole()tolate_initcallif it's build-in.Signed-off-by Lin Ming <[email protected]>--- drivers/net/netconsole.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)drivers/net/netconsole.c +0
-0@@ -799,5 +799,9 @@ static void __exit cleanup_netconsole(void) } }
Quoted 10 lines
drivers/net/netconsole.c static void __exit cleanup_netconsole(void) · line 807
Quoted 6 lines
drivers/net/netconsole.c +4
-0+#ifdef MODULE module_init (init_netconsole);module_exit (cleanup_netconsole); +#else +late_initcall (init_netconsole); +#endif /* !MODULE */ That should work, unless any net driver is weirdly also using
late_initcall. But if there are such drivers, they would have failed with the oldMakefileordering.
Yes.
BTW, may I get your ACK after testing this patch?
Thanks.