lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c9c9ed1c-116d-4deb-b54e-6e464c342f23@redhat.com>
Date: Wed, 3 Jul 2024 14:06:12 -0400
From: Waiman Long <longman@...hat.com>
To: Lai Jiangshan <jiangshanlai@...il.com>, linux-kernel@...r.kernel.org
Cc: Lai Jiangshan <jiangshan.ljs@...group.com>, Tejun Heo <tj@...nel.org>
Subject: Re: [PATCH] workqueue: Always queue work items to the newest PWQ for
 order workqueues


On 7/3/24 05:27, Lai Jiangshan wrote:
> From: Lai Jiangshan <jiangshan.ljs@...group.com>
>
> To ensure non-reentrancy, __queue_work() attempts to enqueue a work
> item to the pool of the currently executing worker. This is not only
> unnecessary for an ordered workqueue, where order inherently suggests
> non-reentrancy, but it could also disrupt the sequence if the item is
> not enqueued on the newest PWQ.
>
> Just queue it to the newest PWQ and let order management guarantees
> non-reentrancy.
>
> Fixes: 4c065dbce1e8("workqueue: Enable unbound cpumask update on ordered workqueues")
> Signed-off-by: Lai Jiangshan <jiangshan.ljs@...group.com>
> ---
>   kernel/workqueue.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> index c910f3c28664..d4fecd23ea44 100644
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
> @@ -2271,9 +2271,13 @@ static void __queue_work(int cpu, struct workqueue_struct *wq,
>   	 * If @work was previously on a different pool, it might still be
>   	 * running there, in which case the work needs to be queued on that
>   	 * pool to guarantee non-reentrancy.
> +	 *
> +	 * For ordered workqueue, work items must be queued on the newest pwq
> +	 * for accurate order management.  Guaranteed order also guarantees
> +	 * non-reentrancy.  See the comments above unplug_oldest_pwq().
>   	 */
>   	last_pool = get_work_pool(work);
> -	if (last_pool && last_pool != pool) {
> +	if (last_pool && last_pool != pool && !(wq->flags & __WQ_ORDERED)) {
>   		struct worker *worker;
>   
>   		raw_spin_lock(&last_pool->lock);

Thanks for the fix again.

Acked-by: Waiman Long <longman@...hat.com>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ