Linux-IIO Archive on lore.kernel.org
 help / color / Atom feed
From: Alexandru Ardelean <ardeleanalex@gmail.com>
To: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Alexandru Ardelean <alexandru.ardelean@analog.com>,
	linux-iio <linux-iio@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Jonathan Cameron <jic23@kernel.org>,
	kgene@kernel.org, Sergiu Cuciurean <sergiu.cuciurean@analog.com>
Subject: Re: [PATCH] iio: adc: exynos_adc: Replace indio_dev->mlock with own device lock
Date: Thu, 27 Aug 2020 11:53:44 +0300
Message-ID: <CA+U=Dsoo6YABe5ODLp+eFNPGFDjk5ZeQEceGkqjxXcVEhLWubw@mail.gmail.com> (raw)
In-Reply-To: <20200827065625.GB17964@kozik-lap>

On Thu, Aug 27, 2020 at 9:57 AM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> On Wed, Aug 26, 2020 at 04:22:03PM +0300, Alexandru Ardelean wrote:
> > From: Sergiu Cuciurean <sergiu.cuciurean@analog.com>
> >
> > As part of the general cleanup of indio_dev->mlock, this change replaces
> > it with a local lock, to protect potential concurrent access to the
> > completion callback during a conversion.
>
> I don't know the bigger picture (and no links here for general cleanup)
> but I assume it is part of wider work and that mlock is unwanted. In
> such case:
>
> Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
>
> If it is part of some bigger work, please put a link to lore.kernel.org
> under separators ---, so everyone can get the context.

Will keep that in mind.
I am not sure if there is a lore.kernel.org link that's easy to find
for a discussion on this topic, maybe I can describe it here and use
the link [from this later].

This was something that popped up during reviews we got from Jonathan
[or others], saying "please don't use indio_dev->mlock, that is an IIO
framework lock, and an IIO driver should not use it".
Reasons include [and some may be repeated a bit]:
- this could cause a deadlock if the IIO framework holds this lock and
an IIO driver also tries to get a hold of this lock
- similar to the previous point, this mlock is taken by
iio_device_claim_direct_mode() and released by
iio_device_release_direct_mode() ; which means that mlock aims to
become more of an IIO framework lock, than a general usage lock;
- this wasn't policed/reviewed intensely in the older driver [a few
years ago], but has become a point in recent reviews;
- if we want to develop/enhance the IIO framework, some elements like
this need to be taken care of, as more drivers get added and more
complexity gets added;
- there is an element of fairness [obviously], where someone writing a
new IIO driver, takes an older one as example, and gets hit on the
review; the person feels they did a good job in mimicking the old
driver; their feeling is correct; the IIO framework should provide
good references and/or cleanup existing drivers;
- same as the previous point, we don't want to keep telling people
writing new IIO drivers [and starting out with IIO] to "not use mlock
[because it was copied from an old driver]"; it's more/needless review
work


>
>
> Best regards,
> Krzysztof
>
> >
> > Signed-off-by: Sergiu Cuciurean <sergiu.cuciurean@analog.com>
> > Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
> > ---
> >  drivers/iio/adc/exynos_adc.c | 12 ++++++++----
> >  1 file changed, 8 insertions(+), 4 deletions(-)
> >

  reply index

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-26 13:22 Alexandru Ardelean
2020-08-27  6:56 ` Krzysztof Kozlowski
2020-08-27  8:53   ` Alexandru Ardelean [this message]
2020-08-29 15:33     ` Jonathan Cameron
2020-08-29 15:35 ` Jonathan Cameron
2020-09-16  9:31 ` [PATCH v2] " Alexandru Ardelean
2020-09-19 15:19   ` 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='CA+U=Dsoo6YABe5ODLp+eFNPGFDjk5ZeQEceGkqjxXcVEhLWubw@mail.gmail.com' \
    --to=ardeleanalex@gmail.com \
    --cc=alexandru.ardelean@analog.com \
    --cc=jic23@kernel.org \
    --cc=kgene@kernel.org \
    --cc=krzk@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sergiu.cuciurean@analog.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

Linux-IIO Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-iio/0 linux-iio/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-iio linux-iio/ https://lore.kernel.org/linux-iio \
		linux-iio@vger.kernel.org
	public-inbox-index linux-iio

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-iio


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git