All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geraldo Nascimento <geraldogabriel@gmail.com>
To: Tejun Heo <tj@kernel.org>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] workqueue: missing NOT while checking if Workqueue is offline
Date: Sat, 28 May 2022 22:25:51 -0300	[thread overview]
Message-ID: <YpLLnx8/xpZIPMbi@geday> (raw)
In-Reply-To: <YpKA5Bdk1Cm6KgKU@geday>

On Sat, May 28, 2022 at 05:07:08PM -0300, Geraldo Nascimento wrote:
> Greetings,
> 

Hi, again,

> This is a one-character patch but very important as the kernel workqueue
> __cancel_work_timer will cancel active work without the NOT operator
> added.
> 
> During early boot wq_online is false so with the NOT added it will evaluate
> to true. Conversely, after boot is done, workqueue

I meant wq_online. After boot, wq_online will evaluate to true, current
code might as well have an if (true) there. I hurried up the patch
because if I'm right this is a major show stopper to drivers that make
use of cancel_work_timer(). I hit it through amdgpu in conjuction with amdkfd.

> is now true and we want
> it to evaluate to false because otherwise it will cancel important work.
> 
> Signed-off-by: Geraldo Nascimento <geraldogabriel@gmail.com>
> 
> --- workqueue.c	2022-05-28 16:54:12.024176123 -0300
> +++ workqueue.c	2022-05-28 16:54:37.698176135 -0300
> @@ -3158,7 +3158,7 @@ static bool __cancel_work_timer(struct w
>  	 * This allows canceling during early boot.  We know that @work
>  	 * isn't executing.
>  	 */
> -	if (wq_online)
> +	if (!wq_online)
>  		__flush_work(work, true);
>  
>  	clear_work_data(work);

  reply	other threads:[~2022-05-29  1:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-28 20:07 [PATCH] workqueue: missing NOT while checking if Workqueue is offline Geraldo Nascimento
2022-05-29  1:25 ` Geraldo Nascimento [this message]
2022-05-29  4:29   ` Geraldo Nascimento
2022-05-29  5:24     ` Tejun Heo
2022-05-29  5:53       ` Geraldo Nascimento
2022-05-29  6:14         ` Tejun Heo
2022-05-29  6:41           ` Geraldo Nascimento
2022-05-31  4:13           ` Geraldo Nascimento
2022-05-31 17:43             ` Tejun Heo

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=YpLLnx8/xpZIPMbi@geday \
    --to=geraldogabriel@gmail.com \
    --cc=jiangshanlai@gmail.com \
    --cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.