Linux USB
 help / color / mirror / Atom feed
From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Sebastian Reichel <sebastian.reichel@collabora.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	Heiko Stuebner <heiko@sntech.de>, Vinod Koul <vkoul@kernel.org>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Manivannan Sadhasivam <mani@kernel.org>,
	Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>,
	Krishna Kurapati <krishna.kurapati@oss.qualcomm.com>,
	Chaoyi Chen <chaoyi.chen@rock-chips.com>,
	Igor Paunovic <royalnet026@gmail.com>,
	Alexey Charkov <alchark@flipper.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-rockchip@lists.infradead.org"
	<linux-rockchip@lists.infradead.org>,
	"linux-phy@lists.infradead.org" <linux-phy@lists.infradead.org>,
	"kernel@collabora.com" <kernel@collabora.com>
Subject: Re: [PATCH v19 5/6] usb: dwc3: core: only access GUSB3PIPECTL under lock
Date: Fri, 4 Dec 2026 22:45:44 +0000	[thread overview]
Message-ID: <axM_nFg9Ob8hmrXA@vbox> (raw)
In-Reply-To: <axMMyT5G4TPrGvO5@vbox>

On Fri, Dec 04, 2026, Thinh Nguyen wrote:
> On Fri, Dec 04, 2026, Sebastian Reichel wrote:
> > Hello Greg,
> > 
> > On Thu, Dec 03, 2026 at 05:48:53PM +0100, Greg Kroah-Hartman wrote:
> > > On Sat, Nov 14, 2026 at 02:02:04AM +0100, Sebastian Reichel wrote:
> > > > Update dwc3_enable_susphy() to take dwc->lock while updating
> > > > GUSB3PIPECTL to protect the read-modify-write cycle from other users
> > > > accessing the same register, which is soon introduced.
> > > > 
> > > > Note: technically there is already dwc3_ss_phy_setup() as a second user,
> > > > but it runs and finishes before any call to dwc3_enable_susphy() should
> > > > happen.
> > > > 
> > > > Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> > > > ---
> > > >  drivers/usb/dwc3/core.c | 19 +++++++++++++++----
> > > >  drivers/usb/dwc3/glue.h |  2 +-
> > > >  2 files changed, 16 insertions(+), 5 deletions(-)
> > > > 
> > > > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> > > > index daf5aec07fbf..0cb1b33a7c98 100644
> > > > --- a/drivers/usb/dwc3/core.c
> > > > +++ b/drivers/usb/dwc3/core.c
> > > > @@ -108,11 +108,13 @@ static int dwc3_get_dr_mode(struct dwc3 *dwc)
> > > >  	return 0;
> > > >  }
> > > >  
> > > > -void dwc3_enable_susphy(struct dwc3 *dwc, bool enable)
> > > > +static void __dwc3_enable_susphy(struct dwc3 *dwc, bool enable)
> > > >  {
> > > >  	u32 reg;
> > > >  	int i;
> > > >  
> > > > +	lockdep_assert_held(&dwc->lock);
> > > 
> > > Can't you also use __must_hold()?
> > 
> > That sure works and looks quite sensible to me. As this is the only
> > feedback for the v19, would it be okay to send that as follow-up?
> 
> I don't think __must_hold() is needed here. dwc3 doesn't use it
> anywhere, and dwc3_set_prtcap() only needs the lock when ignore_susphy
> is false, so lockdep_assert_held() fits better.

On second thought, a lock that dwc3_set_prtcap() needs only for some
ignore_susphy values is a bad interface, and the GCTL read-modify-write
needs the lock anyway.

As a follow-up, please make it unconditional. Add
__must_hold(&dwc->lock) to dwc3_set_prtcap() and __dwc3_enable_susphy(),
and take the lock in the callers that pass ignore_susphy == true.

Document that dwc3_set_prtcap() must be called with the lock held.

> 
> Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
> 

The ack on this patch stands.

Thanks,
Thinh

  reply	other threads:[~2026-12-04 22:46 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-14  1:01 [PATCH v19 0/6] usb: dwc3: introduce Rockchip glue driver Sebastian Reichel
2026-11-14  1:02 ` [PATCH v19 1/6] phy: rockchip: usbdp: Track PHY power state Sebastian Reichel
2026-11-14  1:15   ` sashiko-bot
2026-11-14  1:02 ` [PATCH v19 2/6] phy: rockchip: usbdp: Add reset hook support for dwc3 Sebastian Reichel
2026-11-14  1:17   ` sashiko-bot
2026-11-14  1:02 ` [PATCH v19 3/6] usb: dwc3: rockchip: introduce glue driver Sebastian Reichel
2026-11-14  1:08   ` sashiko-bot
2026-12-04 18:27   ` Thinh Nguyen
2026-11-14  1:02 ` [PATCH v19 4/6] usb: dwc3: core: add post PHY registration hook for platform glue Sebastian Reichel
2026-11-14  1:05   ` sashiko-bot
2026-11-14  1:02 ` [PATCH v19 5/6] usb: dwc3: core: only access GUSB3PIPECTL under lock Sebastian Reichel
2026-11-14  1:09   ` sashiko-bot
2026-12-03 16:48   ` Greg Kroah-Hartman
2026-12-04 16:59     ` Sebastian Reichel
2026-12-04 19:04       ` Thinh Nguyen
2026-12-04 22:45         ` Thinh Nguyen [this message]
2026-11-14  1:02 ` [PATCH v19 6/6] usb: dwc3: rockchip: add USBDP PHY reset quirk Sebastian Reichel
2026-11-14  1:28   ` sashiko-bot
2026-12-04 18:52   ` Thinh Nguyen
2026-11-21 11:37 ` [PATCH v19 0/6] usb: dwc3: introduce Rockchip glue driver Ricardo Pardini

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=axM_nFg9Ob8hmrXA@vbox \
    --to=thinh.nguyen@synopsys.com \
    --cc=alchark@flipper.net \
    --cc=chaoyi.chen@rock-chips.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heiko@sntech.de \
    --cc=kernel@collabora.com \
    --cc=krishna.kurapati@oss.qualcomm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mani@kernel.org \
    --cc=manivannan.sadhasivam@oss.qualcomm.com \
    --cc=neil.armstrong@linaro.org \
    --cc=royalnet026@gmail.com \
    --cc=sebastian.reichel@collabora.com \
    --cc=vkoul@kernel.org \
    /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