mhi.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [bug report] bus: mhi: ep: Add support for suspending and resuming channels
@ 2023-01-17 14:17 Dan Carpenter
  2023-01-23  7:53 ` Manivannan Sadhasivam
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2023-01-17 14:17 UTC (permalink / raw)
  To: mani; +Cc: mhi

Hello Manivannan Sadhasivam,

The patch e4b7b5f0f30a: "bus: mhi: ep: Add support for suspending and
resuming channels" from Apr 5, 2022, leads to the following Smatch
static checker warning:

	drivers/bus/mhi/ep/main.c:1141 mhi_ep_resume_channels()
	warn: sleeping in atomic context

drivers/bus/mhi/ep/main.c
    1129 void mhi_ep_resume_channels(struct mhi_ep_cntrl *mhi_cntrl)
    1130 {
    1131         struct mhi_ep_chan *mhi_chan;
    1132         u32 tmp;
    1133         int i;
    1134 
    1135         for (i = 0; i < mhi_cntrl->max_chan; i++) {
    1136                 mhi_chan = &mhi_cntrl->mhi_chan[i];
    1137 
    1138                 if (!mhi_chan->mhi_dev)
    1139                         continue;
    1140 
--> 1141                 mutex_lock(&mhi_chan->lock);
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This is called from mhi_ep_set_m0_state().  The mhi_ep_set_m0_state()
function takes a spinlock so we can't take a mutex if we're holding a
spinlock.

Enable CONFIG_DEBUG_ATOMIC_SLEEP for more information.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [bug report] bus: mhi: ep: Add support for suspending and resuming channels
  2023-01-17 14:17 [bug report] bus: mhi: ep: Add support for suspending and resuming channels Dan Carpenter
@ 2023-01-23  7:53 ` Manivannan Sadhasivam
  0 siblings, 0 replies; 2+ messages in thread
From: Manivannan Sadhasivam @ 2023-01-23  7:53 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: mani, mhi

On Tue, Jan 17, 2023 at 05:17:02PM +0300, Dan Carpenter wrote:
> Hello Manivannan Sadhasivam,
> 
> The patch e4b7b5f0f30a: "bus: mhi: ep: Add support for suspending and
> resuming channels" from Apr 5, 2022, leads to the following Smatch
> static checker warning:
> 
> 	drivers/bus/mhi/ep/main.c:1141 mhi_ep_resume_channels()
> 	warn: sleeping in atomic context
> 
> drivers/bus/mhi/ep/main.c
>     1129 void mhi_ep_resume_channels(struct mhi_ep_cntrl *mhi_cntrl)
>     1130 {
>     1131         struct mhi_ep_chan *mhi_chan;
>     1132         u32 tmp;
>     1133         int i;
>     1134 
>     1135         for (i = 0; i < mhi_cntrl->max_chan; i++) {
>     1136                 mhi_chan = &mhi_cntrl->mhi_chan[i];
>     1137 
>     1138                 if (!mhi_chan->mhi_dev)
>     1139                         continue;
>     1140 
> --> 1141                 mutex_lock(&mhi_chan->lock);
>                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> This is called from mhi_ep_set_m0_state().  The mhi_ep_set_m0_state()
> function takes a spinlock so we can't take a mutex if we're holding a
> spinlock.
> 
> Enable CONFIG_DEBUG_ATOMIC_SLEEP for more information.
> 

Thanks Dan for the report!

Submitted a fix now: https://lore.kernel.org/mhi/20230123075049.168040-1-manivannan.sadhasivam@linaro.org/

Thanks,
Mani

> regards,
> dan carpenter
> 
> 

-- 
மணிவண்ணன் சதாசிவம்

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-23  7:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-17 14:17 [bug report] bus: mhi: ep: Add support for suspending and resuming channels Dan Carpenter
2023-01-23  7:53 ` Manivannan Sadhasivam

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).