Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp127061pxb; Thu, 14 Jan 2021 21:45:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJyfdKbjhIt5v8Aeeunkv1L9SIrk7rH3cTZEu5SAQP97rUVqeG8VvbO1r6xuMeL9f4sfrbb7 X-Received: by 2002:a05:6402:a53:: with SMTP id bt19mr8455533edb.104.1610689539282; Thu, 14 Jan 2021 21:45:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610689539; cv=none; d=google.com; s=arc-20160816; b=IZOPwDnvOB83LP83hFmjmcVIbRCOdt+JQwH5IbGjgSL08MtlWoacu1eB1Qwm16TFbj Len/ywfAj6VOx7/W39C+/pP5KZhg/26Mu22qLrmvON+R2nt4EvlowKv4FmYqaePIqqay H9X+lh5/sqM6JTln9jQuL9/OfUjE/GszIl28AI26EWVBljl8btFSvxk9/1Asp/zp3cpc DoDoOEWKeEhHYv6eNnfw/1hknik8FKS1ejJ9FQj9BJ0MwhT1snQbnG5LQF6ONtc+lImf bdIpez2LW4mly7vEVtH19jivPncyytrzvTh1N9aHWsGlwGyPcSUkkmC+Fm+Su4PbxV2A RZlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=IOXbYHXHreW/DM/cC1BlOLyDYYZQRT6FD474gUtPV4A=; b=siB36k1Cvj7dFMRDdAIuSnWVVjqHx+iPNeo8w5b4ZwoL0T9G9lIM7lrT+Fka24KNak m0WeZQwAniVmemzVyiDtIyUFSPHSSMER7RNpPdhg+4gw6bpRt7EEoeS0JKMRfmYGw7qY IDC2FySz9nvbtqwlfT+LnX2DkVWVu6JySSD0M4BWddF6JC261RZ1owiruM+goC8Z+WF0 OsKxRZDKDEAYbsUiqW7E/0x/9cnwtDInF75IU8qIcum4kh4Po59y4ycEeeUjPyRiFCAn RyDal/eDO+z0EJ+L968qLge+cuGoXO7zU6sE+nwl1ksgxT49zF8yULPpvtvYrWdqoBuz RPCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=bEPJJSBK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bu4si1455010edb.55.2021.01.14.21.45.15; Thu, 14 Jan 2021 21:45:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=bEPJJSBK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729198AbhAODXX (ORCPT + 99 others); Thu, 14 Jan 2021 22:23:23 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:49308 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725950AbhAODXW (ORCPT ); Thu, 14 Jan 2021 22:23:22 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 10F3KCLk168130; Fri, 15 Jan 2021 03:22:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : in-reply-to : references : date : message-id : mime-version : content-type; s=corp-2020-01-29; bh=IOXbYHXHreW/DM/cC1BlOLyDYYZQRT6FD474gUtPV4A=; b=bEPJJSBKEY26381CteMXcM4TUtEgoNn7H/6Rj2Fypaq1KcWpgvxWwf+JT51UyPqMBfLU z4XGtzk1ndfrc/YAierZRu8Y86WIPMsivOrf/Y0gSoD3VutNeQ14tbaclOeHXO6zDT2U JDqZC1A1fdnzmxHZJY87mMZdb55T7Z+HczXUWTjsiU6OYzicqpmmTE6AtcFnknnwMjLg aXWGjJkmveVKL93gWjnihgvAyIxdmP8K2uKCqQWMSRElLbNy3MpZZTbY6Hq3znlVDiy2 th6Uds65hwxEYViQeguOCfM9EEcXPWxXXjPogQle01Bu/mBImohggC0CRTiZiBXkdjVI /A== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 360kd0355f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Jan 2021 03:22:05 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 10F3M1SL106622; Fri, 15 Jan 2021 03:22:04 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3020.oracle.com with ESMTP id 360keaps4r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Jan 2021 03:22:04 +0000 Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 10F3LUj3020589; Fri, 15 Jan 2021 03:21:31 GMT Received: from parnassus (/98.229.125.203) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 14 Jan 2021 19:21:30 -0800 From: Daniel Jordan To: Peter Zijlstra , Alexey Klimov Cc: linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, yury.norov@gmail.com, tglx@linutronix.de, jobaker@redhat.com, audralmitchel@gmail.com, arnd@arndb.de, gregkh@linuxfoundation.org, rafael@kernel.org, tj@kernel.org, lizefan.x@bytedance.com, qais.yousef@arm.com, hannes@cmpxchg.org, klimov.linux@gmail.com Subject: Re: [RFC][PATCH] cpu/hotplug: wait for cpuset_hotplug_work to finish on cpu online In-Reply-To: <87k0tritvq.fsf@oracle.com> References: <20201203171431.256675-1-aklimov@redhat.com> <20201207083827.GD3040@hirez.programming.kicks-ass.net> <87k0tritvq.fsf@oracle.com> Date: Thu, 14 Jan 2021 22:21:25 -0500 Message-ID: <87im7yc2bu.fsf@oracle.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9864 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 suspectscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101150015 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9864 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 impostorscore=0 bulkscore=0 adultscore=0 suspectscore=0 malwarescore=0 lowpriorityscore=0 clxscore=1011 mlxlogscore=999 mlxscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101150015 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Daniel Jordan writes: > Peter Zijlstra writes: >>> The nature of this bug is also described here (with different consequences): >>> https://lore.kernel.org/lkml/20200211141554.24181-1-qais.yousef@arm.com/ >> >> Yeah, pesky deadlocks.. someone was going to try again. > > I dug up the synchronous patch > > https://lore.kernel.org/lkml/1579878449-10164-1-git-send-email-prsood@codeaurora.org/ > > but surprisingly wasn't able to reproduce the lockdep splat from > > https://lore.kernel.org/lkml/F0388D99-84D7-453B-9B6B-EEFF0E7BE4CC@lca.pw/ > > even though I could hit it a few weeks ago. oh okay, you need to mount a legacy cpuset hierarchy. So as the above splat shows, making cpuset_hotplug_workfn() synchronous means cpu_hotplug_lock (and "cpuhp_state-down") can be acquired before cgroup_mutex. But there are at least four cgroup paths that take the locks in the opposite order. They're all the same, they take cgroup_mutex and then cpu_hotplug_lock later on to modify one or more static keys. cpu_hotplug_lock should probably be ahead of cgroup_mutex because the latter is taken in a hotplug callback, and we should keep the static branches in cgroup, so the only way out I can think of is moving cpu_hotplug_lock to just before cgroup_mutex is taken and switching to _cpuslocked flavors of the static key calls. lockdep quiets down with that change everywhere, but it puts another big lock around a lot of cgroup paths. Seems less heavyhanded to go with this RFC. What do you all think? Absent further discussion, Alexey, do you plan to post another version?