On my system the kernel processes the "kgdb_earlycon" parameter before the "kgdbcon" parameter. When we setup "kgdb_earlycon" we'll end up in kgdb_register_callbacks() and "kgdb_use_con" won't have been set yet so we'll never get around to starting "kgdbcon". Let's remedy this by detecting that the IO module was already registered when setting "kgdb_use_con" and registering the console then. As part of this, to avoid pre-declaring things, move the handling of the "kgdbcon" further down in the file.
Showing the changes to kernel/debug/debug_core.c (1 of 1 file). Show all
Unified · Split
| @@ -94,14 +94,6 @@ int dbg_switch_cpu; · 93 unmodified lines | ||
| 94 | 94 | /* Use kdb or gdbserver mode */ |
| 95 | 95 | int dbg_kdb_mode = 1; |
| 96 | 96 | |
| 97 | −static int __init opt_kgdb_con(char *str) | |
| 98 | −{ | |
| 99 | − kgdb_use_con = 1; | |
| 100 | − return 0; | |
| 101 | −} | |
| 102 | − | |
| 103 | −early_param("kgdbcon", opt_kgdb_con); | |
| 104 | − | |
| 105 | 97 | module_param(kgdb_use_con, int, 0644); |
| 106 | 98 | module_param(kgdbreboot, int, 0644); |
| 107 | 99 | |
| @@ -920,6 +912,20 @@ static struct console kgdbcons = { · 812 unmodified lines | ||
| 920 | 912 | .index = -1, |
| 921 | 913 | }; |
| 922 | 914 | |
| 915 | +static int __init opt_kgdb_con(char *str) | |
| 916 | +{ | |
| 917 | + kgdb_use_con = 1; | |
| 918 | + | |
| 919 | + if (kgdb_io_module_registered && !kgdb_con_registered) { | |
| 920 | + register_console(&kgdbcons); | |
| 921 | + kgdb_con_registered = 1; | |
| 922 | + } | |
| 923 | + | |
| 924 | + return 0; | |
| 925 | +} | |
| 926 | + | |
| 927 | +early_param("kgdbcon", opt_kgdb_con); | |
| 928 | + | |
| 923 | 929 | #ifdef CONFIG_MAGIC_SYSRQ |
| 924 | 930 | static void sysrq_handle_dbg(int key) |
| 925 | 931 | { |