From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05B08C43381 for ; Wed, 20 Jan 2021 14:22:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CB8BD23329 for ; Wed, 20 Jan 2021 14:22:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389319AbhATOWA (ORCPT ); Wed, 20 Jan 2021 09:22:00 -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 ?