Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp919626pxp; Wed, 16 Mar 2022 21:19:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXG92mMMmHEK0M7UxNQC0OzS9k3TXo8hedarOSJqWSXeFeNb2RrJ41U25VUXTYEzLerqe9 X-Received: by 2002:a17:90b:1d84:b0:1bf:6760:7bb with SMTP id pf4-20020a17090b1d8400b001bf676007bbmr3188648pjb.95.1647490757113; Wed, 16 Mar 2022 21:19:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647490757; cv=none; d=google.com; s=arc-20160816; b=AHnKaqoucmpOvG01uFTDm0W9WmQOwSKSinvzVzmznJ/qzKvODZaNbhgxTb3qUDkIv1 Tb/Dtz0IRQuwfwxicGv5ENvMwwbNijqlNMRXVYtddkg42UzHjGWs3F3I4I7G6y7W5Tp3 p9Jd7Of7KRnGH9Gkepn/Ycm2YExDD4cPXkpJVQEQCOY0zlVxkzo/VJd8GlxBqRSOeuTG jABm4wcCy2G+qmcOoPQD5r9IzCl44+IgDjfV4fIzsh9hTx2gViYuYFLXiKmw2XGfnXIN 0ybuaFcMe9MC7IJwEls1cQabKI8EP1HkNud/IAgg8hXAMmB5ormiVzFt4hL1o+CcwSjD WxJg== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=xxfWBsasmO4xEaVd5nz0SoZE3bV1sO/D+EESL6AH60I=; b=fQT331elHdt17Q9v9sud91t8fwPZHQWj0MnkrYn4U0FVq7uXNOph15F7Lmh0hTpKBH NmChyLUIb4+e9H7u2X8gRacPVk27XNcpttlKVbnMEGghNUYR07TU6JGDYFxenHjVg6ro FYW2+Ei4HUUcqNsb4G7TFQX7wDDR3T17xjkYhUjc6a5TrfC+h07kMeB+DVF3XhQhMgVm nJiRThMwBhjtyTOi2ASgG4ZE5EAzl1UsZPBVQ3/3RKmr+WFV3qKlOaZmHrPovf75Xfvo zr/+nIb7K/2SAIQsxGCseLxFYHuKvuFacWlLxgSG58sRX61zNZi/7oGEOKXMUZzc9twS loVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yq6711oJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id u2-20020a170902e5c200b00151de127507si3729946plf.370.2022.03.16.21.19.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 21:19:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yq6711oJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2FDCEC334D; Wed, 16 Mar 2022 20:53:46 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234015AbiCNIIv (ORCPT + 99 others); Mon, 14 Mar 2022 04:08:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237899AbiCNIIC (ORCPT ); Mon, 14 Mar 2022 04:08:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 304C3443F7; Mon, 14 Mar 2022 01:06:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9FE9EB80BE7; Mon, 14 Mar 2022 08:06:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 145AAC340E9; Mon, 14 Mar 2022 08:06:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647245175; bh=gb7LFv9e2vRdyKjuKd26Rvil+QCxagd9WC/7n/TYZAg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=yq6711oJFJjBjOj6CYAbE53+aSvGy45cd1euulJAqKCaiH91Z4uVgmB5rdVe48/eD KTNSS2vKZvW1FcRhcN5QeniQvGD+1YET0IeT8XST9R4m+K+1F63pF5yucx6QhY3Kvs qNrlqbj8H6Fz3EvPM5j4WxKb5XPOCsJwwatmMV3k= Date: Mon, 14 Mar 2022 09:06:12 +0100 From: Greg Kroah-Hartman To: Michal =?iso-8859-1?Q?Koutn=FD?= Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Zhao Gongyi , Zhang Qiao , Waiman Long , Tejun Heo , Juri Lelli Subject: Re: [PATCH 4.19 01/34] cgroup/cpuset: Fix a race between cpuset_attach() and cpu hotplug Message-ID: References: <20220228172207.090703467@linuxfoundation.org> <20220228172208.566431934@linuxfoundation.org> <20220308151232.GA21752@blackbody.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220308151232.GA21752@blackbody.suse.cz> X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Tue, Mar 08, 2022 at 04:12:32PM +0100, Michal Koutn? wrote: > Hello. > > On Mon, Feb 28, 2022 at 06:24:07PM +0100, Greg Kroah-Hartman wrote: > > [...] > > cpuset_attach() cpu hotplug > > --------------------------- ---------------------- > > down_write(cpuset_rwsem) > > guarantee_online_cpus() // (load cpus_attach) > > sched_cpu_deactivate > > set_cpu_active() > > // will change cpu_active_mask > > set_cpus_allowed_ptr(cpus_attach) > > __set_cpus_allowed_ptr_locked() > > // (if the intersection of cpus_attach and > > cpu_active_mask is empty, will return -EINVAL) > > up_write(cpuset_rwsem) > > [...] > > --- a/kernel/cgroup/cpuset.c > > +++ b/kernel/cgroup/cpuset.c > > @@ -1528,6 +1528,7 @@ static void cpuset_attach(struct cgroup_ > > cgroup_taskset_first(tset, &css); > > cs = css_cs(css); > > > > + cpus_read_lock(); > > mutex_lock(&cpuset_mutex); > > This backport (and possible older kernels) looks suspicious since it comes > before commit d74b27d63a8b ("cgroup/cpuset: Change cpuset_rwsem and > hotplug lock order") v5.4-rc1~176^2~30 when the locking order was: > cpuset lock, cpus lock. > > At the same time it also comes before commit 710da3c8ea7d ("sched/core: > Prevent race condition between cpuset and __sched_setscheduler()") > v5.4-rc1~176^2~27 when neither __sched_setscheduler() cared and this > race is similar. (The swapped locking may still conflict with > rebuild_sched_domains() before d74b27d63a8b.) Thanks for noticing this. What do you recommend to do to resolve this? thanks, greg k-h