[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <feba8981-5568-fa2f-ccc3-c5debf3c7091@gmail.com>
Date: Sun, 3 Apr 2022 00:13:55 +0300
From: Pavel Skripkin <paskripkin@...il.com>
To: Michael Straube <straube.linux@...il.com>
Cc: Larry Finger <Larry.Finger@...inger.net>,
Phillip Potter <phil@...lpotter.co.uk>,
"open list:STAGING SUBSYSTEM" <linux-staging@...ts.linux.dev>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Greg KH <gregkh@...uxfoundation.org>
Subject: Re: staging: r8188eu: how to handle nested mutex under spinlock
Hi Michael,
On 4/2/22 23:47, Michael Straube wrote:
> Hi all,
>
> smatch reported a sleeping in atomic context.
>
> rtw_set_802_11_disassociate() <- disables preempt
> -> _rtw_pwr_wakeup()
> -> ips_leave()
>
> rtw_set_802_11_disassociate() takes a spinlock and ips_leave() uses a
> mutex.
>
> I'm fairly new to the locking stuff, but as far as I know this is not a
> false positive since mutex can sleep, but that's not allowed under a
> spinlock.
>
> What is the best way to handle this?
> I'm not sure if converting the mutex to a spinlock (including all the
> other places where the mutex is used) is the right thing to do?
>
I've looked into this like a month ago.
IMO, this code just need to be redesigned, since locking scheme is very
complicated there and, as smatch says, not correct.
Simple s/mutex_lock/spin_lock/ may work in that case, but one day
locking scheme should be reworked... Or just some code parts should be
dropped :))
With regards,
Pavel Skripkin
Powered by blists - more mailing lists