[U-Boot,v2] Fix loading freeze when netconsole is active

Submitted by Frederic Leroy on Sept. 10, 2013, 10:02 a.m.

Details

Message ID 1378807351-7388-1-git-send-email-fredo@starox.org
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Frederic Leroy Sept. 10, 2013, 10:02 a.m.
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.

Signed-off-by: Frédéric Leroy <fredo@starox.org>
---

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(+)

Comments

Tom Rini Sept. 21, 2013, 12:06 p.m.
On Tue, Sep 10, 2013 at 12:02:31PM +0200, Frederic Leroy wrote:

> 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.
> 
> Signed-off-by: Fr??d??ric Leroy <fredo@starox.org>

Applied to u-boot/master, thanks!

Patch hide | download patch | download mbox

diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 15f4599..549a914 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -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)