Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2423185pxb; Mon, 11 Jan 2021 09:14:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJwEFPVux6j7G3ouTSu41cp5gVDTNi/PlWTbOLx9k5C8zI1dWGw2gNzrXMUBqhTSdGOY9l/T X-Received: by 2002:a17:906:c097:: with SMTP id f23mr358831ejz.136.1610385267976; Mon, 11 Jan 2021 09:14:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610385267; cv=none; d=google.com; s=arc-20160816; b=kJcyZkWe9U+2W8ncAdwh59ugbZd8SB4HNbN8Tw3Elrrja7eJz5f8dczsMGSDRCrlUS FjkvCmdtrgh8eFo8hO5mhYZb4Ft4RxFefSSVo9AKdW4nX1SfZfeKdiowxZTBeFGZk+3u nJq5+IXDOt5xxJP34IkFbeJArD81gSfWZPMcMbtDfxA8/gCwfUnW1z1QK4ptjN7O3HHX 4XCcovUnqsPp4pzZrwOX7eK/xvUPmKriWbWO42CDnuayd3AwY7YMHyEl6NWuCGuhUbVp W8zh12hVkekgaNRmZhszousRB5xZ3ISCeuPzFm7NeedFAz7CyT4VzphdvBgq1cM4gQ0E SE4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=9JIcsg6lqxCaUTE30tMn3ZxAGdgDEsHzbHHsSYj+7zQ=; b=IwKb9pm8FNMa/7sfvSQdMa9LigbvRDDQODwPuJ62rNNK35myychkkTTRd8vtHJi1ch WHIe9McuRhfF+A3F9EvbcIYUbX+PI2RxVMHxcERctILFsojRX81Cu3b6kz5xpa/HNy8D +yd1DKld2v2Fa3R3reXtFCLIlpa0Z+PFOXtmbXR0EIVRx8/y/8W3RH4kT+u04mzo6j6d wcQpWt0jYTI6dBkOWBKURdY5O88vn2yR0DoQBsxk53coyEOgVGujEUyyLM4nzV8jZycq xjC3NGhpjvUdGuOAAgJmT6XrxwIkPvv8C9s0n3QuE9ddnJHZ4VcjxHsQZbZk2WdQCia5 /XKw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s11si165203edy.18.2021.01.11.09.14.01; Mon, 11 Jan 2021 09:14:27 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389357AbhAKRMW (ORCPT + 99 others); Mon, 11 Jan 2021 12:12:22 -0500 Received: from foss.arm.com ([217.140.110.172]:33212 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389238AbhAKRMU (ORCPT ); Mon, 11 Jan 2021 12:12:20 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1A3A011FB; Mon, 11 Jan 2021 09:11:35 -0800 (PST) Received: from e120877-lin.cambridge.arm.com (e120877-lin.cambridge.arm.com [10.1.194.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 444B33F70D; Mon, 11 Jan 2021 09:11:34 -0800 (PST) From: vincent.donnefort@arm.com To: peterz@infradead.org, tglx@linutronix.de, linux-kernel@vger.kernel.org Cc: valentin.schneider@arm.com, Vincent Donnefort Subject: [PATCH 2/4] cpu/hotplug: CPUHP_BRINGUP_CPU exception in fail injection Date: Mon, 11 Jan 2021 17:10:45 +0000 Message-Id: <1610385047-92151-3-git-send-email-vincent.donnefort@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1610385047-92151-1-git-send-email-vincent.donnefort@arm.com> References: <1610385047-92151-1-git-send-email-vincent.donnefort@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; /* -- 2.7.4