From: Jonathan Cameron <jic23@kernel.org>
To: Mathieu Othacehe <m.othacehe@gmail.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald <pmeerw@pmeerw.net>,
linux-iio <linux-iio@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 4/4] iio: vcnl4000: Add buffer support for VCNL4010/20.
Date: Sat, 25 Apr 2020 17:09:12 +0100 [thread overview]
Message-ID: <20200425170912.17c3435a@archlinux> (raw)
In-Reply-To: <87tv1cos2q.fsf@gmail.com>
On Wed, 22 Apr 2020 10:14:21 +0200
Mathieu Othacehe <m.othacehe@gmail.com> wrote:
> >> +static int vcnl4010_buffer_predisable(struct iio_dev *indio_dev)
> >> +{
> >> + struct vcnl4000_data *data = iio_priv(indio_dev);
> >> + int ret, ret_disable;
> >> +
> >> + ret = i2c_smbus_write_byte_data(data->client, VCNL4010_INT_CTRL, 0);
> >> + if (ret < 0)
> >> + goto end;
> >> +
> >> + ret = i2c_smbus_write_byte_data(data->client, VCNL4000_COMMAND, 0);
> >> +
> >> +end:
> >
> >> + ret_disable = iio_triggered_buffer_predisable(indio_dev);
> >> + if (ret == 0)
> >> + ret = ret_disable;
> >
> > What is this?
> >
> > Can't you rather call IIO API first, and then try to handle the rest?
>
> Well, iio_triggered_buffer_predisable will call free_irq which requires
> that the interruption source is disabled, hence this strange pattern.
>
> However, this may be some misunderstanding from me, but I noticed
> something strange here. In a configuration with one CPU and
> CONFIG_PREEMPT disabled, I have kernel lockups when disabling the
> buffer.
>
> This is because free_irq calls synchronize_irq that will wait for any
> IRQ handler to be over. If the kthread handling the interruption is
> still running, it has no chances to terminate, and synchronize_irq waits
> forever. So maybe I'm missing something.
That is indeed worrying. The synchronize_irq is documented as
sleeping if we have a threaded interrupt. From a quick look I'd have
expected the wait in there to result in the interrupt thread being able
to complete whether or not we had preemption enabled.
I wonder what I'm missing...
Jonathan
>
> Anyway, I'll send a v5 addressing your remarks.
>
> Thanks,
>
> Mathieu
next prev parent reply other threads:[~2020-04-25 16:09 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-21 7:55 [PATCH v4 0/4] iio: vcnl: Add interrupts support for VCNL4010/20 Mathieu Othacehe
2020-04-21 7:55 ` [PATCH v4 1/4] iio: vcnl4000: Factorize data reading and writing Mathieu Othacehe
2020-04-21 7:55 ` [PATCH v4 2/4] iio: vcnl4000: Add event support for VCNL4010/20 Mathieu Othacehe
2020-04-21 11:24 ` Andy Shevchenko
2020-04-22 8:02 ` Mathieu Othacehe
2020-04-22 8:25 ` Andy Shevchenko
2020-04-25 19:47 ` Jonathan Cameron
2020-04-21 7:55 ` [PATCH v4 3/4] iio: vcnl4000: Add sampling frequency " Mathieu Othacehe
2020-04-21 12:22 ` Andy Shevchenko
2020-04-25 15:52 ` Jonathan Cameron
2020-04-25 17:14 ` Andy Shevchenko
2020-04-25 19:49 ` Jonathan Cameron
2020-04-21 7:55 ` [PATCH v4 4/4] iio: vcnl4000: Add buffer " Mathieu Othacehe
2020-04-21 12:27 ` Andy Shevchenko
2020-04-22 8:14 ` Mathieu Othacehe
2020-04-25 16:09 ` Jonathan Cameron [this message]
2020-04-25 15:57 ` 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=20200425170912.17c3435a@archlinux \
--to=jic23@kernel.org \
--cc=andy.shevchenko@gmail.com \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m.othacehe@gmail.com \
--cc=pmeerw@pmeerw.net \
/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