Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp255870pxb; Wed, 20 Jan 2021 06:24:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJz8kpA2KxQCjw2/zLC7Y2adPGhKMwB/7Wb8gkdazMuElFaMS/UrtehXtPvoA/D4iFgXW2Pi X-Received: by 2002:aa7:c3d9:: with SMTP id l25mr7946362edr.188.1611152687881; Wed, 20 Jan 2021 06:24:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611152687; cv=none; d=google.com; s=arc-20160816; b=sUF57URQFkCB18KJrrjzkLjoedL8pFJdvlQOuUS30R0oRHLW/QHDzF5APWsumAmkcn h2ctYHH6H5BGS/Pdn/hS24tb2a1fzeZ0s4sQQQlmMpFZDUdTdxR4AX19MqGVHMIJUuTx VBU8jtva+bVifnZOFE6zxSOwxe6VPLYsa5BWMpKiGMxOCZzoJNkbN3/DbqvZvA0EPkJh Wu12qp6oyxOOr3EEUPbz3G0eAZQsTiWCBbf2tjFEfJpr4tr82E6MwyUPZTewktxNIO9i quWPEI5Gg/LnAPs8bPZmpWK/ltnRqdig6f9pGYpgihfQ6/TFbVW+afK6gLtZozpghNU7 Ik5g== 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=lHUmiFueFx5B8C+YZqY0KcIWEyk06ZB2IQvCenLqtRI=; b=clExpNa6igL7cqBlctFghoZBfWhJuLJR+wbkQs3Q+J+t/h5aIwmJD3pS6tGdURJSAE b2lYmKikifk2lNENWXwolc9pl00o4df9C0EK0AZiMPkrgLgcvcf5/k1DLHbSFYmfVq85 5onkrY/1mpVML1t56MtBpLe7uh7+Ac7Qp5e8UrMON/8yt3g2exGHXVqCFInrFWUhHJOG lpMrrb5OlRI0noYKA6WxNS0NuRa/LBaztB/XikkCoQEIgis53SyD23L7DvzqMU5lCAhv gBErZgbtN0Cl3NL+5GckQr6MOdCvKLDAiXI5RKCePIQYLNG2OEvThUIza88P2krYsdTf qLlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=ptbYun5x; 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 bx8si724261ejb.664.2021.01.20.06.24.16; Wed, 20 Jan 2021 06:24:47 -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=merlin.20170209 header.b=ptbYun5x; 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 S2389067AbhATOV4 (ORCPT + 99 others); Wed, 20 Jan 2021 09:21:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731468AbhATM73 (ORCPT ); Wed, 20 Jan 2021 07:59:29 -0500 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BC77C06179B for ; Wed, 20 Jan 2021 04:58:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=lHUmiFueFx5B8C+YZqY0KcIWEyk06ZB2IQvCenLqtRI=; b=ptbYun5xw7Y737xZI/ZBJZJfv/ Lvs3DQDOUbkHo1fVGOs5u/3Y8h6y8yKW6tMdccx+RyicMwY9sczsHZPqr4aQf3yXU2uPtCaOdvG5E xEYieWCzU2Nz/qZkJqjLI0qYZRUQaeqwMVw20TgMER6+6kFIB7cBGOgTjzOxZ/2pe1K7AFCoSCmMn TETmZwyJpoVWJ/5U4moKCawiDEsWk/KXTp4AfAmqxRtpljTrXdqXYN6wW6t4OJ4Go0NWZ5S0oG+Wf YxiXEc2DSK7bdNRhEUz7n9Gdxkb6ksWVsChY8gzO5N1vk6qKvHyf37dVsPEYLA3ALCnFNdlX9QMWj XlPzgDLA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2D4J-0004QS-Cr; Wed, 20 Jan 2021 12:58:39 +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 22B6D303271; Wed, 20 Jan 2021 13:58:36 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 07BE9200E3598; Wed, 20 Jan 2021 13:58:36 +0100 (CET) Date: Wed, 20 Jan 2021 13:58:35 +0100 From: Peter Zijlstra To: vincent.donnefort@arm.com Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org, valentin.schneider@arm.com Subject: Re: [PATCH 2/4] cpu/hotplug: CPUHP_BRINGUP_CPU exception in fail injection Message-ID: References: <1610385047-92151-1-git-send-email-vincent.donnefort@arm.com> <1610385047-92151-3-git-send-email-vincent.donnefort@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1610385047-92151-3-git-send-email-vincent.donnefort@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 11, 2021 at 05:10:45PM +0000, vincent.donnefort@arm.com wrote: > From: Vincent Donnefort > > The atomic states (between CPUHP_AP_IDLE_DEAD and CPUHP_AP_ONLINE) are > triggered by the CPUHP_BRINGUP_CPU step. If the latter doesn't run, none > of the atomic can. Hence, rollback is not possible after a hotunplug > CPUHP_BRINGUP_CPU step failure and the "fail" interface shouldn't allow > it. Moreover, the current CPUHP_BRINGUP_CPU teardown callback > (finish_cpu()) cannot fail anyway. > > Signed-off-by: Vincent Donnefort > --- > kernel/cpu.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/kernel/cpu.c b/kernel/cpu.c > index 9121edf..bcd7b2a 100644 > --- a/kernel/cpu.c > +++ b/kernel/cpu.c > @@ -2216,9 +2216,14 @@ static ssize_t write_cpuhp_fail(struct device *dev, > return -EINVAL; > > /* > - * Cannot fail STARTING/DYING callbacks. > + * Cannot fail STARTING/DYING callbacks. Also, those callbacks are > + * triggered by BRINGUP_CPU bringup callback. Therefore, the latter > + * can't fail during hotunplug, as it would mean we have no way of > + * rolling back the atomic states that have been previously teared > + * down. > */ > - if (cpuhp_is_atomic_state(fail)) > + if (cpuhp_is_atomic_state(fail) || > + (fail == CPUHP_BRINGUP_CPU && st->state > CPUHP_BRINGUP_CPU)) > return -EINVAL; Should we instead disallow failing any state that has .cant_stop ?