All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sanchayan Maity <maitysanchayan@gmail.com>
To: Andy Duan <fugang.duan@nxp.com>
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Christian Eggers <ceggers@arri.de>,
	Jonathan Cameron <jic23@kernel.org>,
	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" <linux-iio@vger.kernel.org>,
	Stefan Agner <stefan@agner.ch>
Subject: Re: [PATCH 1/2] iio: hrtimer-trigger: Mark hrtimer to expire in hard interrupt context
Date: Thu, 24 Sep 2020 12:11:32 +0530	[thread overview]
Message-ID: <20200924064132.GA22507@core-precision> (raw)
In-Reply-To: <AM8PR04MB731594F51648126A764EA066FF3B0@AM8PR04MB7315.eurprd04.prod.outlook.com>

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?

  reply	other threads:[~2020-09-24  6:41 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 [this message]
2020-09-24  8:54                             ` Stefan Agner
2020-09-25 12:42                               ` Jonathan Cameron
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=20200924064132.GA22507@core-precision \
    --to=maitysanchayan@gmail.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=bigeasy@linutronix.de \
    --cc=ceggers@arri.de \
    --cc=fugang.duan@nxp.com \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.