Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754851AbdIGI4S (ORCPT ); Thu, 7 Sep 2017 04:56:18 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:38694 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754404AbdIGI4Q (ORCPT ); Thu, 7 Sep 2017 04:56:16 -0400 X-Google-Smtp-Source: ADKCNb5SXTzDOBo+pc7PxtNcdzUTMMDWT5YXqvOYQjYjrS4lRmJu+NXMkPauPwUV+BkuiXBrQ5+XkA== Date: Thu, 7 Sep 2017 16:56:32 +0800 From: Boqun Feng To: Peter Zijlstra Cc: Prateek Sood , tj@kernel.org, lizefan@huawei.com, cgroups@vger.kernel.org, mingo@kernel.org, longman@redhat.com, linux-kernel@vger.kernel.org, sramana@codeaurora.org, Thomas Gleixner Subject: Re: [PATCH] cgroup/cpuset: remove circular dependency deadlock Message-ID: <20170907085534.GA30135@tardis> References: <1504764252-29091-1-git-send-email-prsood@codeaurora.org> <20170907072848.2sjjddwincaeplju@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="pvezYHf7grwyp3Bc" Content-Disposition: inline In-Reply-To: <20170907072848.2sjjddwincaeplju@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.8.3 (2017-05-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2391 Lines: 76 --pvezYHf7grwyp3Bc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Sep 07, 2017 at 09:28:48AM +0200, Peter Zijlstra wrote: > On Thu, Sep 07, 2017 at 11:34:12AM +0530, Prateek Sood wrote: > > Remove circular dependency deadlock in a scenario where hotplug of CPU = is > > being done while there is updation in cgroup and cpuset triggered from > > userspace. > >=20 > > Example scenario: > > kworker/0:0 =3D> kthreadd =3D> init:729 =3D> init:1 =3D> kworker/0:0 > >=20 > > kworker/0:0 - percpu_down_write(&cpu_hotplug_lock) [held] > > flush(work) [no high prio workqueue available on CPU] > > wait_for_completion() Hi Prateek, so this is: _cpu_down(): cpus_write_lock(); // percpu_down_write(&cpu_hotlug_lock) cpuhp_invoke_callbacks(): workqueue_offine_cpu(): wq_update_unbound_numa(): alloc_unbound_pool(): get_unbound_pool(): create_worker(): kthread_create_on_node(): wake_up_process(kthreadd_task); wait_for_completion(); // create->done , right? Wonder running in a kworker is necessary to trigger this, I mean running a cpu_down() in a normal process context could also trigger this, no? Just ask out of curiosity. Regards, Boqun > >=20 > > kthreadd - percpu_down_read(cgroup_threadgroup_rwsem) [waiting] > >=20 > > init:729 - percpu_down_write(cgroup_threadgroup_rwsem) [held] > > lock(cpuset_mutex) [waiting] > >=20 > > init:1 - lock(cpuset_mutex) [held] > > percpu_down_read(&cpu_hotplug_lock) [waiting] >=20 > That's both unreadable and useless :/ You want to tell what code paths > that were, not which random tasks happened to run them. >=20 >=20 [...] --pvezYHf7grwyp3Bc Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEj5IosQTPz8XU1wRHSXnow7UH+rgFAlmxCb0ACgkQSXnow7UH +rgh+Af+L0P//IFtlwFQLkh8VHI6or8ipwT+Cl7+vNjK+G5MpRJV9X68o5gYr+jj YATJz6ZWYRD+H7MmIoqmuwdpG7Q2iB9OmNFKvVsSaok+jYFF6Alwz2Jrjo1Ex+x1 ZTZ9FdzXEL62l52Hcyq8kfPoIeRFbZNoRyyAGPT4xFJtYrmnJrl/GOyAk2rAhQyU 90mCxiLd4EO9SF7+6WgFWmGIG8Yj97AYCRtWc17q3rp7YuRY4vqJIdUQFZUnEKI9 rQwW/8GZUkC46xfgJSI3gwHdF2rTx02PNNoNwihqo65ZgrCyI0ks2z2QN1M93pwp fBuLaGZP9Yy99ypGti2VWSArBrs0cw== =QkrD -----END PGP SIGNATURE----- --pvezYHf7grwyp3Bc--