From patchwork Tue Sep 4 06:33:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neeraj Upadhyay X-Patchwork-Id: 10586693 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0A657112B for ; Tue, 4 Sep 2018 06:33:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED1D028E41 for ; Tue, 4 Sep 2018 06:33:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E0DDE28EAB; Tue, 4 Sep 2018 06:33:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A70228E41 for ; Tue, 4 Sep 2018 06:33:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727104AbeIDK5b (ORCPT ); Tue, 4 Sep 2018 06:57:31 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:50040 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726377AbeIDK5b (ORCPT ); Tue, 4 Sep 2018 06:57:31 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id D0757607F7; Tue, 4 Sep 2018 06:33:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1536042830; bh=MsGY8ib0tPhRcCEXecUovExlnWrd0B2L2l1G5cGNXFI=; h=From:To:Cc:Subject:Date:From; b=YY+D1gtRjKH2uLQ+f+crBB65ojRBCqD01rbfmWXR3oUYwwQWgXWnjdk26D7kuqtFf ktzOVOXJoLtiOQaiu165PC4k2IB/Vp0JnErAKJ9wozaJKVHx/n5PEtXxdVm1tGbrK3 Wibq6zb3Uv2ytkhOKrU/TZvHl56N9PQqIjrEOG+Y= Received: from neeraju-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: neeraju@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 682D360388; Tue, 4 Sep 2018 06:33:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1536042829; bh=MsGY8ib0tPhRcCEXecUovExlnWrd0B2L2l1G5cGNXFI=; h=From:To:Cc:Subject:Date:From; b=E+NndtMvRuk15IoPZlCxL5g6voZKlD9kmtffUZfekaVXg0ZEjQc0m1Vl1Z8ZK03rs 3dOAtU7BPLGIFB/pBy8yvZZ4NlscWEC/BxIzM+zxAPhSeThM9gZCzeN+GMdk95J/gi Fxw0qKzkEwDmPs/staawmrMdaPFKtiY7fPZyKN/c= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 682D360388 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=neeraju@codeaurora.org From: Neeraj Upadhyay To: tglx@linutronix.de, josh@joshtriplett.org, peterz@infradead.org, mingo@kernel.org, jiangshanlai@gmail.com, dzickus@redhat.com, brendan.jackman@arm.com, malat@debian.org Cc: linux-kernel@vger.kernel.org, sramana@codeaurora.org, linux-arm-msm@vger.kernel.org, Neeraj Upadhyay Subject: [PATCH] cpu/hotplug: Fix rollback during error-out in takedown_cpu() Date: Tue, 4 Sep 2018 12:03:23 +0530 Message-Id: <1536042803-6152-1-git-send-email-neeraju@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If takedown_cpu() fails during _cpu_down(), st->state is reset, by calling cpuhp_reset_state(). This results in an additional increment of st->state, which results in CPUHP_AP_SMPBOOT_THREADS state being skipped during rollback. Fix this by not calling cpuhp_reset_state() and doing the state reset directly in _cpu_down(). Fixes: 4dddfb5faa61 ("smp/hotplug: Rewrite AP state machine core") Signed-off-by: Neeraj Upadhyay Acked-by: Mukesh Ojha Tested-by: Geert Uytterhoeven --- kernel/cpu.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/kernel/cpu.c b/kernel/cpu.c index aa7fe85..9f49edb 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -970,7 +970,14 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen, */ ret = cpuhp_down_callbacks(cpu, st, target); if (ret && st->state > CPUHP_TEARDOWN_CPU && st->state < prev_state) { - cpuhp_reset_state(st, prev_state); + /* + * As st->last is not set, cpuhp_reset_state() increments + * st->state, which results in CPUHP_AP_SMPBOOT_THREADS being + * skipped during rollback. So, don't use it here. + */ + st->rollback = true; + st->target = prev_state; + st->bringup = !st->bringup; __cpuhp_kick_ap(st); }