Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp5091925rwb; Wed, 17 Aug 2022 10:54:30 -0700 (PDT) X-Google-Smtp-Source: AA6agR5KS8Junr4eFm89CnDjkcSICWwWQpdZM+OLI329SHTURkUp8bPJ5wdHauWlhrAURVg3dGqq X-Received: by 2002:a17:902:ca0b:b0:172:9916:695c with SMTP id w11-20020a170902ca0b00b001729916695cmr4293559pld.5.1660758869685; Wed, 17 Aug 2022 10:54:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660758869; cv=none; d=google.com; s=arc-20160816; b=gCbUNamYonfqH7nKBLdjDadep04SYl8k7OI0rNHeHQG7kT8XGHMXn/hDVs0MNBf/nR S7KuPnR2Rn785UpZ3p9dQKpcIKmO71fySHWGnZMXa69ACiQqVC29Jshz3zU1qUf3bo0t 1w99f4db0b0UuvfpgOedQYCJF7NwFMbgj4pyDXCdMG6j6YPlX16CNmfdqCYjw8UdvJ76 e0/RZtdTLTeQjeA1GCIURoV9Siof7rmMW2BzrzBN5O3dqQ8n5nX38faMIGL2ER6axzcQ r0yOXwlyhNilgdgM0MTPQWxnJfg33HepRek3O21vE3XmRuVCJcS+5N5yQHzTKVDrm7pj W3LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=T2VfnDiJkdhY/17kNIzqsKCO/jg0LojKsxYaZr+7Rkg=; b=QZISruMYy9Cd7UsbFIYxZGILPtTzR+AWM5GfKoYpw2CYdIwRQ4IRFcxC5zBo9nCRs1 CEcXKuwjsdLk+rY7fnYt7cFiggdMeTdVzEAyq48O+82cis6nkxduW7oDwgSvut/7GB/e omBNzFkuNYeqhudWDq8cv079L9CyQFqcJhSqllZKSZosp2/Xa++lAGMPJlIkUi/h0onr bH/ZG6ICqgcSH3VIzLVWWmb1I7zQKqE62j/gqPHt0bxwt7dPUDV3Nf0TPGiFkb1FicML yqD1SI9TUYBk7cgj5J58ra/I4kZGTRmtLWjGo9YJ1FY6wRrtkYGPHOTi/EEQpejvlBXH mESw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=KusRphF5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f18-20020a63e312000000b0041cd5c02963si5112190pgh.334.2022.08.17.10.54.18; Wed, 17 Aug 2022 10:54:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=KusRphF5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240214AbiHQRki (ORCPT + 99 others); Wed, 17 Aug 2022 13:40:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238083AbiHQRkf (ORCPT ); Wed, 17 Aug 2022 13:40:35 -0400 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE0BFA1D62; Wed, 17 Aug 2022 10:40:34 -0700 (PDT) Received: by mail-pg1-x532.google.com with SMTP id q16so12558513pgq.6; Wed, 17 Aug 2022 10:40:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc; bh=T2VfnDiJkdhY/17kNIzqsKCO/jg0LojKsxYaZr+7Rkg=; b=KusRphF5DTFe7mhRnFmNMOI7jOlvj2TNyhLSCDAfuKCkSZkVyILc9k4eWlCXBjo/D8 2J2lHM41jl4/+729s5SBzsqUMEvrC57GMo+IgkG1gNUzbCt9r3jDVrQTcIU+h/Ltg40v /WBy0rO5O4U24ET4N/ABS9JvMy0TJRmIIIOBHh0kT93W1Mw5dEnTfEkSHdViKcuks9vK iLbVHtjFTztE53D3sBOZqsmTce3BHEOgwhyvwKl3adB3ENzkvc4mRxl8MlYYm94htLUG +Ztsng8Hqv8SEzQRYgLzU9Iy35ACCmGVIWJS/G/haSnqrp2BafNL88aZARskAu+SuQJ8 4EMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc; bh=T2VfnDiJkdhY/17kNIzqsKCO/jg0LojKsxYaZr+7Rkg=; b=WTM2Gwlxty95rhFveUzMKw+sukHm4RdFhDXGQ4BRriuLI7HgUyDloR70XHPdsCgb0N 0PSkKmGcgga5I33J9al4ggeu2UYLWYksPYnc3OtvAc/mJy09z6VQRhC61U8DAsTnxdgR /9BVCVZmW9qiwqtQSiIEQ0qbQGmU0chynCyFdFy96xOKuBEuy1/peZjny7Tj8BuW4McN ZmE2XFYu8PVTi8nmOl8BldyxLmQcLlP0UzHhQsr70GFcalrAJJlUMyt0Vw67KH9nZDjN nNNgDMfJgLQdDZhiCccC2YZfRbkSZKihFmYEi8SMW1jdx7JVlGsapujUwVqh4fkelTlk Ry1A== X-Gm-Message-State: ACgBeo3AWMfwJp8cJezvTcRneU8yPODpcHbXg8rmv2G+sPkgGgDqJ/Fo J7GDyU1AQot5rh25iAopxIQ= X-Received: by 2002:a63:80c7:0:b0:41c:62dc:7d10 with SMTP id j190-20020a6380c7000000b0041c62dc7d10mr23382200pgd.313.1660758034134; Wed, 17 Aug 2022 10:40:34 -0700 (PDT) Received: from localhost (2603-800c-1a02-1bae-a7fa-157f-969a-4cde.res6.spectrum.com. [2603:800c:1a02:1bae:a7fa:157f:969a:4cde]) by smtp.gmail.com with ESMTPSA id r21-20020a170902e3d500b0016f1319d2a7sm160185ple.297.2022.08.17.10.40.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 10:40:33 -0700 (PDT) Sender: Tejun Heo Date: Wed, 17 Aug 2022 07:40:32 -1000 From: Tejun Heo To: Mukesh Ojha Cc: Michal =?iso-8859-1?Q?Koutn=FD?= , Xuewen Yan , Imran Khan , lizefan.x@bytedance.com, hannes@cmpxchg.org, tglx@linutronix.de, steven.price@arm.com, peterz@infradead.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Zhao Gongyi , Zhang Qiao Subject: Re: [PATCH cgroup/for-6.0-fixes] cgroup: Fix threadgroup_rwsem <-> cpus_read_lock() deadlock Message-ID: References: <224b19f3-912d-b858-7af4-185b8e55bc66@quicinc.com> <20220815090556.GB27407@blackbody.suse.cz> <20220815093934.GA29323@blackbody.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 15, 2022 at 01:27:38PM -1000, Tejun Heo wrote: > Bringing up a CPU may involve creating new tasks which requires read-locking > threadgroup_rwsem, so threadgroup_rwsem nests inside cpus_read_lock(). > However, cpuset's ->attach(), which may be called with thredagroup_rwsem > write-locked, also wants to disable CPU hotplug and acquires > cpus_read_lock(), leading to a deadlock. > > Fix it by guaranteeing that ->attach() is always called with CPU hotplug > disabled and removing cpus_read_lock() call from cpuset_attach(). > > Signed-off-by: Tejun Heo Applied to cgroup/for-6.0-fixes w/ commit message and comment update suggested by Xuewen and Fixes / stable tags added. Thanks. -- tejun