Skip to contentSkip to conversation

2.6.3-rc3 serial console woes

DISCUSSION Keith Owens 3 participants 6 messages Feb 16, 2004 – Feb 17, 2004

lore
Share & tools
lore
#0 lore raw

Between 2.6.3-rc2 and 2.6.3-rc3, the serial console initialisation changed, due to this patch :-

http://linux.bkbits.net:8080/linux-2.5/[email protected]?nav=index.html|ChangeSet@-7d

Now the serial console is not initialised until a long way into the boot, just after the disks are probed. This makes it impossible to use a kernel debugger such as kdb or kgdb over a serial console during device initialisation.

You get no serial console output until after devices have been probed. So if something goes wrong during boot, you have no indication of the problem. Even without device problems, the delay on serial console output can make it look like the machine has hung, with no output on the serial console until a couple of minutes after boot.

.config extract

X86=y
MMU=y
UID16=y
GENERIC_ISA_DMA=y
EXPERIMENTAL=y
CLEAN_COMPILE=y
STANDALONE=y
SWAP=y
SYSVIPC=y
SYSCTL=y
LOG_BUF_SHIFT=16
KALLSYMS=y
FUTEX=y
EPOLL=y
IOSCHED_NOOP=y
IOSCHED_AS=y
IOSCHED_DEADLINE=y
MODULES=y
OBSOLETE_MODPARM=y
KMOD=y
X86_PC=y
M686=y
X86_CMPXCHG=y
X86_XADD=y
X86_L1_CACHE_SHIFT=5
RWSEM_XCHGADD_ALGORITHM=y
X86_PPRO_FENCE=y
X86_WP_WORKS_OK=y
X86_INVLPG=y
X86_BSWAP=y
X86_POPAD_OK=y
X86_GOOD_APIC=y
X86_USE_PPRO_CHECKSUM=y
SMP=y
NR_CPUS=2
X86_LOCAL_APIC=y
X86_IO_APIC=y
X86_TSC=y
X86_MCE=y
X86_MSR=m
X86_CPUID=m
NOHIGHMEM=y
MTRR=y
HAVE_DEC_LOCK=y
ACPI_BOOT=y
PCI=y
PCI_GOANY=y
PCI_BIOS=y
PCI_DIRECT=y
PCI_NAMES=y
ISA=y
BINFMT_ELF=y
BINFMT_AOUT=m
BINFMT_MISC=m
PARPORT=m
PARPORT_PC=m
PARPORT_PC_CML1=m
BLK_DEV_FD=y
BLK_DEV_LOOP=m
BLK_DEV_RAM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IP_NF_TARGET_REDIRECT=m
IP_NF_NAT_LOCAL=y
IP_NF_NAT_IRC=m
IP_NF_NAT_FTP=m
IP_NF_MANGLE=m
IP_NF_TARGET_TOS=m
IP_NF_TARGET_ECN=m
IP_NF_TARGET_DSCP=m
IP_NF_TARGET_MARK=m
IP_NF_TARGET_LOG=m
IP_NF_TARGET_ULOG=m
IP_NF_TARGET_TCPMSS=m
IP_NF_ARPTABLES=m
IP_NF_ARPFILTER=m
IP_NF_COMPAT_IPCHAINS=m
IP_NF_COMPAT_IPFWADM=m
IPV6_SCTP__=y
NETDEVICES=y
DUMMY=m
ETHERTAP=m
NET_ETHERNET=y
NET_TULIP=y
TULIP=m
NET_ISA=y
NE2000=m
NET_PCI=y
PLIP=m
PPP=m
PPP_ASYNC=m
PPP_DEFLATE=m
PPP_BSDCOMP=m
SLIP=m
SLIP_COMPRESSED=y
INPUT=y
INPUT_MOUSEDEV=y
INPUT_MOUSEDEV_PSAUX=y
INPUT_MOUSEDEV_SCREEN_X=1024
INPUT_MOUSEDEV_SCREEN_Y=768
SOUND_GAMEPORT=y
SERIO=y
SERIO_I8042=y
SERIO_SERPORT=y
INPUT_KEYBOARD=y
KEYBOARD_ATKBD=y
INPUT_MOUSE=y
MOUSE_PS2=y
VT=y
VT_CONSOLE=y
HW_CONSOLE=y
SERIAL_8250=y
SERIAL_8250_CONSOLE=y
SERIAL_8250_NR_UARTS=4
SERIAL_CORE=y
SERIAL_CORE_CONSOLE=y
UNIX98_PTYS=y
UNIX98_PTY_COUNT=256
PRINTER=m
LP_CONSOLE=y
NVRAM=m
RTC=y
VGA_CONSOLE=y
DUMMY_CONSOLE=y
SOUND=m
EXT2_FS=y
XFS_FS=y
XFS_QUOTA=y
MINIX_FS=m
ROMFS_FS=m
QUOTACTL=y
AUTOFS_FS=m
AUTOFS4_FS=m
ISO9660_FS=m
JOLIET=y
ZISOFS=y
ZISOFS_FS=m
FAT_FS=m
MSDOS_FS=m
VFAT_FS=m
NTFS_FS=m
PROC_FS=y
PROC_KCORE=y
DEVPTS_FS=y
TMPFS=y
RAMFS=y
HPFS_FS=m
NFS_FS=m
NFS_V3=y
NFSD=m
NFSD_V3=y
LOCKD=m
LOCKD_V4=y
EXPORTFS=m
SUNRPC=m
SMB_FS=m
MSDOS_PARTITION=y
NLS=y
NLS_DEFAULT="iso8859-1"
DEBUG_KERNEL=y
DEBUG_SLAB=y
MAGIC_SYSRQ=y
KDB=y
KDB_MODULES=m
KDB_CONTINUE_CATASTROPHIC=0
X86_FIND_SMP_CONFIG=y
X86_MPPARSE=y
CRC32=m
ZLIB_INFLATE=m
ZLIB_DEFLATE=m
X86_SMP=y
X86_HT=y
X86_BIOS_REBOOT=y
X86_TRAMPOLINE=y
PC=y

#1 lore raw
Quoted 9 lines · Keith Owens

Between 2.6.3-rc2 and 2.6.3-rc3, the serial console initialisation changed, due to this patch :-

http://linux.bkbits.net:8080/linux-2.5/[email protected]?nav=index.html|ChangeSet@-7d

Now the serial console is not initialised until a long way into the boot, just after the disks are probed. This makes it impossible to use a kernel debugger such as kdb or kgdb over a serial console during device initialisation.

Hmm.... I suspect the problem is that serial8250_isa_init_ports() doesn't initialize port->type for the ports in SERIAL_PORT_DFNS, so we fail the console setup.

Does the attached patch make it work like it used to? ISTR that Russell didn't really like testing port->ops, but I can't remember why, and I don't see anything better.

===== drivers/serial/8250.c 1.44 vs edited =====

drivers/serial/8250.c +1 -1
@@ -1976,7 +1976,7 @@
 	if (co->index >= UART_NR)
 		co->index = 0;
 	port = &serial8250_ports[co->index].port;
-	if (port->type == PORT_UNKNOWN)
+	if (!port->ops)
 		return -ENODEV;
 
 	/*
#2 lore raw
Quoted 12 lines · Bjorn Helgaas

Hmm.... I suspect the problem is that serial8250_isa_init_ports() doesn't initialize port->type for the ports in SERIAL_PORT_DFNS, so we fail the console setup.

Does the attached patch make it work like it used to? ISTR that Russell didn't really like testing port->ops, but I can't remember why, and I don't see anything better.

===== drivers/serial/8250.c 1.44 vs edited =====

drivers/serial/8250.c line 1982

Quoted 8 lines
drivers/serial/8250.c +1 -1
@@ -1976,7 +1976,7 @@
 	if (co->index >= UART_NR)
 		co->index = 0;
 	port = &serial8250_ports[co->index].port;
-	if (port->type == PORT_UNKNOWN)
+	if (!port->ops)
 		return -ENODEV;
 
 	/*

Works for me on i386.

#3 lore raw
Quoted 16 lines · Keith Owens
Quoted 14 lines · Bjorn Helgaas

Hmm.... I suspect the problem is that serial8250_isa_init_ports() doesn't initialize port->type for the ports in SERIAL_PORT_DFNS, so we fail the console setup.
===== drivers/serial/8250.c 1.44 vs edited =====

drivers/serial/8250.c +1 -1
@@ -1976,7 +1976,7 @@
 	if (co->index >= UART_NR)
 		co->index = 0;
 	port = &serial8250_ports[co->index].port;
-	if (port->type == PORT_UNKNOWN)
+	if (!port->ops)
 		return -ENODEV;
 
Quoted 3 lines

drivers/serial/8250.c line 1982

Quoted 1 line
drivers/serial/8250.c +0 -0
 	/*

Works for me on i386.

Spoke too soon. That one line patch makes the serial console available early in boot. But as soon as /sbin/init runs, the console is gibberish due to a speed mismatch. Completely reverting

http://linux.bkbits.net:8080/linux-2.5/[email protected]?nav=index.html|ChangeSet@-7d

works fine. Since this is a -rc kernel, can we revert the cset until it is fixed?

#4 lore raw
Quoted 8 lines · Keith Owens

Spoke too soon. That one line patch makes the serial console available early in boot. But as soon as /sbin/init runs, the console is gibberish due to a speed mismatch. Completely reverting

http://linux.bkbits.net:8080/linux-2.5/[email protected]?nav=index.html|ChangeSet@-7d

works fine. Since this is a -rc kernel, can we revert the cset until it is fixed?

Reverting for now sounds like the right thing to me. I would like to understand what's going on, though.

For the serial console to work early, serial8250_console_setup() must be returning zero. So we can't be taking this return:

	if (!port->ops)
		return -ENODEV;

and therefore, the hunk in serial_core.c shouldn't have any effect either. So is it merely the fact that we call serial8250_late_console_init()?

I wouldn't expect that to make any difference, because the setup() call from serial8250_console_init() should have succeeded, so CON_ENABLED should have been set, and we don't do anything in that case.

Keith, can you tell me how to reproduce this?

Bjorn

#5 lore raw
Quoted 2 lines · Bjorn Helgaas

Reverting for now sounds like the right thing to me. I would like to understand what's going on, though.

My bad, patch merge error against kdb. Your one line patch is all that is required. I have included it in kdb-v4.3-2.6.3-rc3-common-1 to ensure that kdb works.

===== drivers/serial/8250.c 1.44 vs edited =====

drivers/serial/8250.c +1 -1
@@ -1976,7 +1976,7 @@
 	if (co->index >= UART_NR)
 		co->index = 0;
 	port = &serial8250_ports[co->index].port;
-	if (port->type == PORT_UNKNOWN)
+	if (!port->ops)
 		return -ENODEV;
 
 	/*