[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
<PH0PR11MB5191030225F3A871EB0836AEF1C12@PH0PR11MB5191.namprd11.prod.outlook.com>
Date: Thu, 13 Jun 2024 11:22:56 +0000
From: "Li, Meng" <Meng.Li@...driver.com>
To: Krzysztof Kozlowski <krzk@...nel.org>,
"Thinh.Nguyen@...opsys.com"
<Thinh.Nguyen@...opsys.com>,
"gregkh@...uxfoundation.org"
<gregkh@...uxfoundation.org>,
"quic_uaggarwa@...cinc.com"
<quic_uaggarwa@...cinc.com>,
"linux-usb@...r.kernel.org"
<linux-usb@...r.kernel.org>,
"linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] usb: dwc3: core: remove lock of otg mode during gadget
suspend/resume to avoid deadlock
> -----Original Message-----
> From: Krzysztof Kozlowski <krzk@...nel.org>
> Sent: Thursday, June 13, 2024 4:53 PM
> To: Li, Meng <Meng.Li@...driver.com>; Thinh.Nguyen@...opsys.com;
> gregkh@...uxfoundation.org; quic_uaggarwa@...cinc.com; linux-
> usb@...r.kernel.org; linux-kernel@...r.kernel.org
> Subject: Re: [PATCH] usb: dwc3: core: remove lock of otg mode during gadget
> suspend/resume to avoid deadlock
>
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and
> know the content is safe.
>
> On 13/06/2024 09:23, Meng Li wrote:
> > When config CONFIG_USB_DWC3_DUAL_ROLE is selected, and trigger
> system
> > to enter suspend status with below command:
> > echo mem > /sys/power/state
> > There will be a deadlock issue occurring. Because
> > dwc3_gadget_suspend() also try to get the lock again when previous
> > invoked dwc3_suspend_common() has got the lock . This issue is introduced
> by commit c7ebd8149ee5 ("usb: dwc3:
> > gadget: Fix NULL pointer dereference in dwc3_gadget_suspend") that
> > removes the code of checking whether dwc->gadget_driver is NULL or
> > not. It causes the following code is executed and deadlock occurs when
> trying to get the spinlock.
> > To fix the deadlock issue, refer to commit 5265397f9442("usb: dwc3:
> > Remove
> > DWC3 locking during gadget suspend/resume"), remove lock of otg mode
> > during gadget suspend/resume.
>
> That's a funny way of fixing deadlocks: remove the lock. Of course it could be
> correct way with some justification why locking is not needed.
> No such justification here, so following your logic, let's remove locking
> everywhere and then no deadlocks possible!
>
I don't remove lock arbitrarily. I have show the commit 5265397f9442. It move the spinlock from dwc3_suspend_common() to dwc3_gadget_suspend() for device mode, but maybe forgot the case of otg move.
So, cause deadlock when dwc3_gadget_suspend() try to get the spinlock that has been got by dwc3_suspend_common(). So, I think it also needs to remove the spinlock for otg mode.
> Let me prepare patches for that...
I think you can comment on patch, propose some advice, rather than negate the effort of others without any comment directly.
As a maintainer of some parts of kernel, I think your communication style is not friendly, and not conducive to developers contributing to the community, because their enthusiasm was dampened.
If you create patch, please don't forgot to send to me, I want to learn what good solution you will show, and how much better than this patch.
Regards,
Meng
>
> Best regards,
> Krzysztof
Powered by blists - more mailing lists