1
0
Fork 0
alistair23-linux/drivers/tty/serial/8250
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.h serial: 8250: Add IrDA to UART capabilities 2016-11-16 10:59:38 +01:00
8250_accent.c tty: serial: 8250: Add generic port init macro 2016-02-06 23:15:53 -08:00
8250_acorn.c tty: serial: 8250: Fix whitespace errors 2016-02-06 23:15:53 -08:00
8250_bcm2835aux.c serial: bcm2835: fix unsigned int issue with irq 2016-02-14 17:39:36 -08:00
8250_boca.c tty: serial: 8250: Add generic port init macro 2016-02-06 23:15:53 -08:00
8250_core.c serial: 8250: Expose set_ldisc function 2016-11-16 10:59:38 +01:00
8250_dma.c serial: 8250_dma: power off device after TX is done 2016-11-16 10:57:26 +01:00
8250_dw.c serial: 8250_dw: Add support for IrDA SIR mode 2016-11-16 10:59:38 +01:00
8250_early.c serial: 8250_early: Add earlycon support for Synopsys DesignWare ABP UART 2016-06-25 09:12:55 -07:00
8250_em.c serial: 8250: remove the redundant include 2015-03-26 22:21:08 +01:00
8250_exar_st16c554.c tty: serial: 8250: Add generic port init macro 2016-02-06 23:15:53 -08:00
8250_fintek.c serial: 8250_fintek: Add F81865 Support 2016-10-27 16:28:17 +02:00
8250_fourport.c tty: serial: 8250: Add generic port init macro 2016-02-06 23:15:53 -08:00
8250_fsl.c serial: export fsl8250_handle_irq 2015-11-20 16:19:54 -08:00
8250_gsc.c tty: serial: 8250: Suitably replace printk 2016-02-06 23:15:53 -08:00
8250_hp300.c tty: serial: 8250: Suitably replace printk 2016-02-06 23:15:53 -08:00
8250_hub6.c tty: serial: 8250: Fix whitespace errors 2016-02-06 23:15:53 -08:00
8250_ingenic.c serial: 8250_ingenic: drop #if conditional surrounding earlycon code 2016-06-25 14:31:04 -07:00
8250_lpc18xx.c serial: 8250: add LPC18xx/43xx UART driver 2015-06-01 06:56:33 +09:00
8250_lpss.c Merge 4.9-rc3 into tty-next 2016-10-30 06:42:10 -04:00
8250_mid.c serial: 8250_mid fix calltrace when hotplug 8250 serial controller 2016-11-30 13:06:08 +01:00
8250_moxa.c tty: serial: 8250: add MOXA Smartio MUE boards support 2016-03-07 16:11:14 -08:00
8250_mtk.c serial: 8250_mtk: support big baud rate. 2016-08-31 16:01:26 +02:00
8250_of.c serial: 8250: pxa: add devicetree earlyconsole 2016-10-27 16:27:24 +02:00
8250_omap.c Revert "tty/serial/8250: use mctrl_gpio helpers" 2016-08-31 15:36:01 +02:00
8250_pci.c serial: 8250_pci: Detach low-level driver during PCI error recovery 2016-11-29 20:20:07 +01:00
8250_pnp.c tty: serial: 8250: Fix indentation warnings 2016-02-06 23:15:53 -08:00
8250_port.c serial: 8250: Expose set_ldisc function 2016-11-16 10:59:38 +01:00
8250_pxa.c serial: pxa2xx: mark PM functions as __maybe_unused 2016-11-10 14:50:46 +01:00
8250_uniphier.c serial: 8250_uniphier: avoid locking for FCR register write 2016-11-10 14:30:09 +01:00
Kconfig serial: rewrite pxa2xx-uart to use 8250_core 2016-10-27 16:03:09 +02:00
Makefile serial: rewrite pxa2xx-uart to use 8250_core 2016-10-27 16:03:09 +02:00
serial_cs.c tty: serial: 8250: Fix multi-line strings 2016-02-06 23:15:53 -08:00