mirror of
https://github.com/torvalds/linux.git
synced 2026-06-16 02:52:26 +02:00
If an earlycon console driver needs to acquire the uart_port.lock
spinlock for serial console output, and CONFIG_DEBUG_SPINLOCK=y:
BUG: spinlock bad magic on CPU#0, swapper/0
lock: sci_ports+0x0/0x3480, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0
CPU: 0 PID: 0 Comm: swapper Not tainted 4.4.0-rc2-koelsch-g62ea5edf143bb1d0-dirty #2083
Hardware name: Generic R8A7791 (Flattened Device Tree)
[<c00173a0>] (unwind_backtrace) from [<c0013094>] (show_stack+0x10/0x14)
[<c0013094>] (show_stack) from [<c01f2338>] (dump_stack+0x70/0x8c)
[<c01f2338>] (dump_stack) from [<c00702d8>] (do_raw_spin_lock+0x20/0x190)
[<c00702d8>] (do_raw_spin_lock) from [<c0267590>] (serial_console_write+0x4c/0x130)
[<c0267590>] (serial_console_write) from [<c00734c4>] (call_console_drivers.constprop.13+0xc8/0xec)
[<c00734c4>] (call_console_drivers.constprop.13) from [<c0074ef0>] (console_unlock+0x354/0x440)
[<c0074ef0>] (console_unlock) from [<c0075bb4>] (register_console+0x2a0/0x394)
[<c0075bb4>] (register_console) from [<c06cb750>] (of_setup_earlycon+0x90/0xa4)
[<c06cb750>] (of_setup_earlycon) from [<c06cfb60>] (setup_of_earlycon+0x118/0x13c)
[<c06cfb60>] (setup_of_earlycon) from [<c06b34ac>] (do_early_param+0x64/0xb4)
[<c06b34ac>] (do_early_param) from [<c00472c0>] (parse_args+0x254/0x350)
[<c00472c0>] (parse_args) from [<c06b3860>] (parse_early_options+0x2c/0x3c)
[<c06b3860>] (parse_early_options) from [<c06b389c>] (parse_early_param+0x2c/0x40)
[<c06b389c>] (parse_early_param) from [<c06b5b08>] (setup_arch+0x520/0xaf0)
[<c06b5b08>] (setup_arch) from [<c06b3948>] (start_kernel+0x94/0x370)
[<c06b3948>] (start_kernel) from [<40008090>] (0x40008090)
Initialize the spinlock in of_setup_earlycon() and register_earlycon(),
to fix this for both DT-based and legacy earlycon. If the driver would
reinitialize the spinlock again, this is harmless, as it's allowed to
reinitialize an unlocked spinlock.
Alternatives are:
- Drivers having an early_serial_console_write() that only performs
the core functionality of serial_console_write(), without acquiring
the lock (which may be unsafe, depending on the hardware),
- Drivers initializing the spinlock in their private earlycon setup
functions.
As uart_port is owned by generic serial_core, and uart_port.lock is
initialized by uart_add_one_port() for the normal case, this can better
be handled in the earlycon core.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Peter Hurley <peter@hurleysoftware.com>
Reported-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||
|---|---|---|
| .. | ||
| 8250 | ||
| cpm_uart | ||
| jsm | ||
| 21285.c | ||
| 68328serial.c | ||
| altera_jtaguart.c | ||
| altera_uart.c | ||
| amba-pl010.c | ||
| amba-pl011.c | ||
| apbuart.c | ||
| apbuart.h | ||
| ar933x_uart.c | ||
| arc_uart.c | ||
| atmel_serial.c | ||
| bcm63xx_uart.c | ||
| bfin_sport_uart.c | ||
| bfin_sport_uart.h | ||
| bfin_uart.c | ||
| clps711x.c | ||
| crisv10.c | ||
| crisv10.h | ||
| digicolor-usart.c | ||
| dz.c | ||
| dz.h | ||
| earlycon-arm-semihost.c | ||
| earlycon.c | ||
| efm32-uart.c | ||
| etraxfs-uart.c | ||
| fsl_lpuart.c | ||
| icom.c | ||
| icom.h | ||
| ifx6x60.c | ||
| ifx6x60.h | ||
| imx.c | ||
| ioc3_serial.c | ||
| ioc4_serial.c | ||
| ip22zilog.c | ||
| ip22zilog.h | ||
| Kconfig | ||
| kgdb_nmi.c | ||
| kgdboc.c | ||
| lantiq.c | ||
| lpc32xx_hs.c | ||
| m32r_sio_reg.h | ||
| m32r_sio.c | ||
| m32r_sio.h | ||
| Makefile | ||
| max310x.c | ||
| max3100.c | ||
| mcf.c | ||
| men_z135_uart.c | ||
| meson_uart.c | ||
| mpc52xx_uart.c | ||
| mpsc.c | ||
| msm_serial.c | ||
| msm_serial.h | ||
| mux.c | ||
| mxs-auart.c | ||
| netx-serial.c | ||
| nwpserial.c | ||
| of_serial.c | ||
| omap-serial.c | ||
| pch_uart.c | ||
| pmac_zilog.c | ||
| pmac_zilog.h | ||
| pnx8xxx_uart.c | ||
| pxa.c | ||
| rp2.c | ||
| sa1100.c | ||
| samsung.c | ||
| samsung.h | ||
| sb1250-duart.c | ||
| sc16is7xx.c | ||
| sccnxp.c | ||
| serial_core.c | ||
| serial_ks8695.c | ||
| serial_mctrl_gpio.c | ||
| serial_mctrl_gpio.h | ||
| serial_txx9.c | ||
| serial-tegra.c | ||
| sh-sci.c | ||
| sh-sci.h | ||
| sirfsoc_uart.c | ||
| sirfsoc_uart.h | ||
| sn_console.c | ||
| sprd_serial.c | ||
| st-asc.c | ||
| stm32-usart.c | ||
| suncore.c | ||
| sunhv.c | ||
| sunsab.c | ||
| sunsab.h | ||
| sunsu.c | ||
| sunzilog.c | ||
| sunzilog.h | ||
| tilegx.c | ||
| timbuart.c | ||
| timbuart.h | ||
| uartlite.c | ||
| ucc_uart.c | ||
| vr41xx_siu.c | ||
| vt8500_serial.c | ||
| xilinx_uartps.c | ||
| zs.c | ||
| zs.h | ||