From: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: Marcelo Schmitt <marcelo.schmitt@analog.com>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux@analog.com,
nuno.sa@analog.com, dlechner@baylibre.com, andy@kernel.org,
Michael.Hennerich@analog.com, robh@kernel.org,
krzk+dt@kernel.org, conor+dt@kernel.org, corbet@lwn.net,
skhan@linuxfoundation.org
Subject: Re: [PATCH v5 06/15] iio: adc: ad4134: Protect conventional device access from debug accesses
Date: Mon, 19 Oct 2026 18:04:28 -0300 [thread overview]
Message-ID: <ataF3Bpop9cAYuXW@debian-BULLSEYE-live-builder-AMD64> (raw)
In-Reply-To: <20261017194707.48f6f242@jic23-hlaptop>
On 10/17, Jonathan Cameron wrote:
> On Fri, 16 Oct 2026 22:58:05 -0300
> Marcelo Schmitt <marcelo.schmitt@analog.com> wrote:
>
> > Require debug access to acquire device synchronization locks before
> > allowing any transfer from the debug interface so to avoid disrupting
> > operations issued from usual (non-debug) interfaces.
>
> These needs more. What sort of disruption are we talking?
>
> A deliberate write to change state that breaks normal operation
> is a debug mess up that we don't guard against, but if a read
> is enough to break things, or there is an inherent disruption
> of other operations by using the bus at all then state that.
A read is enough to break any ongoing buffered read because register reads will
cause the bus configuration to change to a state that invalidates any sample read
that happens afterwards.
>
> What isn't regmap locking covering?
regmap doens't cover IIO device direct/buffered modes.
>
> If this is all about the mux stuff and backend usage,
> then move it to nearer that in the series and refer to that.
We also need the mux usage to be synchronized which is why debugfs_reg_access
now also locks on device state sync_lock.
In practice, because every device access will select then deselect the mux state,
we are not able to have two operations going on simultaneously (not even two
register read can run concurrently due to the needed mux state care).
On v3, there was a dedicated mutex for mux access synchronization. In an atempt
to make things more simple, that second mutex was removed and sync_lock is now
also utilized to prevent multiple threads from changing the mux state simultaneously.
It shall work properly as long as any device access first
claims IIO direct + get sync_lock or claims IIO buffered mode.
Is it okay to have it like that?
>
> Jonathan
>
> >
> > Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
> > ---
> > New patch in v5.
> >
> > I'm not sure about this one and have no strong opinion about it.
> > Providing it according to suggestion from Nuno.
> > https://lore.kernel.org/linux-iio/179199692826.658576.4841754843069240356.b4-review@b4/
> > From previous discussions I guess this patch might not be welcome.
> > https://lore.kernel.org/linux-iio/20250421142359.11fb483f@jic23-huawei/
> > In that case, completely fine with it being dropped.
> >
> > drivers/iio/adc/ad4134.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/drivers/iio/adc/ad4134.c b/drivers/iio/adc/ad4134.c
> > index dc4d801490db..42a1272c2894 100644
> > --- a/drivers/iio/adc/ad4134.c
> > +++ b/drivers/iio/adc/ad4134.c
> > @@ -302,6 +302,12 @@ static int ad4134_debugfs_reg_access(struct iio_dev *indio_dev,
> > {
> > struct ad4134_state *st = iio_priv(indio_dev);
> >
> > + IIO_DEV_ACQUIRE_DIRECT_MODE(indio_dev, claim);
> > + if (IIO_DEV_ACQUIRE_FAILED(claim))
> > + return -EBUSY;
> > +
> > + guard(mutex)(&st->sync_lock);
> > +
> > if (readval)
> > return regmap_read(st->regmap, reg, readval);
> >
>
next prev parent reply other threads:[~2026-10-19 21:03 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-17 1:56 [PATCH v5 00/15] iio: adc: ad4134: Enable greater sample rate data capture Marcelo Schmitt
2026-10-17 1:56 ` [PATCH v5 01/15] iio: adc: ad4134: Adjust register map range Marcelo Schmitt
2026-10-17 1:56 ` [PATCH v5 02/15] iio: adc: ad4134: Sign extend sample data Marcelo Schmitt
2026-10-17 1:57 ` [PATCH v5 03/15] iio: adc: ad4134: Apply reset recovery wait time Marcelo Schmitt
2026-10-17 5:55 ` Joshua Crofts
2026-10-17 19:13 ` Jonathan Cameron
2026-10-19 20:26 ` Marcelo Schmitt
2026-10-17 1:57 ` [PATCH v5 04/15] iio: adc: ad4134: Update include list to comply with IWYU principles Marcelo Schmitt
2026-10-17 1:57 ` [PATCH v5 05/15] iio: adc: ad4134: Serialize single-read operations Marcelo Schmitt
2026-10-17 18:39 ` Jonathan Cameron
2026-10-19 20:22 ` Marcelo Schmitt
2026-10-17 1:58 ` [PATCH v5 06/15] iio: adc: ad4134: Protect conventional device access from debug accesses Marcelo Schmitt
2026-10-17 18:47 ` Jonathan Cameron
2026-10-19 21:04 ` Marcelo Schmitt [this message]
2026-10-17 1:58 ` [PATCH v5 07/15] iio: adc: ad4134: Run shorter transfers when CRC is disabled Marcelo Schmitt
2026-10-17 1:58 ` [PATCH v5 08/15] iio: adc: ad4134: Add support for digital filter type selection Marcelo Schmitt
2026-10-17 1:59 ` [PATCH v5 09/15] iio: adc: ad4134: Support buffered data read Marcelo Schmitt
2026-10-17 5:59 ` Joshua Crofts
2026-10-17 1:59 ` [PATCH v5 10/15] dt-bindings: iio: adc: adi,ad4134: Document SPI connection mode Marcelo Schmitt
2026-10-17 1:59 ` [PATCH v5 11/15] dt-bindings: iio: adc: adi,ad4134: Document external multiplexer usage Marcelo Schmitt
2026-10-17 1:59 ` [PATCH v5 12/15] iio: adc: ad4134: Support SPI 4-wire mode Marcelo Schmitt
2026-10-17 19:03 ` Jonathan Cameron
2026-10-17 2:00 ` [PATCH v5 13/15] dt-bindings: iio: adc: adi,ad4134: Document PWM usage Marcelo Schmitt
2026-10-17 2:00 ` [PATCH v5 14/15] iio: adc: ad4134: Support high-speed data capture Marcelo Schmitt
2026-10-17 19:10 ` Jonathan Cameron
2026-10-17 2:00 ` [PATCH v5 15/15] Docs: iio: Add AD4134 Marcelo Schmitt
2026-10-17 19:17 ` [PATCH v5 00/15] iio: adc: ad4134: Enable greater sample rate data capture 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=ataF3Bpop9cAYuXW@debian-BULLSEYE-live-builder-AMD64 \
--to=marcelo.schmitt1@gmail.com \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@analog.com \
--cc=marcelo.schmitt@analog.com \
--cc=nuno.sa@analog.com \
--cc=robh@kernel.org \
--cc=skhan@linuxfoundation.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
all inboxes | Powered by JetHome®