Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1793872rwd; Wed, 17 May 2023 01:11:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Q38kTlUKiYqHJltAjTfcKAPui7dmqaNarE260rA2NGw00ioWerJprvkjrWVM8+TrrMHYr X-Received: by 2002:a05:6a20:7295:b0:ef:205f:8184 with SMTP id o21-20020a056a20729500b000ef205f8184mr50828006pzk.13.1684311068659; Wed, 17 May 2023 01:11:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684311068; cv=none; d=google.com; s=arc-20160816; b=sCM9jKFPEV3oOvjnhX2nEaVh/QP+vlzd+5AAaIlGDuykFTSxqqASr88mK0eSDFi0Bw jNairWi1Aem0oh8b/2EfV56DdXNOwIFIpvYEVVPPa9quT/0fXA77Pyd+gnnVzLBnX9Pz 2ebnsT3xs7qIpL/8/5hlxGHhQrT+Xx8pOTRktIR1LpKJtaDGYync8sbBaxg/MI12i4Vf DsbI7PR/FGA9t9pa7xa1QXkiHo0i6xbYgA/PKYPER2atJmx0dyjgObVZCFg/uKcVq7Ag JJ6kAP9qKCjVOLeTti2sDK1shdOqGyUGj3NYRx3dP8fVp7LuwTd1rlCnUJ4eIb5d2lZe 3G5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=dyZ0cuqsL7jrvxzaZVQwwm8jIYz1ppUq/Jum/QlaPHY=; b=i6/QQRXJLcVzYxGKkfly5lsJTF1Ka8k2ZinUPLbOjPsKehwUBFSNSqoQ13Mf/yoTdu YhEZS/TxD4Op3mnIAu4te4/WGl/RztRlqGY711xd+B4GjfFoMhZ5VsHsT6V8Uhlwj6gK 7m7PgExgsY+xlETAmPGTTuHaNbqs9E6tfnEXIywU0e8BfchtDhKSz1wslYb+/OEpGIdI OQQM429Dcp1lfh2ISFahExHf/mbmMlr1MEpsfb3ZeVyD+2x7wkR8p6scniBZIl3EaF69 k9diSm9Gt16oyGXOpZPILzwTlqRN/hToWrc4jtD41Ve/5RXSFbP52TFObxgu4IWcwYPi AHEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=OqE8aN8J; 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=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r202-20020a632bd3000000b0052c6cde91ecsi19938022pgr.748.2023.05.17.01.10.55; Wed, 17 May 2023 01:11:08 -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=@linux.dev header.s=key1 header.b=OqE8aN8J; 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=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230257AbjEQHwn (ORCPT + 99 others); Wed, 17 May 2023 03:52:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230225AbjEQHwh (ORCPT ); Wed, 17 May 2023 03:52:37 -0400 Received: from out-59.mta1.migadu.com (out-59.mta1.migadu.com [95.215.58.59]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C22D63AB5 for ; Wed, 17 May 2023 00:52:36 -0700 (PDT) Content-Type: text/plain; charset=us-ascii DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1684309952; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dyZ0cuqsL7jrvxzaZVQwwm8jIYz1ppUq/Jum/QlaPHY=; b=OqE8aN8JSmdgKToLUX971c7a3DiU0pJ/sWtW/fk/TdEd7ve3MsuPqQUmLvJYFdYZAWuF/L fY3RAA8bI8+JkKFtpGNXuWnggvdU95pfY1QJ/kI1njPSw/kCFj3CliY7MVbJz9tDqJudfU OnoMOIJFePDXRG526clf0FUO/xpivRE= MIME-Version: 1.0 Subject: Re: [PATCH] cgroup: fix missing cpus_read_{lock,unlock}() in cgroup_transfer_tasks() X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Muchun Song In-Reply-To: <20230517074545.2045035-1-qi.zheng@linux.dev> Date: Wed, 17 May 2023 15:51:56 +0800 Cc: Tejun Heo , Zefan Li , Johannes Weiner , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Qi Zheng , Zhao Gongyi Content-Transfer-Encoding: quoted-printable Message-Id: <75E872A8-652F-40B0-80D0-378569E77775@linux.dev> References: <20230517074545.2045035-1-qi.zheng@linux.dev> To: Qi Zheng X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham 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 May 17, 2023, at 15:45, Qi Zheng wrote: >=20 > From: Qi Zheng >=20 > 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: >=20 > 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: > > 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 > >=20 > So just use the cgroup_attach_{lock,unlock}() helper to fix it. >=20 > Fixes: 4f7e7236435c ("cgroup: Fix threadgroup_rwsem <-> = cpus_read_lock() deadlock") > Reported-by: Zhao Gongyi > Signed-off-by: Qi Zheng Acked-by: Muchun Song Thanks.