public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Meng Li <Meng.Li@windriver.com>,
	Thinh.Nguyen@synopsys.com, gregkh@linuxfoundation.org,
	quic_uaggarwa@quicinc.com, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: dwc3: core: remove lock of otg mode during gadget suspend/resume to avoid deadlock
Date: Thu, 13 Jun 2024 10:52:42 +0200	[thread overview]
Message-ID: <69839983-5ec0-4207-a798-8cdac7444f20@kernel.org> (raw)
In-Reply-To: <20240613072310.1927966-1-Meng.Li@windriver.com>

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!

Let me prepare patches for that...

Best regards,
Krzysztof


  parent reply	other threads:[~2024-06-13  8:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-13  7:23 [PATCH] usb: dwc3: core: remove lock of otg mode during gadget suspend/resume to avoid deadlock Meng Li
2024-06-13  7:25 ` Li, Meng
2024-06-13  8:52 ` Krzysztof Kozlowski [this message]
2024-06-13 11:22   ` Li, Meng
  -- strict thread matches above, loose matches on Subject: below --
2024-06-13  7:39 Meng Li
2024-06-13  8:06 ` Greg KH
2024-06-13 11:59   ` Li, Meng
2024-06-17 23:59     ` Thinh Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=69839983-5ec0-4207-a798-8cdac7444f20@kernel.org \
    --to=krzk@kernel.org \
    --cc=Meng.Li@windriver.com \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=quic_uaggarwa@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox