arch/m68k/emu/nfcon.c | 5 +- arch/powerpc/kernel/udbg.c | 4 +- arch/sparc/kernel/btext.c | 4 +- arch/um/drivers/mconsole_kern.c | 3 +- arch/um/kernel/kmsg_dump.c | 2 +- drivers/accessibility/braille/braille_console.c | 1 - drivers/hwtracing/stm/console.c | 4 +- drivers/net/netconsole.c | 13 +-- drivers/tty/ehv_bytechan.c | 4 +- drivers/tty/serial/ma35d1_serial.c | 4 +- drivers/tty/serial/mux.c | 4 +- drivers/tty/tty_io.c | 6 +- fs/proc/consoles.c | 1 - fs/pstore/platform.c | 6 +- include/linux/console.h | 143 +++++++++++++++++++----- kernel/debug/debug_core.c | 6 +- kernel/debug/kdb/kdb_io.c | 6 +- kernel/printk/nbcon.c | 17 +-- kernel/printk/printk.c | 140 ++++++++++++----------- 19 files changed, 230 insertions(+), 143 deletions(-)
The parts 1 and 2 can be found here [1] and here[2].
The changes proposed in this part 3 are mostly to clarify the usage of
the interfaces for NBCON, and use the printk helpers more broadly.
Besides it, it also introduces a new way to register consoles
and drop thes the CON_ENABLED flag. It seems too much, but in reality
the changes are not complex, and as the title says, it's basically a
cleanup without changing the functional changes.
This patchset includes a patch from part 2 that needed more work [3], as
suggested by Petr Mladek.
These changes were tested by reverting f79b163c4231
("Revert "serial: 8250: Switch to nbcon console""), and used qemu to test
suspend/resume cycles, and everything worked as expected.
PS: b4 --auto-to-cc added a bunch of people as CC, so I'm not sure if
I should remove some or not, so I'm leaving the list as it is. If the
patchset needs a v2, and you feel that you don't need to copied, just
let me know.
Thanks for checking the patches, and happy holidays!
[1]: https://lore.kernel.org/lkml/20250226-printk-renaming-v1-0-0b878577f2e6@suse.com/#t
[2]: https://lore.kernel.org/linux-serial/20251121-printk-cleanup-part2-v2-0-57b8b78647f4@suse.com/
[3]: https://lore.kernel.org/linux-serial/aSgeqM3DWvR8-cMY@pathway.suse.cz/
Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
---
Marcos Paulo de Souza (19):
printk/nbcon: Use an enum to specify the required callback in console_is_usable()
printk: Introduce console_is_nbcon
printk: Drop flags argument from console_is_usable
printk: Reintroduce consoles_suspended global state
printk: Add more context to suspend/resume functions
printk: Introduce register_console_force
drivers: netconsole: Migrate to register_console_force helper
debug: debug_core: Migrate to register_console_force helper
m68k: emu: nfcon.c: Migrate to register_console_force helper
fs: pstore: platform: Migrate to register_console_force helper
powerpc: kernel: udbg: Migrate to register_console_force helper
sparc: kernel: btext: Migrate to register_console_force helper
um: drivers: mconsole_kern.c: Migrate to register_console_force helper
drivers: hwtracing: stm: console.c: Migrate to register_console_force helper
drivers: tty: serial: mux.c: Migrate to register_console_force helper
drivers: tty: serial: ma35d1_serial: Migrate to register_console_force helper
drivers: tty: ehv_bytechan: Migrate to register_console_force helper
drivers: braille: console: Drop CON_ENABLED console flag
printk: Remove CON_ENABLED flag
arch/m68k/emu/nfcon.c | 5 +-
arch/powerpc/kernel/udbg.c | 4 +-
arch/sparc/kernel/btext.c | 4 +-
arch/um/drivers/mconsole_kern.c | 3 +-
arch/um/kernel/kmsg_dump.c | 2 +-
drivers/accessibility/braille/braille_console.c | 1 -
drivers/hwtracing/stm/console.c | 4 +-
drivers/net/netconsole.c | 13 +--
drivers/tty/ehv_bytechan.c | 4 +-
drivers/tty/serial/ma35d1_serial.c | 4 +-
drivers/tty/serial/mux.c | 4 +-
drivers/tty/tty_io.c | 6 +-
fs/proc/consoles.c | 1 -
fs/pstore/platform.c | 6 +-
include/linux/console.h | 143 +++++++++++++++++++-----
kernel/debug/debug_core.c | 6 +-
kernel/debug/kdb/kdb_io.c | 6 +-
kernel/printk/nbcon.c | 17 +--
kernel/printk/printk.c | 140 ++++++++++++-----------
19 files changed, 230 insertions(+), 143 deletions(-)
---
base-commit: 93d65587479cfc97c0d7e41b5e8c6378ca681632
change-id: 20251202-printk-cleanup-part3-ea116b11b3a6
Best regards,
--
Marcos Paulo de Souza <mpdesouza@suse.com>
On 2025-12-27 13:16, Marcos Paulo de Souza wrote: > The parts 1 and 2 can be found here [1] and here[2]. > > The changes proposed in this part 3 are mostly to clarify the usage of > the interfaces for NBCON, and use the printk helpers more broadly. > Besides it, it also introduces a new way to register consoles > and drop thes the CON_ENABLED flag. It seems too much, but in reality > the changes are not complex, and as the title says, it's basically a > cleanup without changing the functional changes. Hi, Patches 7-17 all say "replacing the CON_ENABLE flag" in their descriptions, which should rather be "replacing the CON_ENABLED flag". Cheers, Andreas
On Wed, 2026-01-07 at 11:22 +0100, Andreas Larsson wrote: > On 2025-12-27 13:16, Marcos Paulo de Souza wrote: > > The parts 1 and 2 can be found here [1] and here[2]. > > > > The changes proposed in this part 3 are mostly to clarify the usage > > of > > the interfaces for NBCON, and use the printk helpers more broadly. > > Besides it, it also introduces a new way to register consoles > > and drop thes the CON_ENABLED flag. It seems too much, but in > > reality > > the changes are not complex, and as the title says, it's basically > > a > > cleanup without changing the functional changes. > > Hi, > > Patches 7-17 all say "replacing the CON_ENABLE flag" in their > descriptions, which should rather be "replacing the CON_ENABLED > flag". That's true, thanks for spotting! > > Cheers, > Andreas
Hi Marcos
On Sat, Dec 27, 2025 at 09:16:07AM -0300, Marcos Paulo de Souza wrote:
> The parts 1 and 2 can be found here [1] and here[2].
>
> The changes proposed in this part 3 are mostly to clarify the usage of
> the interfaces for NBCON, and use the printk helpers more broadly.
> Besides it, it also introduces a new way to register consoles
> and drop thes the CON_ENABLED flag. It seems too much, but in reality
> the changes are not complex, and as the title says, it's basically a
> cleanup without changing the functional changes.
I ran this patchset through the kgdb test suite and I'm afraid it is
reporting functional changes.
Specifically the earlycon support for kdb has regressed (FWIW the
problem bisects down to the final patch in the series where CON_ENABLED
is removed).
Reproduction on x86-64 KVM outside of the test suite should be easy:
make defconfig
scripts/config \
--enable DEBUG_INFO \
--enable DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT \
--enable DEBUG_FS \
--enable KALLSYMS_ALL \
--enable MAGIC_SYSRQ \
--enable KGDB \
--enable KGDB_TESTS \
--enable KGDB_KDB \
--enable KDB_KEYBOARD \
--enable LKDTM \
--enable SECURITY_LOCKDOWN_LSM
make olddefconfig
make -j$(nproc)
qemu-system-x86_64 \
-m 1G -smp 2 -nographic \
-kernel arch/x86/boot/bzImage \
-append "console=ttyS0,115200 kgdboc=ttyS0 earlycon=uart8250,io,0x3f8 kgdboc_earlycon kgdbwait"
In a successful test the kdb prompt will appear after only a few lines
of output:
~~~
[ 0.000000] Linux version 6.19.0-rc4-00020-g4b7f3b144021 (drt@wychelm) (gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44) #2 SMP PREEMPT_DYNAMIC Mon Jan 6
[ 0.000000] Command line: console=ttyS0,115200 kgdboc=ttyS0 earlycon=uart8250,io,0x3f8 kgdboc_earlycon kgdbwait
[ 0.000000] BIOS-provided physical RAM map:
[ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
[ 0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
[ 0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000003ffdffff] usable
[ 0.000000] BIOS-e820: [mem 0x000000003ffe0000-0x000000003fffffff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved
[ 0.000000] BIOS-e820: [mem 0x000000fd00000000-0x000000ffffffffff] reserved
[ 0.000000] earlycon: uart8250 at I/O port 0x3f8 (options '')
[ 0.000000] printk: legacy bootconsole [uart8250] enabled
[ 0.000000] kgdboc: Going to register kgdb with earlycon 'uart'
[ 0.000000] KGDB: Registered I/O driver kgdboc_earlycon
[ 0.000000] KGDB: Waiting for connection from remote gdb...
Entering kdb (current=0x0000000000000000, pid 0) on processor 0 due to NonMaskable Interrupt @ 0xffffffff9101491f
[0]kdb>
~~~
After this patchset is applied the earlycon triggers do not work
correctly and we get:
~~~
[ 0.000000] Linux version 6.19.0-rc4-00019-g882df99205ba (drt@wychelm) (gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44) #3 SMP PREEMPT_DYNAMIC Mon Jan 6
[ 0.000000] Command line: console=ttyS0,115200 kgdboc=ttyS0 earlycon=uart8250,io,0x3f8 kgdboc_earlycon kgdbwait
[ 0.000000] BIOS-provided physical RAM map:
[ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
[ 0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
[ 0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000003ffdffff] usable
[ 0.000000] BIOS-e820: [mem 0x000000003ffe0000-0x000000003fffffff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved
[ 0.000000] BIOS-e820: [mem 0x000000fd00000000-0x000000ffffffffff] reserved
[ 0.000000] earlycon: uart8250 at I/O port 0x3f8 (options '')
[ 0.000000] kgdboc: No suitable earlycon yet, will try later
...
~~~
Daniel.
On Mon, Jan 05, 2026 at 12:52:14PM +0000, Daniel Thompson wrote:
> Hi Marcos
>
> On Sat, Dec 27, 2025 at 09:16:07AM -0300, Marcos Paulo de Souza wrote:
> > The parts 1 and 2 can be found here [1] and here[2].
> >
> > The changes proposed in this part 3 are mostly to clarify the usage of
> > the interfaces for NBCON, and use the printk helpers more broadly.
> > Besides it, it also introduces a new way to register consoles
> > and drop thes the CON_ENABLED flag. It seems too much, but in reality
> > the changes are not complex, and as the title says, it's basically a
> > cleanup without changing the functional changes.
>
> I ran this patchset through the kgdb test suite and I'm afraid it is
> reporting functional changes.
>
> Specifically the earlycon support for kdb has regressed (FWIW the
> problem bisects down to the final patch in the series where CON_ENABLED
> is removed).
>
> Reproduction on x86-64 KVM outside of the test suite should be easy:
>
> make defconfig
> scripts/config \
> --enable DEBUG_INFO \
> --enable DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT \
> --enable DEBUG_FS \
> --enable KALLSYMS_ALL \
> --enable MAGIC_SYSRQ \
> --enable KGDB \
> --enable KGDB_TESTS \
> --enable KGDB_KDB \
> --enable KDB_KEYBOARD \
> --enable LKDTM \
> --enable SECURITY_LOCKDOWN_LSM
> make olddefconfig
> make -j$(nproc)
> qemu-system-x86_64 \
> -m 1G -smp 2 -nographic \
> -kernel arch/x86/boot/bzImage \
> -append "console=ttyS0,115200 kgdboc=ttyS0 earlycon=uart8250,io,0x3f8 kgdboc_earlycon kgdbwait"
Actually I realized there was a simpler reproduction (hinted at by the
missing "printk: legacy bootconsole [uart8250] enabled" in the regressed
case). It looks like the earlycon simply doesn't work and that means the
reproduction doesn't require anything related to kgdb at all. Simply:
make defconfig
make -j$(nproc)
qemu-system-x86_64 -m 1G -smp 2 -nographic -kernel arch/x86/boot/bzImage \
-append "earlycon=uart8250,io,0x3f8"
With the part 3 patchset applied I get no output from the earlycon
(without the patch set I get the early boot messages which, as expected,
stop when tty0 comes up).
Daniel.
On Mon, 2026-01-05 at 14:08 +0000, Daniel Thompson wrote: > On Mon, Jan 05, 2026 at 12:52:14PM +0000, Daniel Thompson wrote: > > Hi Marcos > > > > On Sat, Dec 27, 2025 at 09:16:07AM -0300, Marcos Paulo de Souza > > wrote: > > > The parts 1 and 2 can be found here [1] and here[2]. > > > > > > The changes proposed in this part 3 are mostly to clarify the > > > usage of > > > the interfaces for NBCON, and use the printk helpers more > > > broadly. > > > Besides it, it also introduces a new way to register consoles > > > and drop thes the CON_ENABLED flag. It seems too much, but in > > > reality > > > the changes are not complex, and as the title says, it's > > > basically a > > > cleanup without changing the functional changes. > > > > I ran this patchset through the kgdb test suite and I'm afraid it > > is > > reporting functional changes. > > > > Specifically the earlycon support for kdb has regressed (FWIW the > > problem bisects down to the final patch in the series where > > CON_ENABLED > > is removed). > > > > Reproduction on x86-64 KVM outside of the test suite should be > > easy: > > > > make defconfig > > scripts/config \ > > --enable DEBUG_INFO \ > > --enable DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT \ > > --enable DEBUG_FS \ > > --enable KALLSYMS_ALL \ > > --enable MAGIC_SYSRQ \ > > --enable KGDB \ > > --enable KGDB_TESTS \ > > --enable KGDB_KDB \ > > --enable KDB_KEYBOARD \ > > --enable LKDTM \ > > --enable SECURITY_LOCKDOWN_LSM > > make olddefconfig > > make -j$(nproc) > > qemu-system-x86_64 \ > > -m 1G -smp 2 -nographic \ > > -kernel arch/x86/boot/bzImage \ > > -append "console=ttyS0,115200 kgdboc=ttyS0 > > earlycon=uart8250,io,0x3f8 kgdboc_earlycon kgdbwait" > > Actually I realized there was a simpler reproduction (hinted at by > the > missing "printk: legacy bootconsole [uart8250] enabled" in the > regressed > case). It looks like the earlycon simply doesn't work and that means > the > reproduction doesn't require anything related to kgdb at all. Simply: > > make defconfig > make -j$(nproc) > qemu-system-x86_64 -m 1G -smp 2 -nographic -kernel > arch/x86/boot/bzImage \ > -append "earlycon=uart8250,io,0x3f8" > > With the part 3 patchset applied I get no output from the earlycon > (without the patch set I get the early boot messages which, as > expected, > stop when tty0 comes up). Hi Daniel, sorry for the late reply! Lots of things to check lately :) Ok, I reproduced here, thanks a lot for testing kgdboc, it's a quick way to check that the new register_console_force is not working. Let me take a look to find what's wrong. Thanks a lot for finding this issue! > > > Daniel.
On Tue, 2026-01-13 at 09:41 -0300, Marcos Paulo de Souza wrote: > On Mon, 2026-01-05 at 14:08 +0000, Daniel Thompson wrote: > > On Mon, Jan 05, 2026 at 12:52:14PM +0000, Daniel Thompson wrote: > > > Hi Marcos > > > > > > On Sat, Dec 27, 2025 at 09:16:07AM -0300, Marcos Paulo de Souza > > > wrote: > > > > The parts 1 and 2 can be found here [1] and here[2]. > > > > > > > > The changes proposed in this part 3 are mostly to clarify the > > > > usage of > > > > the interfaces for NBCON, and use the printk helpers more > > > > broadly. > > > > Besides it, it also introduces a new way to register consoles > > > > and drop thes the CON_ENABLED flag. It seems too much, but in > > > > reality > > > > the changes are not complex, and as the title says, it's > > > > basically a > > > > cleanup without changing the functional changes. > > > > > > I ran this patchset through the kgdb test suite and I'm afraid it > > > is > > > reporting functional changes. > > > > > > Specifically the earlycon support for kdb has regressed (FWIW the > > > problem bisects down to the final patch in the series where > > > CON_ENABLED > > > is removed). > > > > > > Reproduction on x86-64 KVM outside of the test suite should be > > > easy: > > > > > > make defconfig > > > scripts/config \ > > > --enable DEBUG_INFO \ > > > --enable DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT \ > > > --enable DEBUG_FS \ > > > --enable KALLSYMS_ALL \ > > > --enable MAGIC_SYSRQ \ > > > --enable KGDB \ > > > --enable KGDB_TESTS \ > > > --enable KGDB_KDB \ > > > --enable KDB_KEYBOARD \ > > > --enable LKDTM \ > > > --enable SECURITY_LOCKDOWN_LSM > > > make olddefconfig > > > make -j$(nproc) > > > qemu-system-x86_64 \ > > > -m 1G -smp 2 -nographic \ > > > -kernel arch/x86/boot/bzImage \ > > > -append "console=ttyS0,115200 kgdboc=ttyS0 > > > earlycon=uart8250,io,0x3f8 kgdboc_earlycon kgdbwait" > > > > Actually I realized there was a simpler reproduction (hinted at by > > the > > missing "printk: legacy bootconsole [uart8250] enabled" in the > > regressed > > case). It looks like the earlycon simply doesn't work and that > > means > > the > > reproduction doesn't require anything related to kgdb at all. > > Simply: > > > > make defconfig > > make -j$(nproc) > > qemu-system-x86_64 -m 1G -smp 2 -nographic -kernel > > arch/x86/boot/bzImage \ > > -append "earlycon=uart8250,io,0x3f8" > > > > With the part 3 patchset applied I get no output from the earlycon > > (without the patch set I get the early boot messages which, as > > expected, > > stop when tty0 comes up). > > Hi Daniel, sorry for the late reply! Lots of things to check lately > :) > > Ok, I reproduced here, thanks a lot for testing kgdboc, it's a quick > way to check that the new register_console_force is not working. Let > me > take a look to find what's wrong. Thanks a lot for finding this > issue! Ok, I did a bisect and found out that the issue lies in the last commit, where CON_ENABLED was removed. After it, I then checked what was wrong, since everything was being plumbed correctly (tm), and then I found that it was not: On _register_console, the function try_enable_default_console is called when there are not registered consoles, and then it sets CON_ENABLED for the console. Later on, try_enable_preferred_console it checks if the console was specified by the user, and at the same time it had CON_ENABLED set. It worked by chance, but now, we don't have this flag anymore, and then we are not _marking_ the console on try_enable_default_console so try_enable_preferred_console returns ENOENT. I have added logs for both cases first the case with the patchset applied but the last one patch, and it works: $ vng --append "console=ttyS0,115200 earlyprintk=ttyS0,115200 kgdboc=ttyS0 earlycon=uart8250,io,0x3f8 kgdboc_earlycon kgdbwait" -- verbose Decompressing Linux... Parsing ELF... Performing relocations... done. Booting the kernel (entry_offset: 0x000000000450d530). XXX register_console earlyser XXX try_enable_default_console earlyser enabled XXX try_enable_preferred_console earlyser user_specified 1 returned - ENOENT XXX try_enable_preferred_console earlyser user_specified 0 returned 0 because flags was ENABLED ^^ here, returning 0 means that the console was accepted and will be registered XXX __register_console earlyser registered XXX register_console uart XXX try_enable_default_console uart enabled XXX try_enable_preferred_console uart user_specified 1 returned -ENOENT XXX try_enable_preferred_console uart user_specified 0 returned 0 because flags was ENABLED XXX __register_console uart registered ^^^^ same here Going to register kgdb with earlycon 'uart' Entering kdb (current=0x0000000000000000, pid 0) Now, the logs of the patchset with the last patch also applied: Decompressing Linux... Parsing ELF... Performing relocations... done. Booting the kernel (entry_offset: 0x000000000450d530). XXX register_console earlyser XXX try_enable_default_console earlyser enabled XXX try_enable_preferred_console earlyser user_specified 1 returned - ENOENT XXX try_enable_preferred_console earlyser user_specified 0 returned - ENOENT XXX register_console uart XXX try_enable_default_console uart enabled XXX try_enable_preferred_console uart user_specified 1 returned -ENOENT XXX try_enable_preferred_console uart user_specified 0 returned -ENOENT ^^^^ here, it should have registered the console XXX console_setup hvc0 XXX __add_preferred_console hvc added, idx 0 i 0 XXX console_setup ttyS0,115200 XXX __add_preferred_console ttyS added, idx 0 i 1 Poking KASLR using RDRAND RDTSC... XXX register_console tty XXX try_enable_preferred_console tty user_specified 1 returned -ENOENT XXX try_enable_preferred_console tty user_specified 0 returned -ENOENT ^^^ again, it fails because we don't flag the console with CON_ENABLED as before. XXX register_console hvc XXX register_console ttyS XXX try_enable_preferred_console ttyS user_specified 1 returned 0 with user specified XXX __register_console ttyS registered [ 0.000000] Linux version 6.18.0+ (mpdesouza@daedalus) (clang version 21.1.7, LLD 21.1.7) #374 SMP PREEMPT_RT Tue J an 13 21:08:34 -03 2026 reserved [ 0.000000] earlycon: uart8250 at I/O port 0x3f8 (options '') [ 0.000000] kgdboc: No suitable earlycon yet, will try later So, without any console kgdb is activated much later in the boot process, as you found it. I talked with Petr Mladek and it would need to rework the way that we register a console, and he's already working on it. For now I believe that we could take a look in all the patches besides the last one that currently breaks the earlycon with kgdb and maybe other usecases. Sorry for not catching this issue before. I'll use kgdb next time to make sure that it keeps working :)
On Tue, Jan 13, 2026 at 09:32:33PM -0300, Marcos Paulo de Souza wrote: > I talked with Petr Mladek and it would need to rework the way that we > register a console, and he's already working on it. For now I believe > that we could take a look in all the patches besides the last one that > currently breaks the earlycon with kgdb and maybe other usecases. > > Sorry for not catching this issue before. I'll use kgdb next time to > make sure that it keeps working :) As I understood things the bug was in earlycon rather then kgdb. It was picked up by the kgdbtest suite since kgdb does some cool things with earlycon (thanks to Doug Anderson) so I added a few earlycon tests to the kgdbtest suite. However it wasn't kgdb itself that failed here. So... if you want to run https://gitlab.com/daniel-thompson/kgdbtest then certainly feel free but its probably less effort just to include a couple of earlycon checks in your testing. Daniel.
On Tue 2026-01-13 21:32:33, Marcos Paulo de Souza wrote: > On Tue, 2026-01-13 at 09:41 -0300, Marcos Paulo de Souza wrote: > > On Mon, 2026-01-05 at 14:08 +0000, Daniel Thompson wrote: > > > On Mon, Jan 05, 2026 at 12:52:14PM +0000, Daniel Thompson wrote: > > > > Hi Marcos > > > > > > > > On Sat, Dec 27, 2025 at 09:16:07AM -0300, Marcos Paulo de Souza > > > > wrote: > > > > > The parts 1 and 2 can be found here [1] and here[2]. > > > > > > > > > > The changes proposed in this part 3 are mostly to clarify the > > > > > usage of > > > > > the interfaces for NBCON, and use the printk helpers more > > > > > broadly. > > > > > Besides it, it also introduces a new way to register consoles > > > > > and drop thes the CON_ENABLED flag. It seems too much, but in > > > > > reality > > > > > the changes are not complex, and as the title says, it's > > > > > basically a > > > > > cleanup without changing the functional changes. > > > > > > > > I ran this patchset through the kgdb test suite and I'm afraid it > > > > is > > > > reporting functional changes. > > > > > > > > Specifically the earlycon support for kdb has regressed (FWIW the > > > > problem bisects down to the final patch in the series where > > > > CON_ENABLED > > > > is removed). > > > > > > > > Reproduction on x86-64 KVM outside of the test suite should be > > > > easy: > > > > > > > > make defconfig > > > > scripts/config \ > > > > --enable DEBUG_INFO \ > > > > --enable DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT \ > > > > --enable DEBUG_FS \ > > > > --enable KALLSYMS_ALL \ > > > > --enable MAGIC_SYSRQ \ > > > > --enable KGDB \ > > > > --enable KGDB_TESTS \ > > > > --enable KGDB_KDB \ > > > > --enable KDB_KEYBOARD \ > > > > --enable LKDTM \ > > > > --enable SECURITY_LOCKDOWN_LSM > > > > make olddefconfig > > > > make -j$(nproc) > > > > qemu-system-x86_64 \ > > > > -m 1G -smp 2 -nographic \ > > > > -kernel arch/x86/boot/bzImage \ > > > > -append "console=ttyS0,115200 kgdboc=ttyS0 > > > > earlycon=uart8250,io,0x3f8 kgdboc_earlycon kgdbwait" > > > > > > Actually I realized there was a simpler reproduction (hinted at by > > > the > > > missing "printk: legacy bootconsole [uart8250] enabled" in the > > > regressed > > > case). It looks like the earlycon simply doesn't work and that > > > means > > > the > > > reproduction doesn't require anything related to kgdb at all. > > > Simply: > > > > > > make defconfig > > > make -j$(nproc) > > > qemu-system-x86_64 -m 1G -smp 2 -nographic -kernel > > > arch/x86/boot/bzImage \ > > > -append "earlycon=uart8250,io,0x3f8" > > > > > > With the part 3 patchset applied I get no output from the earlycon > > > (without the patch set I get the early boot messages which, as > > > expected, > > > stop when tty0 comes up). > > > > Hi Daniel, sorry for the late reply! Lots of things to check lately > > :) > > > > Ok, I reproduced here, thanks a lot for testing kgdboc, it's a quick > > way to check that the new register_console_force is not working. Let > > me > > take a look to find what's wrong. Thanks a lot for finding this > > issue! > > Ok, I did a bisect and found out that the issue lies in the last > commit, where CON_ENABLED was removed. After it, I then checked what > was wrong, since everything was being plumbed correctly (tm), and then > I found that it was not: > > On _register_console, the function try_enable_default_console is called > when there are not registered consoles, and then it sets CON_ENABLED > for the console. Later on, try_enable_preferred_console it checks if > the console was specified by the user, and at the same time it had > CON_ENABLED set. > > It worked by chance, but now, we don't have this flag anymore, and then > we are not _marking_ the console on try_enable_default_console so > try_enable_preferred_console returns ENOENT. Great catch! Yeah, it worked just by chance. > So, without any console kgdb is activated much later in the boot > process, as you found it. > > I talked with Petr Mladek and it would need to rework the way that we > register a console, and he's already working on it. Yes, I have some patches in early stages of developnent of another feature which would help here. > For now I believe > that we could take a look in all the patches besides the last one that > currently breaks the earlycon with kgdb and maybe other usecases. I agree. I am going to review this patchset first. Then I'll try to clean up the patches which remove the ugly side effect from try_enable_preferred_console(). Then we could discuss how to move forward. It might make sense to push this patchset first without the last patch... > Sorry for not catching this issue before. I'll use kgdb next time to > make sure that it keeps working :) Do not worry at all. It was a well hidden catch. It is great that Daniel found the regression in time... Best Regards, Petr
© 2016 - 2026 Red Hat, Inc.