Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@nabladev.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: Claudiu Beznea <claudiu.beznea@tuxon.dev>,
	pavel@nabladev.com, Nobuhiro Iwamatsu <iwamatsu@nigauri.org>,
	stable@vger.kernel.org, cip-dev@lists.cip-project.org,
	Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>,
	Sasha Levin <sashal@kernel.org>
Subject: Re: [cip-dev] [PATCH for 5.10.y] phy: renesas: rcar-gen3-usb2: Fix the use of msleep during spinlock
Date: Tue, 5 May 2026 23:01:43 +0200	[thread overview]
Message-ID: <afpat8GZyp-AiD5W@duo.ucw.cz> (raw)
In-Reply-To: <2026050519-stencil-sequester-187b@gregkh>

[-- Attachment #1: Type: text/plain, Size: 2074 bytes --]

Hi!

> > > > > From: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
> > > > > 
> > > > > This fixes an issue caused by the use of msleep during spinlock.
> > > > > In the original commit, msleep was changed to mdelay, but this fix was not
> > > > > carried over during the backport to 5.10.y tree.
> > > > 
> > > > Doing this as a quick fix is probably okay, but this should not be
> > > > final version.
> > > > 
> > > > You are right that msleep inside spinlock will blow up immediately:
> > > > 
> > > > > ```
> > > > > [   62.677594] BUG: scheduling while atomic: kworker/1:2/126/0x00000002
> > > > > [   62.683957] Modules linked in:
> > > > 
> > > > But mdelay for 20 msec inside irqsave spinlock is borderline
> > > > unacceptable, too.
...
> > > I'm going to investigate and come with a better approach for this.
> > 
> > On a second thought, the proper fix would have to go to upstream first. To
> > fix the problem currently seen, could we integrate this patch as is?
> 
> No, please work upstream first.

Upstream has the mdelay:

drivers/phy/renesas/phy-rcar-gen3-usb2.c in rcar_gen3_init_otg() --
mdelay(20) and has the spinlock,

static int rcar_gen3_phy_usb2_init(struct phy *p)
{
	...
        guard(spinlock_irqsave)(&channel->lock);
	...
        /* Initialize otg part (only if we initialize a PHY with IRQs). */
        if (rphy->int_enable_bits)
                rcar_gen3_init_otg(channel);


So what Iwamatsu-san's patch matches upstream, and is good solution
for -stable for now. I have just pointed out, that, well, mdelay(20)
inside a spinlock is not great.

7.1-rc2: mdelay inside spinlock -- not great

5.10.250: msleep but no spinlock -- missing locking, bad!

5.10.254: msleep inside spinlock -- fails to boot, bad, bad, BAD! (and
also regression from 5.10.250).

Please allow Iwamatsu-san / Renesas to get this to 7.1 level of "not
great" situation; Claudiu will work with upstream to get 7.1 to "good"
situation, and then we can thing about backports.

Thanks and best regards,
								Pavel

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

      reply	other threads:[~2026-05-05 21:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-01 22:58 [PATCH for 5.10.y] phy: renesas: rcar-gen3-usb2: Fix the use of msleep during spinlock Nobuhiro Iwamatsu
2026-05-04  9:18 ` [cip-dev] " Pavel Machek
2026-05-04 11:13   ` Nobuhiro Iwamatsu
2026-05-05  8:40   ` Claudiu Beznea
2026-05-05  8:49     ` Claudiu Beznea
2026-05-05  8:53       ` Greg KH
2026-05-05 21:01         ` Pavel Machek [this message]

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=afpat8GZyp-AiD5W@duo.ucw.cz \
    --to=pavel@nabladev.com \
    --cc=cip-dev@lists.cip-project.org \
    --cc=claudiu.beznea.uj@bp.renesas.com \
    --cc=claudiu.beznea@tuxon.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=iwamatsu@nigauri.org \
    --cc=sashal@kernel.org \
    --cc=stable@vger.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