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=-10.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 DF89BC433E0 for ; Thu, 21 Jan 2021 11:02:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8E13B2388E for ; Thu, 21 Jan 2021 11:02:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730031AbhAULBw (ORCPT ); Thu, 21 Jan 2021 06:01:52 -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