From: Brian Masney <bmasney@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: "Marek Szyprowski" <m.szyprowski@samsung.com>,
linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-pwm@vger.kernel.org, "Stephen Boyd" <sboyd@kernel.org>,
"Brian Masney" <bmasney+clk@redhat.com>,
"Jerome Brunet" <jbrunet+clk@baylibre.com>,
"Ingo Molnar" <mingo@redhat.com>, "Will Deacon" <will@kernel.org>,
"Waiman Long" <longman@redhat.com>,
"we Kleine-König" <ukleinek@kernel.org>
Subject: Re: [RFC/PATCH] clk: add lockdep_ignore_clk_prepare_lock cmdline option
Date: Thu, 3 Sep 2026 13:20:10 -0400 [thread overview]
Message-ID: <apmsSsXdc32Z09_f@redhat.com> (raw)
In-Reply-To: <20260828133803.GT776954@noisy.programming.kicks-ass.net>
Hi Peter,
On Fri, Aug 28, 2026 at 03:38:03PM +0200, Peter Zijlstra wrote:
> On Fri, Aug 28, 2026 at 03:14:07PM +0200, Marek Szyprowski wrote:
> > The clock framework uses a single global re-entrant mutex, prepare_lock,
>
> There is no such primitive in the kernel -- this means the clock people
> rolled their own. Why ?!
>
> > to serialize all operations on the whole clock tree. It is taken by
> > nearly every clk API call and it is held while calling into the clock
> > providers, which in turn often take their own locks or trigger runtime
> > PM. As a result prepare_lock sits in the middle of a large number of
> > lock chains and lockdep frequently reports possible circular locking
> > dependencies involving it.
> >
> > Such reports are often not real deadlocks, but once the first one is hit
> > lockdep turns itself off and all subsequent locking problems - including
> > the ones actually being investigated - are no longer reported.
> >
> > Add a "lockdep_ignore_clk_prepare_lock" kernel command line parameter,
> > which marks the prepare_lock class as novalidate, so lockdep skips the
> > dependency tracking for it and keeps validating the rest of the system.
> >
> > The option is only available when CONFIG_LOCKDEP is enabled and is meant
> > purely as a debugging aid.
> >
> > Assisted-by: Claude:claude-opus-5
> > Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> > ---
> > The problems with clock framework's prepare_lock are well known and
> > there are machines that always report lockdep issues related to it. A
> > good example are Khadas VIM3/VIM3l boards, on which prepare_lock
> > interferes with locks used in PWM subsytem:
> >
> > https://lore.kernel.org/all/adqtn6iljcguv3m3ovhltusbbf4mljzlwg73yklaudvjjtazxv@vyf5fvuzic6x/
> >
> > This new cmdline option allows to hide prepare_lock related issues on
> > the test machines possibly enabling lockdep to catch other issues.
>
> This is horrible. Why not fix the clock framework?
I'm one of the two new co-maintainers for the clk subsystem. Do you have
a suggestion for how you would change this locking in the core clk
framework? Long term I'd like to see more fine grained locking since I
see at boot up on my Thinkpad x13s laptop that it takes ~10ms in some
cases to acquire the prepare lock.
Brian
prev parent reply other threads:[~2026-09-03 17:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20260828131428eucas1p2cc2d9767d5ed62b8297c2cff0295226d@eucas1p2.samsung.com>
2026-08-28 13:14 ` [RFC/PATCH] clk: add lockdep_ignore_clk_prepare_lock cmdline option Marek Szyprowski
2026-08-28 13:23 ` sashiko-bot
2026-08-28 13:38 ` Peter Zijlstra
2026-09-03 17:20 ` Brian Masney [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=apmsSsXdc32Z09_f@redhat.com \
--to=bmasney@redhat.com \
--cc=bmasney+clk@redhat.com \
--cc=jbrunet+clk@baylibre.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=longman@redhat.com \
--cc=m.szyprowski@samsung.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=sboyd@kernel.org \
--cc=ukleinek@kernel.org \
--cc=will@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