mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Philipp Zabel <p.zabel@pengutronix.de>
To: "Alvin Šipraga" <alvin.sipraga@analog.com>
Cc: shengjiu.wang@oss.nxp.com, krzk@kernel.org, hansg@kernel.org,
	 linux-kernel@vger.kernel.org, broonie@kernel.org
Subject: Re: [PATCH v3] reset: core: Serialize concurrent deassert/reset of shared resets
Date: Thu, 22 Oct 2026 16:34:57 +0200	[thread overview]
Message-ID: <cfca068658eee0906bd9ea4bba6c66e39fddff08.camel@pengutronix.de> (raw)
In-Reply-To: <atoKa8JBszlQDGYE@analog.com>

On Do, 2026-10-22 at 15:58 +0200, Alvin Šipraga wrote:
[...]
> > > I had the same thought. But I kept bumping into the fact that the
> > > rcdev->lock mutex is taken in reset_control_acquire() while we are
> > > holding rstc->lock. If rstc->lock becomes a spinlock
> > 
> > Why would it? shared_lock is a mutex, too.
> 
> I'm talking about the next step, after auditing all drivers and setting
> can_sleep = true where necessary.
> 
> As I pointed out in my reply to v2 [1], the shared reset race exists
> regardless of whether the underlying reset controller can sleep or
> not. Shengjiu's fix only applies to controllers which can sleep. The fix
> can be extended to controllers that can't sleep too, but only if
> shared_lock is a spinlock - since, in general, the API permits calls in
> atomic context. (Those atomic callers obviously rely implicitly on the
> non-blocking nature of the backing controller, but that's a bit besides
> the point).
> 
> So the idea I outlined in [1] is for this shared_lock to be either a
> mutex or a spinlock depending on the controller's can_sleep. The logic
> of this patch staying the same.
> 
> Maybe I misunderstood you here:
> 
> > > > We could also combine this with the exclusive reset control's acquire
> > > > "lock" if we move that inside the SRCU section.
> 
> I understood this to mean "collapse lock and shared_lock into a single
> lock". And I was just saying that - with the above in mind - if
> shared_lock might be either a mutex or a spinlock, then it doesn't work
> to collapse them, because...

The disconnect might be that I assumed the mutex would still exist and
we'd just add a spinlock next to it, and you plan to use a union like
regmap does?

Either way, the point is moot if no (acquire_)lock is needed in struct
reset_control.

> > 
> Anyway, I will prepare some patches and you can take a look.
[...]
> I'll send a patch.

Thank you.

regards
Philipp

  reply	other threads:[~2026-10-22 14:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-21  3:09 shengjiu.wang
2026-10-21 13:24 ` Philipp Zabel
2026-10-21 14:16   ` Alvin Šipraga
2026-10-22  8:43     ` Philipp Zabel
2026-10-22 10:17       ` Alvin Šipraga
2026-10-22 13:00         ` Philipp Zabel
2026-10-22 13:58           ` Alvin Šipraga
2026-10-22 14:34             ` Philipp Zabel [this message]
2026-10-22  3:14   ` Shengjiu Wang
2026-10-22 13:31     ` Shengjiu Wang
2026-10-22 14:41       ` Philipp Zabel

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=cfca068658eee0906bd9ea4bba6c66e39fddff08.camel@pengutronix.de \
    --to=p.zabel@pengutronix.de \
    --cc=alvin.sipraga@analog.com \
    --cc=broonie@kernel.org \
    --cc=hansg@kernel.org \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shengjiu.wang@oss.nxp.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

all inboxes | Powered by JetHome®