linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Nicolas Saenz Julienne <nsaenzju@redhat.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	linux-iio <linux-iio@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Matt Ranostay <matt.ranostay@konsulko.com>
Subject: Re: [PATCH] iio: chemical: atlas-sensor: Avoid using irq_work
Date: Thu, 24 Jun 2021 13:39:23 +0300	[thread overview]
Message-ID: <CAHp75VcG-0L+qG5JirWH21bnpVwRv_wfjM6Sfd2pJrq4-OqJ0Q@mail.gmail.com> (raw)
In-Reply-To: <20210624100046.1037159-1-nsaenzju@redhat.com>

On Thu, Jun 24, 2021 at 1:01 PM Nicolas Saenz Julienne
<nsaenzju@redhat.com> wrote:
>
> The atlas sensor driver currently registers a threaded IRQ handler whose
> sole responsibility is to trigger an irq_work which will in turn run
> iio_trigger_poll() in IRQ context.
>
> This seems overkill given the fact that there already was a opportunity

an opportunity

> to run iio_trigger_poll() in IRQ context in the top half of the IRQ
> handler. So make use of it, ultimately avoiding a context switch, an
> IPI, and reducing latency.

...

> @@ -474,7 +465,7 @@ static irqreturn_t atlas_interrupt_handler(int irq, void *private)
>         struct iio_dev *indio_dev = private;
>         struct atlas_data *data = iio_priv(indio_dev);
>
> -       irq_work_queue(&data->work);
> +       iio_trigger_poll(data->trig);

Have you considered dropping atlas_interrupt_trigger_ops() altogether?

>         return IRQ_HANDLED;

...

>         if (client->irq > 0) {
>                 /* interrupt pin toggles on new conversion */
>                 ret = devm_request_threaded_irq(&client->dev, client->irq,

> -                               NULL, atlas_interrupt_handler,
> +                               atlas_interrupt_handler, NULL,

So, you move it from threaded IRQ to be a hard IRQ handler (we have a
separate call for this).
Can you guarantee that handling of those events will be fast enough?

>                                 IRQF_TRIGGER_RISING |
>                                 IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
>                                 "atlas_irq",


-- 
With Best Regards,
Andy Shevchenko

  reply	other threads:[~2021-06-24 10:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-24 10:00 [PATCH] iio: chemical: atlas-sensor: Avoid using irq_work Nicolas Saenz Julienne
2021-06-24 10:39 ` Andy Shevchenko [this message]
2021-06-24 11:13   ` Nicolas Saenz Julienne
2021-09-26 15:33     ` 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=CAHp75VcG-0L+qG5JirWH21bnpVwRv_wfjM6Sfd2pJrq4-OqJ0Q@mail.gmail.com \
    --to=andy.shevchenko@gmail.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt.ranostay@konsulko.com \
    --cc=nsaenzju@redhat.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
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).