public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: "Jérôme Pouiller" <jerome.pouiller@silabs.com>
To: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
	Kalle Valo <kvalo@kernel.org>
Cc: linux-wireless <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH] wfx: avoid flush_workqueue(system_highpri_wq) usage
Date: Mon, 02 May 2022 10:48:01 +0200	[thread overview]
Message-ID: <110321547.nniJfEyVGO@pc-42> (raw)
In-Reply-To: <87fsltd462.fsf@kernel.org>

On Sunday 1 May 2022 10:53:57 CEST Kalle Valo wrote:
> Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> writes:
> 
> > Flushing system-wide workqueues is dangerous and will be forbidden.
> > Replace system_highpri_wq with local wfx_wq.
> >
> > While we are at it, add missing spi_unregister_driver() call when
> > sdio_register_driver() failed.
> >
> > Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> 
> [...]
> 
> > @@ -473,10 +475,18 @@ static int __init wfx_core_init(void)
> >  {
> >       int ret = 0;
> >
> > +     wfx_wq = alloc_workqueue("wfx_wq", WQ_HIGHPRI, 0);
> > +     if (!wfx_wq)
> > +             return -ENOMEM;
> >       if (IS_ENABLED(CONFIG_SPI))
> >               ret = spi_register_driver(&wfx_spi_driver);
> >       if (IS_ENABLED(CONFIG_MMC) && !ret)
> >               ret = sdio_register_driver(&wfx_sdio_driver);
> > +     if (ret) {
> > +             if (IS_ENABLED(CONFIG_SPI))
> > +                     spi_unregister_driver(&wfx_spi_driver);
> > +             destroy_workqueue(wfx_wq);
> > +     }
> >       return ret;
> >  }
> >  module_init(wfx_core_init);
> 
> So now the thread is created every time the module loaded, even if
> there's no device available. Also I'm not really a fan of global
> variables (wfx_wq). I would rather create a workqueue per device in
> wfx_probe() or use the workqueue provided by mac80211.
> 
> /**
>  * ieee80211_queue_work - add work onto the mac80211 workqueue
>  *
>  * Drivers and mac80211 use this to add work onto the mac80211 workqueue.
>  * This helper ensures drivers are not queueing work when they should not be.
>  *
>  * @hw: the hardware struct for the interface we are adding work for
>  * @work: the work we want to add onto the mac80211 workqueue
>  */
> void ieee80211_queue_work(struct ieee80211_hw *hw, struct work_struct *work);
> 

The last time I have checked if I could use this workqueue, I remember
it was not well suited for wfx (I don't remember why exactly). So I
believe we have to allocate a new workqueue.


-- 
Jérôme Pouiller



  parent reply	other threads:[~2022-05-02  8:48 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-25 11:23 [PATCH 00/10] staging: wfx: usual maintenance Jerome Pouiller
2022-02-25 11:23 ` [PATCH 01/10] staging: wfx: sta.o was linked twice Jerome Pouiller
2022-02-25 11:23 ` [PATCH 02/10] staging: wfx: fix struct alignment Jerome Pouiller
2022-02-25 11:23 ` [PATCH 03/10] staging: wfx: format comments on 100 columns Jerome Pouiller
2022-03-01  1:12   ` Joe Perches
2022-03-01 17:13     ` Jeff Johnson
2022-02-25 11:23 ` [PATCH 04/10] staging: wfx: format code " Jerome Pouiller
2022-02-25 11:24 ` [PATCH 05/10] staging: wfx: remove useless variable Jerome Pouiller
2022-02-25 11:24 ` [PATCH 06/10] staging: wfx: drop useless include Jerome Pouiller
2022-02-25 11:24 ` [PATCH 07/10] staging: wfx: remove duplicated code in wfx_cmd_send() Jerome Pouiller
2022-02-25 11:24 ` [PATCH 08/10] staging: wfx: prefer to wait for an event instead to sleep Jerome Pouiller
2022-02-25 11:24 ` [PATCH 09/10] staging: wfx: ensure HIF request has been sent before polling Jerome Pouiller
2022-04-12 13:11   ` Tetsuo Handa
2022-04-13 15:18     ` Jérôme Pouiller
2022-05-01  6:01       ` [PATCH] wfx: avoid flush_workqueue(system_highpri_wq) usage Tetsuo Handa
2022-05-01  8:53         ` Kalle Valo
2022-05-01 10:23           ` Tetsuo Handa
2022-05-02  6:25             ` Kalle Valo
2022-05-02  8:16               ` [PATCH v2] " Tetsuo Handa
2022-05-02  8:38                 ` Jérôme Pouiller
2022-05-02  9:02                   ` Kalle Valo
2022-05-04  5:29                 ` [v2] " Kalle Valo
2022-05-02  8:48           ` Jérôme Pouiller [this message]
2022-02-25 11:24 ` [PATCH 10/10] staging: wfx: flags for SPI IRQ were ignored Jerome Pouiller

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=110321547.nniJfEyVGO@pc-42 \
    --to=jerome.pouiller@silabs.com \
    --cc=kvalo@kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    /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