2024-05-08 12:34:44

by Dan Carpenter

[permalink] [raw]
Subject: [bug report] wifi: ath12k: flush all packets before suspend

Hello Baochen Qiang,

Commit 692921ead832 ("wifi: ath12k: flush all packets before
suspend") from Apr 22, 2024 (linux-next), leads to the following
Smatch static checker warning:

drivers/net/wireless/ath/ath12k/core.c:58 ath12k_core_suspend()
warn: sleeping in atomic context

drivers/net/wireless/ath/ath12k/core.c
48 int ret, i;
49
50 if (!ab->hw_params->supports_suspend)
51 return -EOPNOTSUPP;
52
53 rcu_read_lock();
^^^^^^^^^^^^^^^
Disables preemption.

54 for (i = 0; i < ab->num_radios; i++) {
55 ar = ath12k_mac_get_ar_by_pdev_id(ab, i);
56 if (!ar)
57 continue;
--> 58 ret = ath12k_mac_wait_tx_complete(ar);
^^^^^^^
Sleeping in atomic context.

59 if (ret) {
60 ath12k_warn(ab, "failed to wait tx complete: %d\n", ret);
61 rcu_read_unlock();
62 return ret;
63 }
64 }
65 rcu_read_unlock();

regards,
dan carpenter


2024-05-08 16:51:48

by Jeff Johnson

[permalink] [raw]
Subject: Re: [bug report] wifi: ath12k: flush all packets before suspend

On 5/8/2024 5:29 AM, Dan Carpenter wrote:
> Hello Baochen Qiang,
>
> Commit 692921ead832 ("wifi: ath12k: flush all packets before
> suspend") from Apr 22, 2024 (linux-next), leads to the following
> Smatch static checker warning:
>
> drivers/net/wireless/ath/ath12k/core.c:58 ath12k_core_suspend()
> warn: sleeping in atomic context

Hi Dan,
I'm not seeing this as part of my standard make W=1 C=1

What do I need to do in order to see this?
build_kernel_data.sh ??



2024-05-08 17:33:09

by Dan Carpenter

[permalink] [raw]
Subject: Re: [bug report] wifi: ath12k: flush all packets before suspend

On Wed, May 08, 2024 at 09:51:33AM -0700, Jeff Johnson wrote:
> On 5/8/2024 5:29 AM, Dan Carpenter wrote:
> > Hello Baochen Qiang,
> >
> > Commit 692921ead832 ("wifi: ath12k: flush all packets before
> > suspend") from Apr 22, 2024 (linux-next), leads to the following
> > Smatch static checker warning:
> >
> > drivers/net/wireless/ath/ath12k/core.c:58 ath12k_core_suspend()
> > warn: sleeping in atomic context
>
> Hi Dan,
> I'm not seeing this as part of my standard make W=1 C=1
>
> What do I need to do in order to see this?
> build_kernel_data.sh ??
>

Yeah. This is a smatch warning that requires build_kernel_data.sh
(probably you have to build several times which takes forever). The
might_sleep() is in synchronize_net().

It's better to do run time testing. If you run with
CONFIG_DEBUG_ATOMIC_SLEEP=y
then it will trigger a stack trace.

regards,
dan carpenter