RE: dmaengine: CPU stalls while loading bluetooth module

From: bumyong.lee
Date: Tue Mar 05 2024 - 02:14:29 EST


Hello.

> we have encountered CPU stalls in mainline kernel while loading the
> bluetooth module. We have custom board based on rockchip rv1109 soc and
> there is bluetooth chipset of relatek 8821cs. CPU is stalls while realtek
> 8821cs module.
>
> Bug/Regression:
> In current mainline, we found CPU is stalls when we load bluetooth module.
> git bisect shows commit 22a9d9585812440211b0b34a6bc02ade62314be4
> as a bad, which produce CPU stalls.
>
> git show 22a9d9585812440211b0b34a6bc02ade62314be4
> commit 22a9d9585812440211b0b34a6bc02ade62314be4
> Author: Bumyong Lee <bumyong.lee@xxxxxxxxxxx>
> Date: Tue Dec 19 14:50:26 2023 +0900
>
> dmaengine: pl330: issue_pending waits until WFP state
>
> According to DMA-330 errata notice[1] 71930, DMAKILL
> cannot clear internal signal, named pipeline_req_active.
> it makes that pl330 would wait forever in WFP state
> although dma already send dma request if pl330 gets
> dma request before entering WFP state.
>
> The errata suggests that polling until entering WFP state
> as workaround and then peripherals allows to issue dma request.
>
> [1]: https://developer.arm.com/documentation/genc008428/latest
>
> Signed-off-by: Bumyong Lee <bumyong.lee@xxxxxxxxxxx>
> Link:
> https://lore.kernel.org/r/20231219055026.118695-1-bumyong.lee@xxxxxxxxxxx
> Signed-off-by: Vinod Koul <vkoul@xxxxxxxxxx>
>
> diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index
> 3cf0b38387ae..c29744bfdf2c 100644
> --- a/drivers/dma/pl330.c
> +++ b/drivers/dma/pl330.c
> @@ -1053,6 +1053,9 @@ static bool _trigger(struct pl330_thread *thrd)
>
> thrd->req_running = idx;
>
> + if (desc->rqtype == DMA_MEM_TO_DEV || desc->rqtype ==
> DMA_DEV_TO_MEM)
> + UNTIL(thrd, PL330_STATE_WFP);
> +
> return true;
> }
>
> By reverting this commit, we have success in loading of bluetooth module.
>
>

> Output of CPU stalls:
> # modprobe hci_uart
> [ 27.024749] Bluetooth: HCI UART driver ver 2.3
> [ 27.025284] Bluetooth: HCI UART protocol Three-wire (H5) registered
> # [ 28.125338] dwmmc_rockchip ffc70000.mmc: Unexpected interrupt latency
> [ 33.245339] dwmmc_rockchip ffc50000.mmc: Unexpected interrupt latency
> [ 326.195321] rcu: INFO: rcu_sched detected stalls on CPUs/tasks:
> [ 326.195880] rcu: 0-...0: (3 ticks this GP) idle=e5f4/1/0x40000000
> softirq=551/552 fqs=420
> [ 326.196621] rcu: hardirqs softirqs csw/system
> [ 326.197115] rcu: number: 0 0 0
> [ 326.197612] rcu: cputime: 0 0 0 ==>
> 10500(ms)
> [ 326.198231] rcu: (detected by 1, t=2105 jiffies, g=-455, q=17
> ncpus=2)
> [ 326.198823] Sending NMI from CPU 1 to CPUs 0:
>
> Expected Output:
> # modprobe hci_uart
> [ 30.690321] Bluetooth: HCI UART driver ver 2.3
> [ 30.690852] Bluetooth: HCI UART protocol Three-wire (H5) registered
> # [ 31.453586] Bluetooth: hci0: RTL: examining hci_ver=08 hci_rev=000c
> lmp_ver=08 lmp_subver=8821
> [ 31.458061] Bluetooth: hci0: RTL: rom_version status=0 version=1
> [ 31.458608] Bluetooth: hci0: RTL: loading rtl_bt/rtl8821cs_fw.bin
> [ 31.465029] Bluetooth: hci0: RTL: loading rtl_bt/rtl8821cs_config.bin
> [ 31.483926] Bluetooth: hci0: RTL: cfg_sz 25, total sz 36953
> [ 32.213105] Bluetooth: hci0: RTL: fw version 0x75b8f098
> [ 32.274216] Bluetooth: MGMT ver 1.22
> [ 32.285376] NET: Registered PF_ALG protocol family

I discussed this issue. Could you refer to this[1]?
I haven't received anymore reply from him after that.
If you have any more opinion, please let me know.

[1]: https://lore.kernel.org/lkml/000001da3869$ca643fa0$5f2cbee0$@samsung.com/T/

Best Regards