mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>,
	Matti Vaittinen <mazziesaccount@gmail.com>
Cc: Chanwoo Choi <cw00.choi@samsung.com>,
	Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	MyungJoo Ham <myungjoo.ham@samsung.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH RESEND v2 0/5] Add devm helper for work-queue initialization
Date: Wed, 9 Jun 2021 17:23:24 +0200	[thread overview]
Message-ID: <2ab1589e-a14b-3058-5582-ac5c304f7e80@redhat.com> (raw)
In-Reply-To: <cover.1623146580.git.matti.vaittinen@fi.rohmeurope.com>

Hi All,

On 6/8/21 12:09 PM, Matti Vaittinen wrote:
> This series adds new devm_work_autocancel() helper.
> 
> Note:
> "The beef" of this series is the new devm-helper. This means that
> normally it would be picked-up by Hans. In this case Hans asked if this
> series could be taken in extconn tree:
> https://lore.kernel.org/lkml/fbbfba71-bdcc-b78f-48be-d7c657adce61@redhat.com/

Yes, and given that most of the changes are in the extcon code I still
believe this is best.

Alternatively I can create an immutable branch with these 5 patches on
top of 5.13-rc1 and then send a pull-req to Chanwoo and MyongJoo.

Chanwoo and/or MyongJoo can you please let us know how you want to proceed
with this series?

Regards,

Hans



> 
> 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.
> 
> This series implements wq cancellation on top of devm and replaces
> the obvious cases where only thing remove call-back in a driver does is
> cancelling the work. There might be other cases where we could switch
> more than just work cancellation to use managed version and thus get rid
> of remove or mixed (manual and devm) resource management.
> 
> Changelog v2:
>   - rebased on v5.13-rc2
>   - split the extcon-max8997 change into two. First a simple,
>     back-portable fix for omitting IRQ freeing at error path, second
>     being the devm-simpification which does not need backporting.
> 
> ---
> 
> Matti Vaittinen (5):
>   devm-helpers: Add resource managed version of work init
>   extcon: extcon-max14577: Fix potential work-queue cancellation race
>   extcon: extcon-max77693.c: Fix potential work-queue cancellation race
>   extcon: extcon-max8997: Fix IRQ freeing at error path
>   extcon: extcon-max8997: Simplify driver using devm
> 
>  drivers/extcon/extcon-max14577.c | 16 ++++--------
>  drivers/extcon/extcon-max77693.c | 17 ++++--------
>  drivers/extcon/extcon-max8997.c  | 45 +++++++++++---------------------
>  include/linux/devm-helpers.h     | 25 ++++++++++++++++++
>  4 files changed, 50 insertions(+), 53 deletions(-)
> 
> 
> base-commit: d07f6ca923ea0927a1024dfccafc5b53b61cfecc
> 


  parent reply	other threads:[~2021-06-09 15:23 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-08 10:09 Matti Vaittinen
2021-06-08 10:09 ` [PATCH RESEND v2 1/5] devm-helpers: Add resource managed version of work init Matti Vaittinen
2021-06-08 10:09 ` [PATCH RESEND v2 2/5] extcon: extcon-max14577: Fix potential work-queue cancellation race Matti Vaittinen
2021-06-10  9:41   ` Chanwoo Choi
2021-06-08 10:10 ` [PATCH RESEND v2 3/5] extcon: extcon-max77693.c: " Matti Vaittinen
2021-06-10  9:43   ` Chanwoo Choi
2021-06-10  9:49     ` Hans de Goede
2021-06-11  9:04       ` Chanwoo Choi
2021-06-10  9:57     ` Matti Vaittinen
2021-06-10 22:14       ` Dmitry Torokhov
2021-06-11  7:16       ` Chanwoo Choi
2021-06-08 10:10 ` [PATCH RESEND v2 4/5] extcon: extcon-max8997: Fix IRQ freeing at error path Matti Vaittinen
2021-06-10  9:53   ` Chanwoo Choi
2021-06-08 10:10 ` [PATCH RESEND v2 5/5] extcon: extcon-max8997: Simplify driver using devm Matti Vaittinen
2021-06-10  9:57   ` Chanwoo Choi
2021-06-09 15:23 ` Hans de Goede [this message]
2021-06-10  1:02   ` [PATCH RESEND v2 0/5] Add devm helper for work-queue initialization Chanwoo Choi
2021-06-10  8:22     ` Vaittinen, Matti

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=2ab1589e-a14b-3058-5582-ac5c304f7e80@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=cw00.choi@samsung.com \
    --cc=krzysztof.kozlowski@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=matti.vaittinen@fi.rohmeurope.com \
    --cc=mazziesaccount@gmail.com \
    --cc=myungjoo.ham@samsung.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

all inboxes | Powered by JetHome®