[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aa7a0e08edf6567db027058cd331dfae86f54e62.camel@sipsolutions.net>
Date: Thu, 11 May 2023 23:50:35 +0200
From: Johannes Berg <johannes@...solutions.net>
To: linux-kernel@...r.kernel.org
Cc: linux-wireless@...r.kernel.org, Tejun Heo <tj@...nel.org>,
Lai Jiangshan <jiangshanlai@...il.com>
Subject: Re: [RFC PATCH v2 2/3] wifi: cfg80211: add a workqueue with special
semantics
Now that I look at this more ...
> +static void cfg80211_wiphy_work(struct work_struct *work)
> +{
> + struct cfg80211_registered_device *rdev;
> +
> + rdev = container_of(work, struct cfg80211_registered_device, wiphy_work);
> +
> + spin_lock_irq(&rdev->wiphy_work_lock);
> + while (!list_empty(&rdev->wiphy_work_list)) {
> + struct wiphy_work *wk;
> +
> + wk = list_first_entry(&rdev->wiphy_work_list,
> + struct wiphy_work, entry);
> + list_del_init(&wk->entry);
> + spin_unlock_irq(&rdev->wiphy_work_lock);
> +
> + mutex_lock(&rdev->wiphy.mtx);
If I just change the locking here to take the wiphy.mtx before looking
at the list, which basically doesn't matter, then I don't even need
workqueue_pause() and all, nor do I even need a separate workqueue, just
schedule_work() will be good enough ... Just needs a _bit_ more work
when cancelling and here we should reschedule the work if the list isn't
empty after the first round, but overall that ends up far simpler.
So I think I'll drop the workqueue pause/resume the next time around,
FWIW.
johannes
Powered by blists - more mailing lists