bootm does not work if netconsole is enabled
Hi Joe, Hi Tom,
If i have the netconsole enabled i cannot boot linux using the bootm command. This bug exists at least in 2013.01.01 and 2013.04-rc2 :/
Here is the output of the serial console of a successful startup:
## Booting kernel from Legacy Image at 00100000 ...
Image Name: Linux-3.8.0-rc1-00004-g270c0a0-d Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 2799632 Bytes = 2.7 MiB
Load Address: 00008000
Entry Point: 00008000
Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 00800000 ...
Image Name:
Image Type: ARM Linux RAMDisk Image (uncompressed)
Data Size: 636966 Bytes = 622 KiB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
## Flattened Device Tree blob at 00700000
Booting using the fdt blob at 0x00700000 Loading Kernel Image ... OK
OK
Loading Ramdisk to 03aad000, end 03b48826 ... OK Loading Device Tree to 03aa8000, end 03aacedd ... OK
Starting kernel ...
[.. more linux kernel output ..]
If the netconsole is enabled, eg. "stdin = stdout = stderr = nc", i see only the following output on the netconsole and then nothing more happens:
## Booting kernel from Legacy Image at 00100000 ...
Image Name: Linux-3.8.0-rc1-00004-g270c0a0-d Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 2799632 Bytes = 2.7 MiB
Load Address: 00008000
Entry Point: 00008000
Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 00800000 ...
Image Name:
Image Type: ARM Linux RAMDisk Image (uncompressed)
Data Size: 636966 Bytes = 622 KiB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
## Flattened Device Tree blob at 00700000
Booting using the fdt blob at 0x00700000
I've tracked this down to the eth_halt() call in cmd_bootm.c:647. What is the purpose of this call? I guess the NIC should be shut down prior to booting linux. OTOH, there are still messages printed after this call, and i suppose the netconsole tries to bring the network back up. If i remove this call, everything works as expected.
Anyway, i can definitely say, that the linux kernel is not starting. Eg. it is not only the output that stops working.
FYI, i'm using the mvgbe driver.
Let me know if i can do some more debugging or provide more information. Hopefully this will be fixed in 2013.04 :)
Signature · 1 line
Michael
Hi Michael,
I just tested this on my Zynq target and it worked. However, you make a good point that it is possible for there to be more traces after the eth_halt call. I can't imagine the stack would like that in all situations (since eth_init() will not be called again by netconsole). I think the solution to this is probably to disable netconsole somehow before the eth_halt command, so subsequent prints do not try to use Ethernet again. However, most of the things you might switch to are conditional, such as a nulldev or silent. Any thoughts on how you would like to see it solved?
Cheers,
-Joe
Quoted 71 lines · Michael Walle
Hi Joe, Hi Tom,
If i have the netconsole enabled i cannot boot linux using the bootm command. This bug exists at least in 2013.01.01 and 2013.04-rc2 :/
Here is the output of the serial console of a successful startup:
## Booting kernel from Legacy Image at 00100000 ...
Image Name: Linux-3.8.0-rc1-00004-g270c0a0-d Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 2799632 Bytes = 2.7 MiBLoad Address: 00008000
Entry Point: 00008000
Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 00800000 ...
Image Name:Image Type: ARM Linux RAMDisk Image (uncompressed) Data Size: 636966 Bytes = 622 KiB Load Address: 00000000 Entry Point: 00000000 Verifying Checksum ... OK## Flattened Device Tree blob at 00700000
Booting using the fdt blob at0x00700000Loading Kernel Image ... OK
OK
Loading Ramdisk to03aad000, end03b48826... OK Loading Device Tree to03aa8000, end03aacedd... OKStarting kernel ...
[.. more linux kernel output ..]
If the netconsole is enabled, eg. "stdin = stdout = stderr = nc", i see only the following output on the netconsole and then nothing more happens:
## Booting kernel from Legacy Image at 00100000 ...
Image Name: Linux-3.8.0-rc1-00004-g270c0a0-d Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 2799632 Bytes = 2.7 MiBLoad Address: 00008000
Entry Point: 00008000
Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 00800000 ...
Image Name:Image Type: ARM Linux RAMDisk Image (uncompressed) Data Size: 636966 Bytes = 622 KiB Load Address: 00000000 Entry Point: 00000000 Verifying Checksum ... OK## Flattened Device Tree blob at 00700000
Booting using the fdt blob at0x00700000I've tracked this down to the
eth_halt()call in cmd_bootm.c:647. What is the purpose of this call? I guess the NIC should be shut down prior to booting linux. OTOH, there are still messages printed after this call, and i suppose the netconsole tries to bring the network back up. If i remove this call, everything works as expected.
Anyway, i can definitely say, that the linux kernel is not starting. Eg. it is not only the output that stops working.FYI, i'm using the mvgbe driver.
Let me know if i can do some more debugging or provide more information. Hopefully this will be fixed in 2013.04 :)
--
Michael
Quoted 11 lines · Joe Hershberger
Hi Michael,
I just tested this on my Zynq target and it worked. However, you make a good point that it is possible for there to be more traces after the
eth_haltcall. I can't imagine the stack would like that in all situations (sinceeth_init()will not be called again by netconsole). I think the solution to this is probably to disable netconsole somehow before theeth_haltcommand, so subsequent prints do not try to use Ethernet again. However, most of the things you might switch to are conditional, such as a nulldev or silent. Any thoughts on how you would like to see it solved?
Hi Joe,
disabling the network console before control is handed over to an operating system sounds reasonable.
If i understand you correctly, the network will only be halted once the bootloader starts an operating system. Then what do you think about making either the nc_send_packet() or nc_putc()/nc_puts() function a noop when the network is halted?
Signature · 1 line
michael
Hi Michael,
Quoted 15 lines · Michael Walle
Quoted 11 lines · Joe Hershberger
Hi Michael,
I just tested this on my Zynq target and it worked. However, you make a good point that it is possible for there to be more traces after the
eth_haltcall. I can't imagine the stack would like that in all situations (sinceeth_init()will not be called again by netconsole). I think the solution to this is probably to disable netconsole somehow before theeth_haltcommand, so subsequent prints do not try to use Ethernet again. However, most of the things you might switch to are conditional, such as a nulldev or silent. Any thoughts on how you would like to see it solved?Hi Joe,
Quoted 7 lines
disabling the network console before control is handed over to an operating system sounds reasonable.
If i understand you correctly, the network will only be halted once the bootloader starts an operating system. Then what do you think about making either the
nc_send_packet()or nc_putc()/nc_puts() function a noop when the network is halted?
It's not quite that simple since the state does not really reflect the hardware (I know... that's my fault). I can try to fix this for next release, but it is probably too risky to put into the April release. In the mean time a simple work-around is to use silent or nulldev on your target and turn off netconsole as part of your boot script (before you bootm).
Cheers,
-Joe
Hi Joe,
Am Mittwoch 10 April 2013, 18:13:57 schrieb Joe Hershberger:
Quoted 8 lines
Quoted 4 lines
If i understand you correctly, the network will only be halted once the bootloader starts an operating system. Then what do you think about making either the
nc_send_packet()or nc_putc()/nc_puts() function a noop when the network is halted?It's not quite that simple since the state does not really reflect the hardware (I know... that's my fault). I can try to fix this for next release, but it is probably too risky to put into the April release.
Agreed. Let me know if i can test something for you.
Quoted 3 lines
In the mean time a simple work-around is to use silent or nulldev on your target and turn off netconsole as part of your boot script (before you bootm).
I worked around this bug by setting the stdout back to serial just before the bootm command.
Signature · 1 line
michael
Am 2013-04-10 18:13, schrieb Joe Hershberger:
Quoted 35 lines
Hi Michael,
Quoted 23 lines · Michael Walle
Quoted 16 lines · Joe Hershberger
Hi Michael,
I just tested this on my Zynq target and it worked. However, you make
a good point that it is possible for there to be more traces after theeth_haltcall. I can't imagine the stack would like that in all situations (sinceeth_init()will not be called again by netconsole).
I think the solution to this is probably to disable netconsole somehow
before theeth_haltcommand, so subsequent prints do not try to use Ethernet again. However, most of the things you might switch to are
conditional, such as a nulldev or silent. Any thoughts on how you would like to see it solved?Hi Joe,
disabling the network console before control is handed over to an operating system sounds reasonable.
Quoted 7 lines
If i understand you correctly, the network will only be halted once the
bootloader starts an operating system. Then what do you think about making
either thenc_send_packet()or nc_putc()/nc_puts() function a noop when
the network is halted?
Quoted 4 lines
It's not quite that simple since the state does not really reflect the
hardware (I know... that's my fault). I can try to fix this for next release, but it is probably too risky to put into the April release.
Ping :)
Signature · 1 line
michael
Am Mittwoch, 10. April 2013, 18:13:57 schrieb Joe Hershberger:
Quoted 11 lines
Quoted 7 lines
disabling the network console before control is handed over to an operating system sounds reasonable.
If i understand you correctly, the network will only be halted once the bootloader starts an operating system. Then what do you think about making either the
nc_send_packet()or nc_putc()/nc_puts() function a noop when the network is halted?It's not quite that simple since the state does not really reflect the hardware (I know... that's my fault). I can try to fix this for next release, but it is probably too risky to put into the April release.
ping #2 :)
Signature · 1 line
michael
PATCH 1/1 Enable serial console only before booting
When netconsole is active, some boards fail to boot. This patch enables only the serial console before control is handed by another operating system.
---
Hello,
I am facing the same problem with LaCie kirkwood boards. I took a simple approach for fixing this issue. This works for me ...
Any comments are welcome :)
Fr?d?ric
common/cmd_bootm.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
common/cmd_bootm.c +14 -0
@@ -62,6 +62,17 @@#include <linux/lzo.h> #endif /* CONFIG_LZO */ + +#if defined(CONFIG_NETCONSOLE ) +#include <iomux.h> +void console_set_serial_unconditionally (void ) +{ +iomux_doenv (stdin,"serial" ); +iomux_doenv (stdout,"serial" ); +iomux_doenv (stderr,"serial" ); +} +#endif +DECLARE_GLOBAL_DATA_PTR ;#ifndef CONFIG_SYS_BOOTM_LEN
@@ -577,6 +588,7 @@ static int do_bootm_subcommand(cmd_tbl_t *cmdtp, int flag, int argc,* Stop the ethernet stack if NetConsole could have * left it up */ +console_set_serial_unconditionally ("nc" );eth_halt ();#endif arch_preboot_os ();
@@ -645,6 +657,7 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])#ifdef CONFIG_NETCONSOLE /* Stop the ethernet stack if NetConsole could have left it up */ +console_set_serial_unconditionally ("nc" );eth_halt ();#endif
@@ -1849,6 +1862,7 @@ static int do_bootz(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])#ifdef CONFIG_NETCONSOLE /* Stop the ethernet stack if NetConsole could have left it up */ +console_set_serial_unconditionally ("nc" );eth_halt ();#endif
Signature · 1 line
1.8.1.2
PATCH 1/1 Enable serial console only before booting
Dear Fr?d?ric Leroy,
Quoted 3 lines · In message <[email protected]> you wrote:
When netconsole is active, some boards fail to boot. This patch enables only the serial console before control is handed by another operating system.
I really hate adding such fixes without understanding the exact nature of the problem.
Could you please be so kind and explain in which way booting fails when netconsole is active? On what exactly the "some boards" are that fail that way? And why this does not appear to be a problem on other boards? (or is it?) And thy the "some boards" cannot be fixed in such a way to behave as the rest of the boards (where it's not a problem) ?
PATCH 1/1 Enable serial console only before booting
In reply to Frédéric LeroyQuoted 5 lines · Fr??d??ric Leroy
When netconsole is active, some boards fail to boot. This patch enables only the serial console before control is handed by another operating system.
Signed-off-by Fr??d??ric Leroy <[email protected]>
Quoted 9 lines
---
Hello,
I am facing the same problem with LaCie kirkwood boards. I took a simple approach for fixing this issue. This works for me ...
Any comments are welcome :)
Can you please re-base this to mainline and re-post? Also, can you expand on the comments in the commit message to explain the problem with netconsole and thus why this fixes it?
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130905/65eed12c/attachment.pgp>
PATCH 1/1 Fix loading freeze when netconsole is active
Netconsole calls eth_halt() before giving control to another operating system.
But the state machine of netconsole don't take it into account. Thus, netconsole calls network functions of an halted network device, making the whole system freeze.
Rather than modifying the state machine of netconsole, we just unregister the current network device before booting. It does work because nc_send_packet() verifies that the current network device is not null.
--- common/cmd_bootm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Hello Tom,
I have made a cleaner version of my patch against master.
I didn't touch the netconsole code because I don't fully understand it.
Regards,
common/cmd_bootm.c +3 -3
@@ -577,7 +577,7 @@ static int do_bootm_subcommand(cmd_tbl_t *cmdtp, int flag, int argc,* Stop the ethernet stack if NetConsole could have * left it up */ -eth_halt (); +eth_unregister (eth_get_dev ());#endif arch_preboot_os ();boot_fn (BOOTM_STATE_OS_GO , argc, argv, &images);
@@ -645,7 +645,7 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])#ifdef CONFIG_NETCONSOLE /* Stop the ethernet stack if NetConsole could have left it up */ -eth_halt (); +eth_unregister (eth_get_dev ());#endif #if defined(CONFIG_CMD_USB )
@@ -1849,7 +1849,7 @@ static int do_bootz(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])#ifdef CONFIG_NETCONSOLE /* Stop the ethernet stack if NetConsole could have left it up */ -eth_halt (); +eth_unregister (eth_get_dev ());#endif #if defined(CONFIG_CMD_USB )
Signature · 1 line
1.8.1.2
PATCH v2 1/1 Fix loading freeze when netconsole is active
In reply to Tom RiniNetconsole calls eth_halt() before giving control to another operating system.
But the state machine of netconsole don't take it into account. Thus, netconsole calls network functions of an halted network device, making the whole system freeze.
Rather than modifying the state machine of netconsole, we just unregister the current network device before booting. It does work because nc_send_packet() verifies that the current network device is not null.
---
Sorry, I was dumb. I don't know why I removed call to eth_halt(). eth_unregister() don't halt the device.
Changes in v2:
don't remove the call to eth_halt()
common/cmd_bootm.c | 3 +++ 1 file changed, 3 insertions(+)
common/cmd_bootm.c +3 -0
@@ -578,6 +578,7 @@ static int do_bootm_subcommand(cmd_tbl_t *cmdtp, int flag, int argc,* left it up */ eth_halt (); +eth_unregister (eth_get_dev ());#endif arch_preboot_os ();boot_fn (BOOTM_STATE_OS_GO , argc, argv, &images);
@@ -646,6 +647,7 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])#ifdef CONFIG_NETCONSOLE /* Stop the ethernet stack if NetConsole could have left it up */ eth_halt (); +eth_unregister (eth_get_dev ());#endif #if defined(CONFIG_CMD_USB )
@@ -1850,6 +1852,7 @@ static int do_bootz(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])#ifdef CONFIG_NETCONSOLE /* Stop the ethernet stack if NetConsole could have left it up */ eth_halt (); +eth_unregister (eth_get_dev ());#endif #if defined(CONFIG_CMD_USB )
Signature · 1 line
1.8.1.2
PATCH v2 1/1 Fix loading freeze when netconsole is active
Quoted 10 lines · Frederic Leroy
Netconsole calls
eth_halt()before giving control to another operating system.
But the state machine of netconsole don't take it into account. Thus, netconsole calls network functions of an halted network device, making the whole system freeze.
Rather than modifying the state machine of netconsole, we just unregister the current network device before booting. It does work becausenc_send_packet()verifies that the current network device is not null.Signed-off-by Fr??d??ric Leroy <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130921/1ccb4be8/attachment.pgp>
PATCH 1/1 Enable serial console only before booting
In reply to Michael WalleWhen netconsole is active, some boards fail to boot. This patch enables only the serial console before control is handed over to another operating system.
---
Sorry for the noise, I tend to post faster than my own swadow ...
Changes in v2 :
- remove unused argument from console_set_serial_unconditionally call
- fix platforms where CONFIG_CONSOLE_MUX is not defined
common/cmd_bootm.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
common/cmd_bootm.c +15 -0
@@ -62,6 +62,18 @@#include <linux/lzo.h> #endif /* CONFIG_LZO */ +#if defined(CONFIG_NETCONSOLE ) +#include <iomux.h> +void console_set_serial_unconditionally (void ) +{ +#if defined(CONFIG_CONSOLE_MUX ) +iomux_doenv (stdin,"serial" ); +iomux_doenv (stdout,"serial" ); +iomux_doenv (stderr,"serial" ); +#endif +} +#endif +DECLARE_GLOBAL_DATA_PTR ;#ifndef CONFIG_SYS_BOOTM_LEN
@@ -577,6 +589,7 @@ static int do_bootm_subcommand(cmd_tbl_t *cmdtp, int flag, int argc,* Stop the ethernet stack if NetConsole could have * left it up */ +console_set_serial_unconditionally ();eth_halt ();#endif arch_preboot_os ();
@@ -645,6 +658,7 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])#ifdef CONFIG_NETCONSOLE /* Stop the ethernet stack if NetConsole could have left it up */ +console_set_serial_unconditionally ();eth_halt ();#endif
@@ -1849,6 +1863,7 @@ static int do_bootz(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])#ifdef CONFIG_NETCONSOLE /* Stop the ethernet stack if NetConsole could have left it up */ +console_set_serial_unconditionally ();eth_halt ();#endif
Signature · 1 line
1.8.1.2