* [PATCH] dmaengine: move channel device_node deletion to driver
@ 2021-01-18 17:28 Dave Jiang
2021-01-19 16:00 ` Radhey Shyam Pandey
2021-01-19 16:40 ` Vinod Koul
0 siblings, 2 replies; 3+ messages in thread
From: Dave Jiang @ 2021-01-18 17:28 UTC (permalink / raw)
To: vkoul; +Cc: dmaengine, radheys, pthomas8589
Channel device_node deletion is managed by the device driver rather than
the dmaengine core. The deletion was accidentally introduced when making
channel unregister dynamic. It causes xilinx_dma module to crash on unload
as reported by Radhey. Remove chan->device_node delete in dmaengine and
also fix up idxd driver.
[ 42.142705] Internal error: Oops: 96000044 [#1] SMP
[ 42.147566] Modules linked in: xilinx_dma(-) clk_xlnx_clock_wizard uio_pdrv_genirq
[ 42.155139] CPU: 1 PID: 2075 Comm: rmmod Not tainted 5.10.1-00026-g3a2e6dd7a05-dirty #192
[ 42.163302] Hardware name: Enclustra XU5 SOM (DT)
[ 42.167992] pstate: 40000005 (nZcv daif -PAN -UAO -TCO BTYPE=--)
[ 42.173996] pc : xilinx_dma_chan_remove+0x74/0xa0 [xilinx_dma]
[ 42.179815] lr : xilinx_dma_chan_remove+0x70/0xa0 [xilinx_dma]
[ 42.185636] sp : ffffffc01112bca0
[ 42.188935] x29: ffffffc01112bca0 x28: ffffff80402ea640
xilinx_dma_chan_remove+0x74/0xa0:
__list_del at ./include/linux/list.h:112 (inlined by)
__list_del_entry at./include/linux/list.h:135 (inlined by)
list_del at ./include/linux/list.h:146 (inlined by)
xilinx_dma_chan_remove at drivers/dma/xilinx/xilinx_dma.c:2546
Reported-by: Radhey Shyam Pandey <radheys@xilinx.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Fixes: e81274cd6b52 ("dmaengine: add support to dynamic register/unregister of channels")
---
drivers/dma/dmaengine.c | 1 -
drivers/dma/idxd/dma.c | 5 ++++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index 962cbb5e5f7f..fe6a460c4373 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -1110,7 +1110,6 @@ static void __dma_async_device_channel_unregister(struct dma_device *device,
"%s called while %d clients hold a reference\n",
__func__, chan->client_count);
mutex_lock(&dma_list_mutex);
- list_del(&chan->device_node);
device->chancnt--;
chan->dev->chan = NULL;
mutex_unlock(&dma_list_mutex);
diff --git a/drivers/dma/idxd/dma.c b/drivers/dma/idxd/dma.c
index 90d19d06783a..a15e50126434 100644
--- a/drivers/dma/idxd/dma.c
+++ b/drivers/dma/idxd/dma.c
@@ -206,5 +206,8 @@ int idxd_register_dma_channel(struct idxd_wq *wq)
void idxd_unregister_dma_channel(struct idxd_wq *wq)
{
- dma_async_device_channel_unregister(&wq->idxd->dma_dev, &wq->dma_chan);
+ struct dma_chan *chan = &wq->dma_chan;
+
+ dma_async_device_channel_unregister(&wq->idxd->dma_dev, chan);
+ list_del(&chan->device_node);
}
^ permalink raw reply related [flat|nested] 3+ messages in thread* RE: [PATCH] dmaengine: move channel device_node deletion to driver
2021-01-18 17:28 [PATCH] dmaengine: move channel device_node deletion to driver Dave Jiang
@ 2021-01-19 16:00 ` Radhey Shyam Pandey
2021-01-19 16:40 ` Vinod Koul
1 sibling, 0 replies; 3+ messages in thread
From: Radhey Shyam Pandey @ 2021-01-19 16:00 UTC (permalink / raw)
To: Dave Jiang, vkoul@kernel.org
Cc: dmaengine@vger.kernel.org, pthomas8589@gmail.com, Michal Simek
> -----Original Message-----
> From: Dave Jiang <dave.jiang@intel.com>
> Sent: Monday, January 18, 2021 10:59 PM
> To: vkoul@kernel.org
> Cc: dmaengine@vger.kernel.org; Radhey Shyam Pandey
> <radheys@xilinx.com>; pthomas8589@gmail.com
> Subject: [PATCH] dmaengine: move channel device_node deletion to driver
>
> Channel device_node deletion is managed by the device driver rather than
> the dmaengine core. The deletion was accidentally introduced when making
> channel unregister dynamic. It causes xilinx_dma module to crash on unload
> as reported by Radhey. Remove chan->device_node delete in dmaengine
> and
> also fix up idxd driver.
>
> [ 42.142705] Internal error: Oops: 96000044 [#1] SMP
> [ 42.147566] Modules linked in: xilinx_dma(-) clk_xlnx_clock_wizard
> uio_pdrv_genirq
> [ 42.155139] CPU: 1 PID: 2075 Comm: rmmod Not tainted 5.10.1-00026-
> g3a2e6dd7a05-dirty #192
> [ 42.163302] Hardware name: Enclustra XU5 SOM (DT)
> [ 42.167992] pstate: 40000005 (nZcv daif -PAN -UAO -TCO BTYPE=--)
> [ 42.173996] pc : xilinx_dma_chan_remove+0x74/0xa0 [xilinx_dma]
> [ 42.179815] lr : xilinx_dma_chan_remove+0x70/0xa0 [xilinx_dma]
> [ 42.185636] sp : ffffffc01112bca0
> [ 42.188935] x29: ffffffc01112bca0 x28: ffffff80402ea640
>
> xilinx_dma_chan_remove+0x74/0xa0:
> __list_del at ./include/linux/list.h:112 (inlined by)
> __list_del_entry at./include/linux/list.h:135 (inlined by)
> list_del at ./include/linux/list.h:146 (inlined by)
> xilinx_dma_chan_remove at drivers/dma/xilinx/xilinx_dma.c:2546
>
> Reported-by: Radhey Shyam Pandey <radheys@xilinx.com>
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> Fixes: e81274cd6b52 ("dmaengine: add support to dynamic
> register/unregister of channels")
For xilinx_dma driver:
Tested-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
Thanks for the fix!
> ---
> drivers/dma/dmaengine.c | 1 -
> drivers/dma/idxd/dma.c | 5 ++++-
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
> index 962cbb5e5f7f..fe6a460c4373 100644
> --- a/drivers/dma/dmaengine.c
> +++ b/drivers/dma/dmaengine.c
> @@ -1110,7 +1110,6 @@ static void
> __dma_async_device_channel_unregister(struct dma_device *device,
> "%s called while %d clients hold a reference\n",
> __func__, chan->client_count);
> mutex_lock(&dma_list_mutex);
> - list_del(&chan->device_node);
> device->chancnt--;
> chan->dev->chan = NULL;
> mutex_unlock(&dma_list_mutex);
> diff --git a/drivers/dma/idxd/dma.c b/drivers/dma/idxd/dma.c
> index 90d19d06783a..a15e50126434 100644
> --- a/drivers/dma/idxd/dma.c
> +++ b/drivers/dma/idxd/dma.c
> @@ -206,5 +206,8 @@ int idxd_register_dma_channel(struct idxd_wq *wq)
>
> void idxd_unregister_dma_channel(struct idxd_wq *wq)
> {
> - dma_async_device_channel_unregister(&wq->idxd->dma_dev, &wq-
> >dma_chan);
> + struct dma_chan *chan = &wq->dma_chan;
> +
> + dma_async_device_channel_unregister(&wq->idxd->dma_dev,
> chan);
> + list_del(&chan->device_node);
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] dmaengine: move channel device_node deletion to driver
2021-01-18 17:28 [PATCH] dmaengine: move channel device_node deletion to driver Dave Jiang
2021-01-19 16:00 ` Radhey Shyam Pandey
@ 2021-01-19 16:40 ` Vinod Koul
1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2021-01-19 16:40 UTC (permalink / raw)
To: Dave Jiang; +Cc: dmaengine, radheys, pthomas8589
On 18-01-21, 10:28, Dave Jiang wrote:
> Channel device_node deletion is managed by the device driver rather than
> the dmaengine core. The deletion was accidentally introduced when making
> channel unregister dynamic. It causes xilinx_dma module to crash on unload
> as reported by Radhey. Remove chan->device_node delete in dmaengine and
> also fix up idxd driver.
>
> [ 42.142705] Internal error: Oops: 96000044 [#1] SMP
> [ 42.147566] Modules linked in: xilinx_dma(-) clk_xlnx_clock_wizard uio_pdrv_genirq
> [ 42.155139] CPU: 1 PID: 2075 Comm: rmmod Not tainted 5.10.1-00026-g3a2e6dd7a05-dirty #192
> [ 42.163302] Hardware name: Enclustra XU5 SOM (DT)
> [ 42.167992] pstate: 40000005 (nZcv daif -PAN -UAO -TCO BTYPE=--)
> [ 42.173996] pc : xilinx_dma_chan_remove+0x74/0xa0 [xilinx_dma]
> [ 42.179815] lr : xilinx_dma_chan_remove+0x70/0xa0 [xilinx_dma]
> [ 42.185636] sp : ffffffc01112bca0
> [ 42.188935] x29: ffffffc01112bca0 x28: ffffff80402ea640
>
> xilinx_dma_chan_remove+0x74/0xa0:
> __list_del at ./include/linux/list.h:112 (inlined by)
> __list_del_entry at./include/linux/list.h:135 (inlined by)
> list_del at ./include/linux/list.h:146 (inlined by)
> xilinx_dma_chan_remove at drivers/dma/xilinx/xilinx_dma.c:2546
Applied, thanks
--
~Vinod
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-01-19 21:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-18 17:28 [PATCH] dmaengine: move channel device_node deletion to driver Dave Jiang
2021-01-19 16:00 ` Radhey Shyam Pandey
2021-01-19 16:40 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox