From: Oleksij Rempel <o.rempel@pengutronix.de>
To: Jonathan Cameron <jic23@jic23.retrosnub.co.uk>
Cc: linux-iio@vger.kernel.org,
Jonathan Cameron <Jonathan.Cameron@huawei.com>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>
Subject: Re: [RFC PATCH] iio: trigger: Fix a scheduling whilst atomic issue seen on tsc2046
Date: Mon, 6 Dec 2021 09:32:53 +0100 [thread overview]
Message-ID: <20211206083253.GB6671@pengutronix.de> (raw)
In-Reply-To: <20211205173517.59d6d913@jic23-huawei>
On Sun, Dec 05, 2021 at 05:35:35PM +0000, Jonathan Cameron wrote:
> On Wed, 24 Nov 2021 09:48:22 +0100
> Oleksij Rempel <o.rempel@pengutronix.de> wrote:
>
> > On Sun, Oct 17, 2021 at 06:22:09PM +0100, Jonathan Cameron wrote:
> > > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > >
> > > IIO triggers are software IRQ chips that split an incoming IRQ into
> > > separate IRQs routed to all devices using the trigger.
> > > When all consumers are done then a trigger callback reenable() is
> > > called. There are a few circumstances under which this can happen
> > > in atomic context.
> > >
> > > 1) A single user of the trigger that calls the iio_trigger_done()
> > > function from interrupt context.
> > > 2) A race between disconnecting the last device from a trigger and
> > > the trigger itself sucessfully being disabled.
> > >
> > > To avoid a resulting scheduling whilst atomic, close this corner
> > > by using schedule_work() to ensure the reenable is not done in atomic
> > > context.
> > >
> > > Note that drivers must be careful to manage the interaction of
> > > set_state() and reenable() callbacks to ensure appropriate reference
> > > counting if they are relying on the same hardware controls.
> > >
> > > Completely untested beyond building. Given it is Sunday evening
> > > very high chance of it being entirely wrong. The potential race
> > > conditions around this were giving me a headache, but I think this
> > > is at least a step in the right direction and should work for Oleksij's
> > > case.
> > >
> > > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > > Cc: Oleksij Rempel <o.rempel@pengutronix.de>
> > > Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
> > > Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> >
> > Tested-by: Oleksij Rempel <o.rempel@pengutronix.de>
> >
> > Works for me... Thank you! :)
>
> This patch is in the category that make me nervous, so I'm
> not going to rush it in as a fix. I've queued it up for the next
> merge window (and marked it for Stable). Hopefully any issues will
> shake out before it hits a release kernel.
>
> Applied to the togreg branch of iio.git and pushed out as testing.
Thx!
> Oleksij, what do you want to do about the work around you had?
> If you think it is a good cleanup, please resend so we get it to the
> top of people's inboxes!
I'm on vacation right now. Will do it early next year.
Regards,
Oleksij
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
prev parent reply other threads:[~2021-12-06 8:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-17 17:22 [RFC PATCH] iio: trigger: Fix a scheduling whilst atomic issue seen on tsc2046 Jonathan Cameron
2021-11-24 8:48 ` Oleksij Rempel
2021-12-05 17:35 ` Jonathan Cameron
2021-12-06 8:32 ` Oleksij Rempel [this message]
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=20211206083253.GB6671@pengutronix.de \
--to=o.rempel@pengutronix.de \
--cc=Jonathan.Cameron@huawei.com \
--cc=dmitry.torokhov@gmail.com \
--cc=jic23@jic23.retrosnub.co.uk \
--cc=kernel@pengutronix.de \
--cc=linux-iio@vger.kernel.org \
/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