* [PATCH] Bluetooth: hci_qca: Fix "Sleep inside atomic section" warning
@ 2018-05-29 16:37 Thierry Escande
2018-05-30 6:13 ` Marcel Holtmann
0 siblings, 1 reply; 2+ messages in thread
From: Thierry Escande @ 2018-05-29 16:37 UTC (permalink / raw)
To: Marcel Holtmann, Johan Hedberg
Cc: Bjorn Andersson, linux-bluetooth, linux-arm-msm, linux-kernel
This patch fixes the following warning during boot:
do not call blocking ops when !TASK_RUNNING; state=1 set at
[<(ptrval)>] qca_setup+0x194/0x750 [hci_uart]
WARNING: CPU: 2 PID: 1878 at kernel/sched/core.c:6135
__might_sleep+0x7c/0x88
In qca_set_baudrate(), the current task state is set to
TASK_UNINTERRUPTIBLE before going to sleep for 300ms. It was then
restored to TASK_INTERRUPTIBLE. This patch sets the current task state
back to TASK_RUNNING instead.
Signed-off-by: Thierry Escande <thierry.escande@linaro.org>
---
drivers/bluetooth/hci_qca.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index f05382b5a65d..51790dd02afb 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -910,7 +910,7 @@ static int qca_set_baudrate(struct hci_dev *hdev, uint8_t baudrate)
*/
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(msecs_to_jiffies(BAUDRATE_SETTLE_TIMEOUT_MS));
- set_current_state(TASK_INTERRUPTIBLE);
+ set_current_state(TASK_RUNNING);
return 0;
}
--
2.14.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Bluetooth: hci_qca: Fix "Sleep inside atomic section" warning
2018-05-29 16:37 [PATCH] Bluetooth: hci_qca: Fix "Sleep inside atomic section" warning Thierry Escande
@ 2018-05-30 6:13 ` Marcel Holtmann
0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2018-05-30 6:13 UTC (permalink / raw)
To: Thierry Escande
Cc: Johan Hedberg, Bjorn Andersson, BlueZ development, linux-arm-msm,
linux-kernel
Hi Thierry,
> This patch fixes the following warning during boot:
>
> do not call blocking ops when !TASK_RUNNING; state=1 set at
> [<(ptrval)>] qca_setup+0x194/0x750 [hci_uart]
> WARNING: CPU: 2 PID: 1878 at kernel/sched/core.c:6135
> __might_sleep+0x7c/0x88
>
> In qca_set_baudrate(), the current task state is set to
> TASK_UNINTERRUPTIBLE before going to sleep for 300ms. It was then
> restored to TASK_INTERRUPTIBLE. This patch sets the current task state
> back to TASK_RUNNING instead.
>
> Signed-off-by: Thierry Escande <thierry.escande@linaro.org>
> ---
> drivers/bluetooth/hci_qca.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
patch has been applied to bluetooth-next tree.
> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index f05382b5a65d..51790dd02afb 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
> @@ -910,7 +910,7 @@ static int qca_set_baudrate(struct hci_dev *hdev, uint8_t baudrate)
> */
> set_current_state(TASK_UNINTERRUPTIBLE);
> schedule_timeout(msecs_to_jiffies(BAUDRATE_SETTLE_TIMEOUT_MS));
> - set_current_state(TASK_INTERRUPTIBLE);
> + set_current_state(TASK_RUNNING);
>
However wouldn’t it better to use msleep or similar instead of open coding it with schedule_timeout?
Regards
Marcel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-05-30 6:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-29 16:37 [PATCH] Bluetooth: hci_qca: Fix "Sleep inside atomic section" warning Thierry Escande
2018-05-30 6:13 ` Marcel Holtmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).