1
0
Fork 0
alistair23-linux/drivers/tty/serial
Liwei Song a9b01b5823 serial: 8250_mid fix calltrace when hotplug 8250 serial controller
Fix the following Calltrace:
[   77.768221] WARNING: CPU: 5 PID: 645 at drivers/dma/dmaengine.c:1069 dma_async_device_unregister+0xe2/0xf0
[   77.775058] dma_async_device_unregister called while 1 clients hold a reference
[   77.825048] CPU: 5 PID: 645 Comm: sh Not tainted 4.8.8-WR9.0.0.0_standard+ #3
[   77.832550] Hardware name: Intel Corp. Aspen Cove/Server, BIOS HAVLCRB1.X64.0012.D58.1604140405 04/14/2016
[   77.840396]  0000000000000000 ffffc90008adbc80 ffffffff81403456 ffffc90008adbcd0
[   77.848245]  0000000000000000 ffffc90008adbcc0 ffffffff8105e2e1 0000042d08adbf20
[   77.855934]  ffff88046a861c18 ffff88046a85c420 ffffffff820d4200 ffff88046ae92318
[   77.863601] Call Trace:
[   77.871113]  [<ffffffff81403456>] dump_stack+0x4f/0x69
[   77.878655]  [<ffffffff8105e2e1>] __warn+0xd1/0xf0
[   77.886102]  [<ffffffff8105e34f>] warn_slowpath_fmt+0x4f/0x60
[   77.893508]  [<ffffffff814187a9>] ? find_next_bit+0x19/0x20
[   77.900730]  [<ffffffff814bf83e>] ? dma_channel_rebalance+0x23e/0x270
[   77.907814]  [<ffffffff814bfee2>] dma_async_device_unregister+0xe2/0xf0
[   77.914992]  [<ffffffff814c53aa>] hsu_dma_remove+0x1a/0x60
[   77.921977]  [<ffffffff814ee14c>] dnv_exit+0x1c/0x20
[   77.928752]  [<ffffffff814edff6>] mid8250_remove+0x26/0x40
[   77.935607]  [<ffffffff8144f1b9>] pci_device_remove+0x39/0xc0
[   77.942292]  [<ffffffff8160cfea>] __device_release_driver+0x9a/0x140
[   77.948836]  [<ffffffff8160d0b3>] device_release_driver+0x23/0x30
[   77.955364]  [<ffffffff81447dcc>] pci_stop_bus_device+0x8c/0xa0
[   77.961769]  [<ffffffff81447f0a>] pci_stop_and_remove_bus_device_locked+0x1a/0x30
[   77.968113]  [<ffffffff81450d4e>] remove_store+0x5e/0x70
[   77.974267]  [<ffffffff81607ed8>] dev_attr_store+0x18/0x30
[   77.980243]  [<ffffffff8123006a>] sysfs_kf_write+0x3a/0x50
[   77.986180]  [<ffffffff8122f5ab>] kernfs_fop_write+0x10b/0x190
[   77.992118]  [<ffffffff811bf1c8>] __vfs_write+0x18/0x40
[   77.998032]  [<ffffffff811bfdee>] vfs_write+0xae/0x190
[   78.003747]  [<ffffffff811c1016>] SyS_write+0x46/0xb0
[   78.009234]  [<ffffffff81a4c31b>] entry_SYSCALL_64_fastpath+0x13/0x8f
[   78.014809] ---[ end trace 0c36dd73b7408eb2 ]---

This happens when the 8250 serial controller is hotplugged as follows:
echo 1 > /sys/bus/pci/devices/0000:00:1a.0/remove

This trace happens due to the serial port still holding a reference when
the dma device is unregistered.
The dma unregister routine will check if there is still a reference exist,
if so it will give the WARNING(here serial port still was not unregister).

To fix this, We need to unregister the serial port first, then do DMA
device unregister to make sure there is no reference when to DMA routine.

Signed-off-by: Liwei Song <liwei.song@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-30 13:06:08 +01:00
..
8250 serial: 8250_mid fix calltrace when hotplug 8250 serial controller 2016-11-30 13:06:08 +01:00
cpm_uart tty: serial: cpm_uart: Fix module autoload for OF platform driver 2015-10-04 19:09:21 +01:00
jsm tty: serial: jsm_tty: constify uart_ops structures 2016-09-02 15:01:16 +02:00
21285.c
Kconfig tty: serial: Make the STM32 serial port depend on it's arch 2016-11-10 15:01:15 +01:00
Makefile tty: serial: Makefile: move kgdb to be initialized last 2016-10-27 16:27:24 +02:00
altera_jtaguart.c serial: altera: constify uart_ops structures 2016-09-02 15:01:16 +02:00
altera_uart.c serial: altera: constify uart_ops structures 2016-09-02 15:01:16 +02:00
amba-pl010.c
amba-pl011.c tty: amba-pl011: Add earlycon support for SBSA UART 2016-11-10 15:10:37 +01:00
amba-pl011.h tty: amba-pl011: clean up LCR register offsets 2015-12-13 19:59:48 -08:00
apbuart.c tty: serial: apbuart: Fix module autoload for OF platform driver 2015-10-04 19:09:21 +01:00
apbuart.h
ar933x_uart.c tree-wide: replace config_enabled() with IS_ENABLED() 2016-08-04 08:50:07 -04:00
arc_uart.c serial/arc: constify uart_ops structures 2016-09-01 21:05:41 +02:00
atmel_serial.c tty/serial: at91: fix hardware handshake on Atmel platforms 2016-10-28 08:10:48 -04:00
bcm63xx_uart.c serial/bcm63xx_uart: constify uart_ops structures 2016-09-02 15:01:16 +02:00
bfin_sport_uart.c
bfin_sport_uart.h
bfin_uart.c serial:bfin-uart:Remove 'struct timeval' 2015-12-13 19:59:48 -08:00
clps711x.c serial: clps711x: Changing the compatibility string to match with the smallest supported chip 2016-07-06 17:38:16 +02:00
crisv10.c serial: crisv10: fix invalid user-pointer check 2016-11-10 14:41:25 +01:00
crisv10.h
digicolor-usart.c tty/serial: digicolor: Fix bad usage of IS_ERR_VALUE 2016-02-14 17:39:36 -08:00
dz.c
dz.h
earlycon-arm-semihost.c tty/serial: mark __init early_smh_setup() static 2016-09-02 15:03:35 +02:00
earlycon.c ACPI: parse SPCR and enable matching console 2016-09-28 17:46:46 +02:00
efm32-uart.c
etraxfs-uart.c serial: etraxfs-uart: Fix crash 2015-11-20 16:19:54 -08:00
fsl_lpuart.c Merge 4.9-rc3 into tty-next 2016-10-30 06:42:10 -04:00
icom.c tty: Remove unused SERIAL_DO_RESTART define 2015-12-13 19:59:48 -08:00
icom.h
ifx6x60.c serial: ifx6x60: Free memory when probe fails 2016-11-10 14:50:46 +01:00
ifx6x60.h
imx.c serial: imx: Fix DCD reading 2016-09-27 12:55:27 +02:00
ioc3_serial.c
ioc4_serial.c serial: ioc4_serial: Free memory when kzalloc fails during probe 2016-11-10 14:50:46 +01:00
ip22zilog.c
ip22zilog.h
kgdb_nmi.c
kgdboc.c
lantiq.c drivers/tty: make serial/lantic.c driver explicitly non-modular 2015-07-23 18:27:41 -07:00
lpc32xx_hs.c tty: serial: lpc32xx_hs: fix handling platform_get_irq result 2015-10-04 19:09:21 +01:00
m32r_sio.c serial: m32r_sio: make it explicitly non-modular 2016-06-25 14:00:06 -07:00
m32r_sio_reg.h
max310x.c serial: max310x: Set IRQF_TRIGGER_FALLING flag when dev.of_node is not NULL 2016-09-15 12:35:49 +02:00
max3100.c tty: serial: constify uart_ops structures 2016-09-02 15:01:16 +02:00
mcf.c
men_z135_uart.c tty: serial: constify uart_ops structures 2016-09-02 15:01:16 +02:00
meson_uart.c tty: serial: meson: Implement earlycon support 2016-04-30 09:26:55 -07:00
mpc52xx_uart.c tty: serial: constify psc_ops structs 2016-02-06 22:31:47 -08:00
mps2-uart.c serial: mps2-uart: make driver explicitly non-modular 2016-06-25 14:01:57 -07:00
mpsc.c TTY: serial/mpsc, remove unused fields 2016-02-06 22:16:21 -08:00
msm_serial.c tty: serial: msm: fix definition of msm_stop_dma 2016-06-25 10:23:54 -07:00
mux.c parisc: serial/mux: Convert to uart_console_device instead of open-coded 2015-10-22 15:44:28 +02:00
mvebu-uart.c serial: mvebu-uart: free the IRQ in ->shutdown() 2016-06-25 14:00:06 -07:00
mxs-auart.c mxs-auart: count FIFO overrun errors 2016-11-16 17:17:42 +01:00
netx-serial.c
omap-serial.c Merge 4.5-rc4 into tty-next 2016-02-14 14:36:04 -08:00
pch_uart.c serial: pch_uart: add terminate entry for dmi_system_id tables 2016-10-27 16:01:31 +02:00
pic32_uart.c serial: pic32_uart: Fix double free of 'sport->irq_fault_name'. 2016-06-25 13:50:53 -07:00
pic32_uart.h serial: pic32_uart: Add PIC32 UART driver 2016-05-13 14:01:56 +02:00
pmac_zilog.c TTY: serial, handle platform_get_irq retval properly 2016-06-25 09:01:52 -07:00
pmac_zilog.h
pnx8xxx_uart.c
pxa.c serial: pxa2xx: remove __deprecated annotation 2016-11-10 14:50:45 +01:00
rp2.c
sa1100.c
samsung.c serial: samsung: Register cpufreq notifier only on S3C24xx 2016-08-31 15:39:58 +02:00
samsung.h serial: samsung: Register cpufreq notifier only on S3C24xx 2016-08-31 15:39:58 +02:00
sb1250-duart.c
sc16is7xx.c Merge 4.9-rc3 into tty-next 2016-10-30 06:42:10 -04:00
sccnxp.c
serial-tegra.c TTY: serial, handle platform_get_irq retval properly 2016-06-25 09:01:52 -07:00
serial_core.c serial: core: don't check port twice in a row 2016-11-28 08:29:34 +01:00
serial_ks8695.c serial: Fix ASYNC_* => UPF_* flags misuse 2016-01-28 14:17:42 -08:00
serial_mctrl_gpio.c serial: mctrl_gpio: enable API usage only for initialized mctrl_gpios struct 2016-06-25 14:30:42 -07:00
serial_mctrl_gpio.h serial: mctrl_gpio: add modem control read routine 2016-06-25 14:30:42 -07:00
serial_txx9.c
sh-sci.c serial: sh-sci: Fix deadlock caused by serial output request 2016-11-10 14:39:44 +01:00
sh-sci.h serial: sh-sci: Clear (H)SCIF timeout and overrun during reset 2016-06-25 09:09:53 -07:00
sirfsoc_uart.c serial: sirf: Use generic uart-has-rtscts DT property 2016-04-30 09:26:55 -07:00
sirfsoc_uart.h serial: sirf: make fifo functions static 2016-06-25 14:01:57 -07:00
sn_console.c drivers/tty: make serial/sn_console.c driver explicitly non-modular 2015-07-23 18:27:41 -07:00
sprd_serial.c remove lots of IS_ERR_VALUE abuses 2016-05-27 15:26:11 -07:00
st-asc.c serial: st-asc: constify uart_ops structures 2016-09-02 15:01:16 +02:00
stm32-usart.c serial: stm32: mark symbols static where possible 2016-09-27 12:55:27 +02:00
stm32-usart.h serial: stm32: Fix comparisons with undefined register 2016-10-27 16:00:31 +02:00
suncore.c drivers/tty: make serial/suncore.c driver explicitly non-modular 2015-07-23 18:27:41 -07:00
sunhv.c serial: sunhv: Free memory when remove() is called 2016-11-16 10:57:25 +01:00
sunsab.c
sunsab.h
sunsu.c serial: sunsu: Free memory when probe fails 2016-11-16 10:57:26 +01:00
sunzilog.c
sunzilog.h
tilegx.c
timbuart.c tty: serial: constify uart_ops structures 2016-09-02 15:01:16 +02:00
timbuart.h
uartlite.c serial-uartlite: constify uart_ops structures 2016-09-02 15:01:16 +02:00
ucc_uart.c QE-UART: add "fsl,t1040-ucc-uart" to of_device_id 2016-05-01 13:55:12 -07:00
vr41xx_siu.c
vt8500_serial.c serial: vt8500_serial: Fix a parameter of find_first_zero_bit. 2016-08-31 15:42:28 +02:00
xilinx_uartps.c serial: xuartps: Add new compatible string for ZynqMP 2016-10-27 16:00:32 +02:00
zs.c serial: zs: Fix a transmit lockup in console output 2016-02-06 23:13:30 -08:00
zs.h