From: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
To: Rob Herring <robh@kernel.org>
Cc: hanwoo Choi <cw00.choi@samsung.com>,
Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
MyungJoo Ham <myungjoo.ham@samsung.com>,
Hans de Goede <hdegoede@redhat.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 0/5] Add devm helper for work-queue initialization
Date: Wed, 19 May 2021 08:33:58 +0300 [thread overview]
Message-ID: <278ddbfcb0f5a9326eefdc22b35f2a476c482caa.camel@fi.rohmeurope.com> (raw)
In-Reply-To: <20210519003938.GA1649581@robh.at.kernel.org>
On Tue, 2021-05-18 at 19:39 -0500, Rob Herring wrote:
> On Tue, May 18, 2021 at 03:31:37PM +0300, Matti Vaittinen wrote:
> > This series adds new devm_work_autocancel() helper.
> >
> > Many drivers which use work-queues must ensure the work is not
> > queued when
> > driver is detached. Often this is done by ensuring new work is not
> > added and
> > then calling cancel_work_sync() at remove(). In many cases this
> > also requires
> > cleanup at probe error path - which is easy to forget (or get
> > wrong).
> >
> > Also the "by ensuring new work is not added" has a gotcha.
> >
> > It is not strange to see devm managed IRQs scheduling work.
> > Mixing this with manual wq clean-up is hard to do correctly because
> > the
> > devm is likely to free the IRQ only after the remove() is ran. So
> > manual
> > wq cancellation and devm-based IRQ management do not mix well -
> > there is
> > a short(?) time-window after the wq clean-up when IRQs are still
> > not
> > freed and may schedule new work.
> >
> > When both WQs and IRQs are managed by devm things are likely to
> > just
> > work. WQs should be initialized before IRQs (when IRQs need to
> > schedule
> > work) and devm unwinds things in "FILO" order.
>
> Wouldn't it be better to convert drivers to use threaded IRQ
> handlers?
Morning Rob,
I think for example the extcon drivers were using threaded IRQs. In
general, there may be legitimate use-cases for having threaded IRQs but
still offloading some work to WQ. I guess that for example the
IRQF_ONESHOT usage could be such, right?
Best Regards
Matti Vaittinen
next prev parent reply other threads:[~2021-05-19 5:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-18 12:31 Matti Vaittinen
2021-05-18 12:31 ` [PATCH v2 1/5] devm-helpers: Add resource managed version of work init Matti Vaittinen
2021-05-18 12:32 ` [PATCH v2 2/5] extcon: extcon-max14577: Fix potential work-queue cancellation race Matti Vaittinen
2021-05-18 12:32 ` [PATCH v2 3/5] extcon: extcon-max77693.c: " Matti Vaittinen
2021-05-18 12:32 ` [PATCH v2 4/5] extcon: extcon-max8997: Fix IRQ freeing at error path Matti Vaittinen
2021-05-25 15:58 ` Krzysztof Kozlowski
2021-05-18 12:33 ` [PATCH v2 5/5] extcon: extcon-max8997: Simplify driver using devm Matti Vaittinen
2021-05-25 15:59 ` Krzysztof Kozlowski
2021-05-19 0:39 ` [PATCH v2 0/5] Add devm helper for work-queue initialization Rob Herring
2021-05-19 5:33 ` Matti Vaittinen [this message]
2021-05-27 11:07 ` Hans de Goede
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=278ddbfcb0f5a9326eefdc22b35f2a476c482caa.camel@fi.rohmeurope.com \
--to=matti.vaittinen@fi.rohmeurope.com \
--cc=b.zolnierkie@samsung.com \
--cc=cw00.choi@samsung.com \
--cc=hdegoede@redhat.com \
--cc=krzysztof.kozlowski@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=myungjoo.ham@samsung.com \
--cc=robh@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
all inboxes | Powered by JetHome®