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: Sun, 29 May 2022 01:29:32 -0300 [thread overview]
Message-ID: <YpL2rHUXd0vf8IML@geday> (raw)
In-Reply-To: <YpLLnx8/xpZIPMbi@geday>
On Sat, May 28, 2022 at 10:25:55PM -0300, Geraldo Nascimento wrote:
> On Sat, May 28, 2022 at 05:07:08PM -0300, Geraldo Nascimento wrote:
> > Greetings,
> >
>
> Hi, again,
>
And again, Hi!
Doing my due dilligence, it seems.
> > This is a one-character patch but very important as the kernel workqueue
> > __cancel_work_timer will cancel active work
It won't cancel important work, seems it's just a WARN_ON but it's very
annoying. My understanding was the NOT was needed to call __flush_work()
before kthreads are spawned. During early boot, as the comment says, before
workqueue_init() fires.
There's a bug report at https://gitlab.freedesktop.org/drm/amd/-/issues/1898
and Felix Kuehling is right that this bug is only triggered when you try
to use amdkfd ( and the Kconfigs that implies) without HSA_AMD_SVM
configured.
It makes sense to me that NOT operator is missing however, since in the warning
I was coming from _cancel_work_timer() to __flush_work(), something that
should not be done?
I would like very much to hear the opinion of the maintainers!
Thanks,
Geraldo Nascimento
>> 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);
next prev parent reply other threads:[~2022-05-29 4:29 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
2022-05-29 4:29 ` Geraldo Nascimento [this message]
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=YpL2rHUXd0vf8IML@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox