From: Qi Zheng <qi.zheng-fxUVXftIFDnyG1zEObXtfA@public.gmane.org>
To: Muchun Song <muchun.song-fxUVXftIFDnyG1zEObXtfA@public.gmane.org>,
Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Zefan Li <lizefan.x-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org>,
Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>,
cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Qi Zheng <zhengqi.arch-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org>,
Zhao Gongyi <zhaogongyi-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org>
Subject: Re: [PATCH] cgroup: fix missing cpus_read_{lock,unlock}() in cgroup_transfer_tasks()
Date: Mon, 22 May 2023 10:23:10 +0800 [thread overview]
Message-ID: <9a60d198-8c0a-9287-7c87-f129197d76f5@linux.dev> (raw)
In-Reply-To: <75E872A8-652F-40B0-80D0-378569E77775-fxUVXftIFDnyG1zEObXtfA@public.gmane.org>
On 2023/5/17 15:51, Muchun Song wrote:
>
>
>> On May 17, 2023, at 15:45, Qi Zheng <qi.zheng-fxUVXftIFDnyG1zEObXtfA@public.gmane.org> wrote:
>>
>> From: Qi Zheng <zhengqi.arch-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org>
>>
>> The commit 4f7e7236435c ("cgroup: Fix threadgroup_rwsem <-> cpus_read_lock()
>> deadlock") fixed the deadlock between cgroup_threadgroup_rwsem and
>> cpus_read_lock() by introducing cgroup_attach_{lock,unlock}() and removing
>> cpus_read_{lock,unlock}() from cpuset_attach(). But cgroup_transfer_tasks()
>> was missed and not handled, which will cause th following warning:
>>
>> WARNING: CPU: 0 PID: 589 at kernel/cpu.c:526 lockdep_assert_cpus_held+0x32/0x40
>> CPU: 0 PID: 589 Comm: kworker/1:4 Not tainted 6.4.0-rc2-next-20230517 #50
>> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014
>> Workqueue: events cpuset_hotplug_workfn
>> RIP: 0010:lockdep_assert_cpus_held+0x32/0x40
>> <...>
>> Call Trace:
>> <TASK>
>> cpuset_attach+0x40/0x240
>> cgroup_migrate_execute+0x452/0x5e0
>> ? _raw_spin_unlock_irq+0x28/0x40
>> cgroup_transfer_tasks+0x1f3/0x360
>> ? find_held_lock+0x32/0x90
>> ? cpuset_hotplug_workfn+0xc81/0xed0
>> cpuset_hotplug_workfn+0xcb1/0xed0
>> ? process_one_work+0x248/0x5b0
>> process_one_work+0x2b9/0x5b0
>> worker_thread+0x56/0x3b0
>> ? process_one_work+0x5b0/0x5b0
>> kthread+0xf1/0x120
>> ? kthread_complete_and_exit+0x20/0x20
>> ret_from_fork+0x1f/0x30
>> </TASK>
>>
>> So just use the cgroup_attach_{lock,unlock}() helper to fix it.
>>
>> Fixes: 4f7e7236435c ("cgroup: Fix threadgroup_rwsem <-> cpus_read_lock() deadlock")
>> Reported-by: Zhao Gongyi <zhaogongyi-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org>
>> Signed-off-by: Qi Zheng <zhengqi.arch-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org>
>
> Acked-by: Muchun Song <songmuchun-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org>
Thanks. And hi Tejun, Can this patch be applied?
>
> Thanks.
>
--
Thanks,
Qi
next prev parent reply other threads:[~2023-05-22 2:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-17 7:45 [PATCH] cgroup: fix missing cpus_read_{lock,unlock}() in cgroup_transfer_tasks() Qi Zheng
2023-05-17 7:51 ` Muchun Song
[not found] ` <75E872A8-652F-40B0-80D0-378569E77775-fxUVXftIFDnyG1zEObXtfA@public.gmane.org>
2023-05-22 2:23 ` Qi Zheng [this message]
[not found] ` <20230517074545.2045035-1-qi.zheng-fxUVXftIFDnyG1zEObXtfA@public.gmane.org>
2023-05-22 18:45 ` 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=9a60d198-8c0a-9287-7c87-f129197d76f5@linux.dev \
--to=qi.zheng-fxuvxftifdnyg1zeobxtfa@public.gmane.org \
--cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=lizefan.x-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org \
--cc=muchun.song-fxUVXftIFDnyG1zEObXtfA@public.gmane.org \
--cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=zhaogongyi-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org \
--cc=zhengqi.arch-EC8Uxl6Npydl57MIdRCFDg@public.gmane.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