From: Jonathan Cameron <jic23@kernel.org>
To: Stefan Agner <stefan@agner.ch>
Cc: Sanchayan Maity <maitysanchayan@gmail.com>,
Andy Duan <fugang.duan@nxp.com>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Christian Eggers <ceggers@arri.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Thomas Gleixner <tglx@linutronix.de>,
Hartmut Knaack <knaack.h@gmx.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
linux-iio@vger.kernel.org
Subject: Re: [PATCH 1/2] iio: hrtimer-trigger: Mark hrtimer to expire in hard interrupt context
Date: Fri, 25 Sep 2020 13:42:02 +0100 [thread overview]
Message-ID: <20200925134202.76ecf6cb@archlinux> (raw)
In-Reply-To: <0861e8406165c4faf6ab0443cc05ffc0@agner.ch>
On Thu, 24 Sep 2020 10:54:39 +0200
Stefan Agner <stefan@agner.ch> wrote:
> On 2020-09-24 08:41, Sanchayan Maity wrote:
> > On 20-09-22 02:51:11, Andy Duan wrote:
> >> From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
> >> > On Mon, 21 Sep 2020 14:27:28 +0200
> >> > Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:
> >> >
> >> > > On 2020-09-21 10:57:03 [+0100], Jonathan Cameron wrote:
> >> > > > So looking at this the other way, are there any significant risks
> >> > > > associated with this change? If not I'm tempted to queue them up
> >> > > > and we have the rcX time to fix anything we've missed (just like
> >> > > > every other patch!)
> >> > >
> >> > > I've been told that it only performs IRQ-thread wake-ups in hard-IRQ
> >> > > context. This is fine then.
> >> > >
> >> > drivers/iio/adc/vf610-adc.c
> >> >
> >> > However, there looks to be a lot more wrong in there than just this.
> >> > So normally for a device with a data ready signal like this we would hook up as
> >> > follows.
> >> >
> >> > Data ready #1 -> IRQ chip (trigger) -> Read sensor #1 +
> >> > iio_trigger_notify_done()
> >> > -> Read sensor #2 +
> >> > iio_trigger_notify_done()
> >> >
> >> > (note that the read etc is normally in a thread - all we do in interrupt context is
> >> > usually to grab a timestamp if that makes sense for a given sensor).
> >> >
> >> > This driver does both of.
> >> > Data ready -> Read data from itself and call iio_trigger_notify_done() IRQ chip
> >> > for a different trigger -> Take a timestamp and never call
> >> > iio_trigger_notify_done()
> >> > or read any data for that matter.
> >> >
> >> > Which won't do what we want at all.
> >> >
> >> > Andy, if I have a go at fixing this are you able to test the result?
> >> > I think the simplest is probably to introduce a trigger to tie the two halves
> >> > together.
> >> > We can set it as the default trigger so things should keep on working for existing
> >> > users.
> >> >
> >> > For more general case, we should probably have two functions.
> >> >
> >> > iio_trigger_notify_done() which is only called from places we can sleep.
> >> > iio_trigger_notify_done_no_action() which only decrements the counter (or
> >> > given this is only called inside industrialio-trigger.c could just replace with
> >> > atomic_dec(&trig->use_count)).
> >> >
> >>
> >> Sanchayan, can you help to verify the fixes that Jonathan will send out ?
> >>
> >
> > Sorry for the delay in reply. Unfortunately can't as I do not access to the
> > hardware having left Toradex.
> >
> > CCed Stefan Agner who might be able to help.
> >
> > @Stefan
> >
> > Hello Stefan :), may be you can help here?
>
> Hi all,
>
> I do have access to the hardware and can run a test if required. I guess
> I would just need to test if ADC sampling still work with something like
> tools/iio/iio_generic_buffer.c?
Yup. I haven't written the fix yet though. Will make sure to cc you!
Thanks,
Jonathan
>
> --
> Stefan
next prev parent reply other threads:[~2020-09-25 12:42 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-13 7:53 [PATCH 1/2] iio: hrtimer-trigger: Mark hrtimer to expire in hard interrupt context Lars-Peter Clausen
2020-08-13 7:53 ` [PATCH 2/2] iio: sysfs-trigger: Mark irq_work to expire in hardirq context Lars-Peter Clausen
2020-08-13 9:11 ` [PATCH 1/2] iio: hrtimer-trigger: Mark hrtimer to expire in hard interrupt context Sebastian Andrzej Siewior
2020-08-13 9:46 ` Lars-Peter Clausen
2020-08-13 11:27 ` Sebastian Andrzej Siewior
2020-08-13 12:19 ` Thomas Gleixner
2020-08-13 14:55 ` Jonathan Cameron
2020-08-14 5:24 ` Lars-Peter Clausen
2020-08-14 10:30 ` Jonathan Cameron
2020-09-20 18:15 ` Jonathan Cameron
2020-09-21 7:17 ` Christian Eggers
2020-09-21 9:57 ` Jonathan Cameron
2020-09-21 12:27 ` Sebastian Andrzej Siewior
2020-09-21 13:32 ` Jonathan Cameron
2020-09-22 2:51 ` Andy Duan
2020-09-24 6:41 ` Sanchayan Maity
2020-09-24 8:54 ` Stefan Agner
2020-09-25 12:42 ` Jonathan Cameron [this message]
2020-10-02 14:10 ` Christian Eggers
2020-10-10 13:23 ` 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=20200925134202.76ecf6cb@archlinux \
--to=jic23@kernel.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=bigeasy@linutronix.de \
--cc=ceggers@arri.de \
--cc=fugang.duan@nxp.com \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=maitysanchayan@gmail.com \
--cc=pmeerw@pmeerw.net \
--cc=stefan@agner.ch \
--cc=tglx@linutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).