Linux IIO development
 help / color / mirror / Atom feed
From: Rasmus Villemoes <ravi@prevas.dk>
To: Jonathan Cameron <jic23@kernel.org>
Cc: Peter Rosin <peda@axentia.se>,
	 linux-iio@vger.kernel.org,  Guenter Roeck <linux@roeck-us.net>
Subject: Re: [PATCH] iio: core: add separate lockdep class for info_exist_lock
Date: Mon, 22 Dec 2025 09:52:42 +0100	[thread overview]
Message-ID: <875x9yucdh.fsf@prevas.dk> (raw)
In-Reply-To: <20251221190645.5d5d1b32@jic23-huawei> (Jonathan Cameron's message of "Sun, 21 Dec 2025 19:06:45 +0000")

On Sun, Dec 21 2025, Jonathan Cameron <jic23@kernel.org> wrote:

> On Mon, 15 Dec 2025 14:33:38 +0100
> Peter Rosin <peda@axentia.se> wrote:
>
>> Hi!
>> 
>> 2025-12-15 at 14:17, Rasmus Villemoes wrote:
>> > When one iio device is a consumer of another, it is possible that
>> > the ->info_exist_lock of both ends up being taken when reading the
>> > value of the consumer device.
>> > 
>> > Since they currently belong to the same lockdep class (being
>> > initialized in a single location with mutex_init()), that results in a
>> > lockdep warning  
>> 
>> ...
>> 
>> > Just as the mlock_key already has its own lockdep class, add a
>> > lock_class_key for the info_exist mutex.
>> > 
>> > Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>  
>> 
>> Looks sane from here.
>> 
>> Reviewed-by: Peter Rosin <peda@axentia.se>
> Hi Rasmus,
>
> Thanks for doing this!
>> 
> We should probably merge this as a fix and get it backported.
> Whilst fairly rare anyone hits this it is also safe enough wrt
> to very low chance of causing any problems.
>
> Would be good to have an appropriate Fixes tag though.
> Ideally please reply to this thread with an appropriate one.
> If not I'll try and figure one out, but not today!

I tried to find one, but the problem goes way back, probably all the way
to either the introduction of info_exist_lock or the ability for one iio
channel to have a dependency on another, whichever came latest. And I'm
not really very familiar with the iio subsystem, so I couldn't find one
single commit to name.

Commit 2bc9cd66eb25d ("iio: Use per-device lockdep class for mlock")
which introduced the mlock_key referred to 67e17300dc1d76 ("iio:
potentiostat: add LMP91000 support"), but that feels more like a "this
driver is what first exposed the problem" and not really "this is where
the problem was introduced in the iio framework".

Wrt. backporting, it's probably worth mentioning c76ba4b264442 ("iio:
core: Replace lockdep_set_class() + mutex_init() by combined call") as a
prerequisite, as that is needed to make it cherry-pick cleanly.

Rasmus

  reply	other threads:[~2025-12-22  8:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-15 13:17 [PATCH] iio: core: add separate lockdep class for info_exist_lock Rasmus Villemoes
2025-12-15 13:33 ` Peter Rosin
2025-12-21 19:06   ` Jonathan Cameron
2025-12-22  8:52     ` Rasmus Villemoes [this message]
2025-12-27 15:07       ` Jonathan Cameron

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=875x9yucdh.fsf@prevas.dk \
    --to=ravi@prevas.dk \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=peda@axentia.se \
    /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