Linux wireless drivers development
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Tejun Heo <tj@kernel.org>
Cc: linux-wireless@vger.kernel.org,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	Benjamin Berg <benjamin@sipsolutions.net>
Subject: Re: wireless locking simplifications
Date: Mon, 08 May 2023 18:06:35 +0200	[thread overview]
Message-ID: <920f4c3a5dd5183628ad6c1196b5cc689c1ebeeb.camel@sipsolutions.net> (raw)
In-Reply-To: <ZFV6fTH_7umEa5H0@slm.duckdns.org>

On Fri, 2023-05-05 at 11:51 -1000, Tejun Heo wrote:
> Hello, Johannes.
> 
> On Fri, May 05, 2023 at 11:05:45PM +0200, Johannes Berg wrote:
> ...
> > The implementation of (2) is a bit ... awkward, @Tejun, @Lai, there's no
> > way to "pause" an ordered workqueue, is there? I came up with the below
> > patch, but it's a bit ugly and requires a lot of context switches. Just
> > flushing isn't enough since then some work might start and hang on
> > acquiring the lock.
> 
> There isn't currently but workqueue already does something similar for
> freezing by temporarily setting max_active to zero,
> 

Ah, nice. I had thought about it but a lot of places didn't like 0 so
wasn't sure whether or not it was allowed :)

> [snip]

> and then do set_max_active(wq, 0) followed by flush_workqueue(), it should
> be paused until max_active is restored to 1. It probably would be better to
> add a separate pause / resume interface which sets a per-wq flag which is
> read by pwq_adjust_max_active() tho. Anyways, it's not difficult to
> implement at all.

Ok cool, I'll take a look at it at some point. I think it would greatly
simplify the locking etc. in wifi because then we don't need to worry
about the cancel_work_sync() or flush_work() or flush_workqueue()
deadlocks.

Thanks!

johannes


  reply	other threads:[~2023-05-08 16:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-05 21:05 wireless locking simplifications Johannes Berg
2023-05-05 21:51 ` Tejun Heo
2023-05-08 16:06   ` Johannes Berg [this message]
2023-05-10 10:58   ` Johannes Berg
2023-05-10 11:11     ` Johannes Berg
2023-05-10 11:25 ` Johannes Berg

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=920f4c3a5dd5183628ad6c1196b5cc689c1ebeeb.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=benjamin@sipsolutions.net \
    --cc=jiangshanlai@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=tj@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