From: Tejun Heo <tj@kernel.org>
To: Waiman Long <longman@redhat.com>
Cc: zhuangel570 <zhuangel570@gmail.com>,
jiangshanlai@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] workqueue: Make sure that wq_unbound_cpumask is never empty
Date: Wed, 22 Nov 2023 06:03:10 -1000 [thread overview]
Message-ID: <ZV4mPoOvIgX9Um0z@slm.duckdns.org> (raw)
In-Reply-To: <8f469287-e29a-4473-a181-9013292ef62c@redhat.com>
Hello,
On Tue, Nov 21, 2023 at 05:08:29PM -0500, Waiman Long wrote:
> On 11/21/23 16:39, Tejun Heo wrote:
> > During boot, depending on how the housekeeping and workqueue.unbound_cpus
> > masks are set, wq_unbound_cpumask can end up empty. Since 8639ecebc9b1
> > ("workqueue: Implement non-strict affinity scope for unbound workqueues"),
> > this may end up feeding -1 as a CPU number into scheduler leading to oopses.
> >
> > BUG: unable to handle page fault for address: ffffffff8305e9c0
> > #PF: supervisor read access in kernel mode
> > #PF: error_code(0x0000) - not-present page
> > ...
> > Call Trace:
> > <TASK>
> > select_idle_sibling+0x79/0xaf0
> > select_task_rq_fair+0x1cb/0x7b0
> > try_to_wake_up+0x29c/0x5c0
> > wake_up_process+0x19/0x20
> > kick_pool+0x5e/0xb0
> > __queue_work+0x119/0x430
> > queue_work_on+0x29/0x30
> > ...
> >
> > An empty wq_unbound_cpumask is a clear misconfiguration and already
> > disallowed once system is booted up. Let's warn on and ignore
> > unbound_cpumask restrictions which lead to no unbound cpus. While at it,
> > also remove now unncessary empty check on wq_unbound_cpumask in
> > wq_select_unbound_cpu().
> >
> > Signed-off-by: Tejun Heo<tj@kernel.org>
> > Reported-by: Yong He<alexyonghe@tencent.com>
> > Link:http://lkml.kernel.org/r/20231120121623.119780-1-alexyonghe@tencent.com
> > Fixes: 8639ecebc9b1 ("workqueue: Implement non-strict affinity scope for unbound workqueues")
> > Cc:stable@vger.kernel.org # v6.6+
> > ---
> > Hello,
> >
> > Yong He, zhuangel570, can you please verify that this patch makes the oops
> > go away? Waiman, this touches code that you've recently worked on. AFAICS,
> > they shouldn't interact or cause conflicts. cc'ing just in case.
>
> It does conflict with commit fe28f631fa94 ("workqueue: Add
> workqueue_unbound_exclude_cpumask() to exclude CPUs from
> wq_unbound_cpumask") as it has the following hunk:
>
> @@ -6534,11 +6606,14 @@ void __init workqueue_init_early(void)
> BUILD_BUG_ON(__alignof__(struct pool_workqueue) < __alignof__(long
> long));
>
> BUG_ON(!alloc_cpumask_var(&wq_unbound_cpumask, GFP_KERNEL));
> + BUG_ON(!alloc_cpumask_var(&wq_requested_unbound_cpumask, GFP_KERNEL));
> + BUG_ON(!zalloc_cpumask_var(&wq_isolated_cpumask, GFP_KERNEL));
> cpumask_copy(wq_unbound_cpumask, housekeeping_cpumask(HK_TYPE_WQ));
> cpumask_and(wq_unbound_cpumask, wq_unbound_cpumask,
> housekeeping_cpumask(HK_TYPE_DOMAIN));
>
> if (!cpumask_empty(&wq_cmdline_cpumask))
> cpumask_and(wq_unbound_cpumask, wq_unbound_cpumask,
> &wq_cmdline_cpumask);
> + cpumask_copy(wq_requested_unbound_cpumask, wq_unbound_cpumask);
>
> pwq_cache = KMEM_CACHE(pool_workqueue, SLAB_PANIC);
...
> Is it possible to route this patch to cgroup for 6.8 to avoid conflict?
> Other than that, the patch looks good to me.
It's a workqueue fix patch, so what I'm gonna do is land this in
wq/for-6.6-fixes and just resolve it in cgroup/for-next.
Thanks.
--
tejun
next prev parent reply other threads:[~2023-11-22 16:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-20 12:16 [PATCH] workqueue: fix invalid cpu in kick_pool Yong He
2023-11-20 19:07 ` Tejun Heo
2023-11-21 4:01 ` zhuangel570
2023-11-21 21:39 ` [PATCH] workqueue: Make sure that wq_unbound_cpumask is never empty Tejun Heo
2023-11-22 3:36 ` zhuangel570
[not found] ` <8f469287-e29a-4473-a181-9013292ef62c@redhat.com>
2023-11-22 16:03 ` Tejun Heo [this message]
2023-11-22 16:23 ` Tejun Heo
2023-11-22 19:10 ` Waiman Long
2023-11-22 16:03 ` Tejun Heo
2023-11-20 21:01 ` [PATCH] workqueue: fix invalid cpu in kick_pool kernel test robot
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=ZV4mPoOvIgX9Um0z@slm.duckdns.org \
--to=tj@kernel.org \
--cc=jiangshanlai@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=zhuangel570@gmail.com \
/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
all inboxes | Powered by JetHome®