All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Masney <bmasney@redhat.com>
To: Xuyang Dong <dongxuyang@eswincomputing.com>,
	Stephen Boyd <sboyd@kernel.org>
Cc: mturquette@baylibre.com, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, linux-clk@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	p.zabel@pengutronix.de, huangyifeng@eswincomputing.com,
	benoit.monin@bootlin.com, ningyu@eswincomputing.com,
	linmin@eswincomputing.com, pinkesh.vaghela@einfochips.com
Subject: Re: Re: Re: [PATCH v3 2/3] clk: eswin: Add eic7700 HSP clock driver
Date: Tue, 28 Apr 2026 09:39:10 -0400	[thread overview]
Message-ID: <afC4fqX_6eeE97mB@redhat.com> (raw)
In-Reply-To: <7a76d8cb.5bab.19dd3645d4e.Coremail.dongxuyang@eswincomputing.com>

Hi Stephen,

On Tue, Apr 28, 2026 at 05:21:03PM +0800, Xuyang Dong wrote:
> > Quoting Brian Masney (2026-04-24 04:15:46)
> > > On Fri, Apr 24, 2026 at 6:45 AM Xuyang Dong
> > > <dongxuyang@eswincomputing.com> wrote:
> > > > Thanks for the feedback. I did some research based on your comments.
> > > >
> > > > lock_ctx is a local variable declared inside the function body. It is not
> > > > in scope at the attribute site. The attribute expands to
> > > > __attribute__((acquire_capability(lock_ctx->lock))), and since lock_ctx
> > > > doesn't exist at the declaration point, clang's analysis cannot resolve it
> > > > and silently drops the annotation. That's why you see no warnings from
> > > > make C=2 or -Wthread-safety.
> > > >
> > > > Why -Wthread-safety produces no output
> > > > Two reasons:
> > > >   1. The lock_ctx->lock expression is unresolvable at the attribute site,
> > > >   so clang drops the annotation silently — no acquire/release tracking,
> > > >   no warnings.
> > > >   2. Even if the expression were resolvable, spinlock_t in this driver is
> > > >   a plain pointer field (spinlock_t *lock) accessed through a void *
> > > >   callback — the analysis can't track lock state through that indirection.
> > > >
> > > > The closest correct expression would be:
> > > > __acquires(((struct eic7700_hsp_regmap_lock *)arg)->lock)
> > > > But that also won't work: arg is void *, and clang's thread-safety
> > > > analysis is type-based. It can't trace through a void pointer cast to
> > > > determine which spinlock_t instance is being acquired. The analysis
> > > > would still silently ignore it.
> > > >
> > > > For void * regmap callbacks, there is no clean way to make __acquires()
> > > > work, because the lock is always hidden behind the opaque pointer.
> > > > The annotations should be dropped.
> > > >
> > > > Based on the above analysis, I suggest removing the annotations entirely.
> > > > However, I'd like to hear your thoughts on this approach.
> > > 
> > > I agree to remove the annotations. Before you post a new version,
> > > let's let this series sit out on the list for a week or two, and see
> > > if anyone else replies with the proper way to do this.
> > > 
> > 
> > Why not use a regmap instead? That would enforce locking on registers
> > and then you use the right regmap APIs to update the register under the
> > lock (like regmap_update_bits() or something).
> 
> Hi Stephen,
> 
> The common gate API, the HSP private API, and the reset driver all access 
> the same register space.
> Therefore, they need to be protected by the same data->lock.

To add to Xuyang's response: regmap is already used by this driver.
These annotations are for the lock and unlock ops on the regmap.

Brian


  reply	other threads:[~2026-04-28 13:39 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-23  9:09 [PATCH v3 0/3] Add driver support for ESWIN EIC7700 HSP clock and reset generator Xuyang Dong
2026-04-23  9:10 ` [PATCH v3 1/3] dt-bindings: clock: Add ESWIN eic7700 " dongxuyang
2026-04-23  9:11 ` [PATCH v3 2/3] clk: eswin: Add eic7700 HSP clock driver dongxuyang
2026-04-23 15:37   ` Brian Masney
2026-04-24 10:44     ` Xuyang Dong
2026-04-24 11:15       ` Brian Masney
2026-04-28  0:21         ` Stephen Boyd
2026-04-28  9:21           ` Xuyang Dong
2026-04-28 13:39             ` Brian Masney [this message]
2026-04-29  1:51             ` Stephen Boyd
2026-04-29  9:38               ` Xuyang Dong
2026-04-29 13:54                 ` Brian Masney
2026-04-30  5:58                   ` Xuyang Dong
2026-04-30 22:51                     ` Brian Masney
2026-05-09  2:53                       ` Xuyang Dong
2026-04-23 15:51   ` Benoît Monin
2026-04-23  9:12 ` [PATCH v3 3/3] reset: eswin: Add eic7700 HSP reset driver dongxuyang
2026-04-23 16:09   ` 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=afC4fqX_6eeE97mB@redhat.com \
    --to=bmasney@redhat.com \
    --cc=benoit.monin@bootlin.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dongxuyang@eswincomputing.com \
    --cc=huangyifeng@eswincomputing.com \
    --cc=krzk+dt@kernel.org \
    --cc=linmin@eswincomputing.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=ningyu@eswincomputing.com \
    --cc=p.zabel@pengutronix.de \
    --cc=pinkesh.vaghela@einfochips.com \
    --cc=robh@kernel.org \
    --cc=sboyd@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.