WSL2-Linux-Kernel/drivers/tty/serial
Darren Hart 2588aba002 pch_uart: Add eg20t_port lock field, avoid recursive spinlocks
pch_uart_interrupt() takes priv->port.lock which leads to two recursive
spinlock calls if low_latency==1 or CONFIG_PREEMPT_RT_FULL=y (one
otherwise):

pch_uart_interrupt
  spin_lock_irqsave(priv->port.lock, flags)
  case PCH_UART_IID_RDR_TO (data ready)
  handle_rx_to
    push_rx
      tty_port_tty_get
        spin_lock_irqsave(&port->lock, flags) <--- already hold this lock
        ...
      tty_flip_buffer_push
        ...
        flush_to_ldisc
          spin_lock_irqsave(&tty->buf.lock)
            spin_lock_irqsave(&tty->buf.lock)
            disc->ops->receive_buf(tty, char_buf)
              n_tty_receive_buf
                tty->ops->flush_chars()
                uart_flush_chars
                  uart_start
                    spin_lock_irqsave(&port->lock) <--- already hold this lock

Avoid this by using a dedicated lock to protect the eg20t_port structure
and IO access to its membase. This is more consistent with the 8250
driver.  Ensure priv->lock is always take prior to priv->port.lock when
taken at the same time.

V2: Remove inadvertent whitespace change.
V3: Account for oops_in_progress for the private lock in
    pch_console_write().

Note: Like the 8250 driver, if a printk is introduced anywhere inside
      the pch_console_write() critical section, the kernel will hang
      on a recursive spinlock on the private lock. The oops case is
      handled by using a trylock in the oops_in_progress case.

Signed-off-by: Darren Hart <dvhart@linux.intel.com>
CC: Tomoya MORINAGA <tomoya.rohm@gmail.com>
CC: Feng Tang <feng.tang@intel.com>
CC: Alexander Stein <alexander.stein@systec-electronic.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-26 13:37:02 -07:00
..
8250 serial/8250: Add LPC3220 standard UART type 2012-07-26 13:37:02 -07:00
cpm_uart
jsm
21285.c
68328serial.c
Kconfig
Makefile
altera_jtaguart.c
altera_uart.c
amba-pl010.c
amba-pl011.c
apbuart.c
apbuart.h
ar933x_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
dz.c
dz.h
efm32-uart.c
icom.c
icom.h
ifx6x60.c
ifx6x60.h
imx.c
ioc3_serial.c
ioc4_serial.c
ip22zilog.c
ip22zilog.h
kgdboc.c
lantiq.c
m32r_sio.c
m32r_sio.h
m32r_sio_reg.h
max3100.c
max3107.c
max3107.h
mcf.c
mfd.c
mpc52xx_uart.c
mpsc.c
mrst_max3110.c
mrst_max3110.h
msm_serial.c
msm_serial.h
msm_serial_hs.c
msm_smd_tty.c
mux.c
mxs-auart.c
netx-serial.c
nwpserial.c
of_serial.c serial/of-serial: Add LPC3220 standard UART compatible string 2012-07-26 13:37:02 -07:00
omap-serial.c
pch_uart.c pch_uart: Add eg20t_port lock field, avoid recursive spinlocks 2012-07-26 13:37:02 -07:00
pmac_zilog.c
pmac_zilog.h
pnx8xxx_uart.c
pxa.c
sa1100.c
samsung.c
samsung.h
sb1250-duart.c
sc26xx.c
serial_core.c serial_core: Update buffer overrun statistics. 2012-07-26 13:37:02 -07:00
serial_ks8695.c
serial_txx9.c
sh-sci.c
sh-sci.h
sirfsoc_uart.c
sirfsoc_uart.h
sn_console.c
suncore.c
sunhv.c
sunsab.c
sunsab.h
sunsu.c
sunzilog.c
sunzilog.h
timbuart.c
timbuart.h
uartlite.c
ucc_uart.c
vr41xx_siu.c
vt8500_serial.c
xilinx_uartps.c
zs.c
zs.h