Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp122038pxb; Thu, 21 Jan 2021 03:02:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJxZNz6Pf/RDYjljWZDiVN3wQpp1wCc3F/e0TJpas2zJhq6RwAGbaYfsZOGGp7xJYePQcl/3 X-Received: by 2002:aa7:cd4c:: with SMTP id v12mr10708955edw.17.1611226966511; Thu, 21 Jan 2021 03:02:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611226966; cv=none; d=google.com; s=arc-20160816; b=tggrRB2iTAQTstDvSErcehyQgysqlVJFbRxAtz8snyLCnaOfecwCKCGAAv1Utg3KF3 gPV/g/mmu/muEhUbO5nCmlYKbC5RPZi90XLgW5eBQ8Gg8dBm/N7FiuB3Fprnl5FUYBp2 L4F9t0IuaFk8MA0Rjplj2NhewfJFn5zOYX5enmmQp+/Pjtb41et6DXt98ULoLhu49X7q vD/4X6bL3NUJx85tvd1crWG9qv7lsmnKiB+Qa4fMpsqf4S4CT5/N2hgERZConirsCdxo qnGK6cKHnIMU02evT3WyjJIC9h25qAvHNDLvoUUY/+xzz/WAMYvmf+UH9OEXVYCL7eWA jubw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=BUrjcqL5Vsg1weaIwO/4Wi7U53RCXYlj5YNUSxE2vwM=; b=gbW+BLN+yiNRxuwz6SWmPQEJUzEptNMpwaAX832Scgs5hGr86LK0wfQ5sDTcJfQHRe yK7V+YGiGRbXau8jh1OV+pOYbI/XRdedPVeUZAliP3/x9hJ+f7YmPX46mORO8hKaCzoZ gZQ2moaEjZWRir+cfZ1BEV+oJbAVqcvWNduoF9vwjia0pl2JcfRrVH8OuQivTTtLO+B3 HGsBz0hW8n5cAYjgfrSBB5IJPtipAo08azX6Ii0BSinYC9OTbl+ORo3X9dEZwDo0NIa+ tJmsbw02W5l6MG6KjTX89Kw78TUsYQDaVfyPQnzEBdI7bumPPliPNSO36r+f30iRx6nz mt1w== 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 qu25si1680884ejb.424.2021.01.21.03.02.22; Thu, 21 Jan 2021 03:02:46 -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 S1729905AbhAULB0 (ORCPT + 99 others); Thu, 21 Jan 2021 06:01:26 -0500 Received: from foss.arm.com ([217.140.110.172]:59470 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730287AbhAUK6v (ORCPT ); Thu, 21 Jan 2021 05:58:51 -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 46801D6E; Thu, 21 Jan 2021 02:58:03 -0800 (PST) Received: from e120877-lin.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7B6EB3F719; Thu, 21 Jan 2021 02:58:02 -0800 (PST) Date: Thu, 21 Jan 2021 10:57:57 +0000 From: Vincent Donnefort To: Peter Zijlstra Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org, valentin.schneider@arm.com Subject: Re: [PATCH 3/4] cpu/hotplug: Add cpuhp_invoke_callback_range() Message-ID: <20210121105756.GA312559@e120877-lin.cambridge.arm.com> References: <1610385047-92151-1-git-send-email-vincent.donnefort@arm.com> <1610385047-92151-4-git-send-email-vincent.donnefort@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 20, 2021 at 06:53:33PM +0100, Peter Zijlstra wrote: > On Wed, Jan 20, 2021 at 06:45:16PM +0100, Peter Zijlstra wrote: > > On Mon, Jan 11, 2021 at 05:10:46PM +0000, vincent.donnefort@arm.com wrote: > > > @@ -475,6 +478,11 @@ cpuhp_set_state(struct cpuhp_cpu_state *st, enum cpuhp_state target) > > > static inline void > > > cpuhp_reset_state(struct cpuhp_cpu_state *st, enum cpuhp_state prev_state) > > > { > > > + st->target = prev_state; > > > + > > > + if (st->rollback) > > > + return; > > > > I'm thinking that if we call rollback while already rollback we're hosed > > something fierce, no? > > > > That like going up, failing, going back down again, also failing, giving > > up in a fiery death. > > Ooh, is this a hack for _cpu_down(): > > ret = cpuhp_down_callbacks(cpu, st, target); > if (ret && st->state == CPUHP_TEARDOWN_CPU && st->state < prev_state) { > cpuhp_reset_state(st, prev_state); > __cpuhp_kick_ap(st); > } > > Where cpuhp_down_callbacks() can already have called cpuhp_reset_state() ? Yes, it is now possible that this function will be called twice during the rollback. Shall I avoid this and treat the case above differently ? i.e. "if we are here, state has already been reset, and we should only set st->target". -- Vincent