Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp371279pxu; Tue, 5 Jan 2021 13:27:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJyjM3o7+Dk2XiAubeiP+QyY/qQYW++Pe8kxWCXAM7EhuWhMxHSI+TLrhuQvHo+JW2l1QOYV X-Received: by 2002:a05:6402:1caa:: with SMTP id cz10mr1703581edb.345.1609882036312; Tue, 05 Jan 2021 13:27:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609882036; cv=none; d=google.com; s=arc-20160816; b=Tk+gvqQEzXRL5bBmVLHYQ1I1lGm25pY7ZHzeeuvm3PHRy+AqGKV5tiWzKg1uCGqEDW e7Sq9AVN2H6SgR7iw4zi1uB+ihTFKy81w1v0lwrDFqdiNEegYnKFU7FlCHBUigOlryDk W1/OAzJoryThBI2nWtzCj+zh7hj5lephej6iOWXc/4H+VqmNHKozQJOaNVeFMT8rboW5 748iQsOdXt0RRbIgeQLpqMqSrqJdLIG0/MZeb02yeMhMbxrHM3Z9Eio6AQARu8DNxIDz SlVYTLLSCJXTpUxAZMNfHqSLw0mqPqfTMpB5UTU4FKh9AWqObmZGW4rB48C2Qmth8IFy Vr+Q== 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:dkim-signature; bh=3c+2QQ6IEx4+shd4/rUcNQ2aFzXA0gIgRmomRrgLTyE=; b=mPauLkyIeFS3oqyg+j4LqISu9asi3exFC3m2CUpFONAGi9PMivXr0XGDvkYAde76mt Y2aD73kL0R/8tUqawAeH3PmFpLhP7vgYMNnoA9jGqOsMJGTj00T9tTOrmU7X+WdCrPJb YpbJYTj/sog4BavAMgWSzBlxW+/NL5gvKhE4FkKlYbP7hrcZDNqy05K4FRBwylUbRRwA UhgRw05wYKkXKgbe7WgpItdhXsehqjaDFBYhLuyWs1Kpn0vW4uWLG36djXbDSirTFOAu nrz9+v+1Qq0y/pI4gFxmJC0cDaMvvgl9ECwc43knDEPLju6WAQiZ0fWFHgpf9VG/dQxF QhLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=ZNukMT8l; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gj10si155053ejb.578.2021.01.05.13.26.53; Tue, 05 Jan 2021 13:27:16 -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=@infradead.org header.s=casper.20170209 header.b=ZNukMT8l; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727561AbhAEQ0i (ORCPT + 99 others); Tue, 5 Jan 2021 11:26:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726749AbhAEQ0i (ORCPT ); Tue, 5 Jan 2021 11:26:38 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12493C061574 for ; Tue, 5 Jan 2021 08:25:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=3c+2QQ6IEx4+shd4/rUcNQ2aFzXA0gIgRmomRrgLTyE=; b=ZNukMT8lQhROAVs6lpxsQwG8C7 mathsUZmQiVV0D/ua9qXGl3+9ZjMRUAMkdOGeR6EQc/specJd4biK6/FkrH5HsFg+6ypgG+x3b3DV 17iQBPoohKA8FJSrvCZLCxswzZnzp5vaIFvWdDNAKOh5x93ehimSxsnAaWCcBSeAWRAPVTYpAAf1/ 8YGQ9yiYwT/8xdYn9fGufhLif/k3iYYtZxXops4xxQdkIqF4JKoPKeKg7WBddTvxKczcr+EbDWefz ywBVUFN9llw1CszyMR5r4+xaS3IzzgtXDCmUa/JgjjvKiYti0tI9tc8atpXDOvTlhambXQT5IbwFj KfIcaKJQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1kwp8K-001Qvq-Q7; Tue, 05 Jan 2021 16:24:35 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 1252330377D; Tue, 5 Jan 2021 17:24:31 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id CCB41201B8B9C; Tue, 5 Jan 2021 17:24:31 +0100 (CET) Date: Tue, 5 Jan 2021 17:24:31 +0100 From: Peter Zijlstra To: Lai Jiangshan Cc: LKML , Valentin Schneider , Qian Cai , Vincent Donnefort , Dexuan Cui , Lai Jiangshan , Tejun Heo Subject: Re: [PATCH -tip V3 3/8] workqueue: introduce wq_online_cpumask Message-ID: <20210105162431.GL3040@hirez.programming.kicks-ass.net> References: <20201226025117.2770-1-jiangshanlai@gmail.com> <20201226025117.2770-4-jiangshanlai@gmail.com> <20210104135649.GO3021@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 05, 2021 at 04:23:44PM +0800, Lai Jiangshan wrote: > Even with the help of wq_online_cpumask, the patchset can't silence > the warning in __set_cpus_allowed_ptr() in this case. It is indeed > hard to suppress the warning for unbound pools. Maybe we need something ^^^^^^^ Argh.. I forgot about the distinction between bound and unbound again. > like this (outmost callback of CPUHP_AP_WORKQUEUE_UNBOUND_ONLINE, > so that workqueue can do preparation when offlining before AP_ACTIVE): > > diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h > index 0042ef362511..ac2103deb20b 100644 > --- a/include/linux/cpuhotplug.h > +++ b/include/linux/cpuhotplug.h > @@ -20,6 +20,9 @@ > * | ^ > * v | > * AP_ACTIVE AP_ACTIVE > + * | ^ > + * v | > + * ONLINE ONLINE > */ > > enum cpuhp_state { > @@ -194,6 +197,7 @@ enum cpuhp_state { > CPUHP_AP_X86_HPET_ONLINE, > CPUHP_AP_X86_KVM_CLK_ONLINE, > CPUHP_AP_ACTIVE, > + CPUHP_AP_WORKQUEUE_UNBOUND_ONLINE, > CPUHP_ONLINE, > }; Yes, doing the unbound things late should not be a problem. > The other way is to modify __set_cpus_allowed_ptr() to suppress the > warning for kworkers and believe/let the workqueue handle cpumask correctly. The thing is that we don't want 'random' work injected in the CPU during the hotplug process since we're not exactly sure what state the thing is in. Once we're active, we know all is well and we can run regular crud. The thing with bound workers is that they'll only run work originating on the CPU itself, and should thus be fine.