Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp267299imm; Thu, 6 Sep 2018 02:02:35 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbGLueTded58qzZbWo72tC3rm76fwJT1znXrgJzk2kEnjG4vJbORoPWYvQ1pNe3jL3hl4QC X-Received: by 2002:a17:902:ac8f:: with SMTP id h15-v6mr1668399plr.161.1536224555656; Thu, 06 Sep 2018 02:02:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536224555; cv=none; d=google.com; s=arc-20160816; b=J1wHUY7nDl4qIrGAelHKgXLU/EzKkpFG9pnzdpU2u+/TS45Szf0sS3IX0PhQi2S9+1 Y1Vve0jAu9Du3lBmjPap8U7MC4xgsSxrLenP/ZseC60WFd8CvW/x4kvqwGBMyLDddMtz 5N5G0AV8h3nVmhYehHrUo+kkK8quyFK8U7GFRbNlJ/5ljQfyGfG0mI47kmwPUAxu2GFL 3uUJr7GugckNebcsWYLOz7mi9ctYHH8Ij8HrjqyNH2wn+VjVee3mAhLKy61xUSskn0w6 NwYTD9rqwd58/QCTn3kUUISYklX9qL5mdtRjG0ZmwvGmMVwolP1ohUd+uL9l7jN07BM2 i40w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature:dkim-signature; bh=ZvfZKVE+cGONyHZozM7wnNb4sQKyDgyUqTZhU/hbYC0=; b=oXz2g8WSidfndBKqokVomcGsQXLt0vvUlwcO2R8N1pXXBsGlwRA/wcV4+65pF+J+Kj RVmRfdJBxCPSD7suqLPnR/so7BHwyfLe74mIFyhbljsuahW6TIJo0bVecu7hvX1JBAey RRyJSq+VjlcKGuQv104NMZR/AXEwrm5KpTI6TwJGh/7i5+F0RUXt9gnszNqqxt4/xEmf RBo9gMmFmoI3n1xoQbEF6GepIwREPelv1Cd5ncikfmHDC3uGAgYa7ExHccQJc9BCm2fQ 4Xf7gE/SywiieWJNIFKz8ei25G3RovpJh9gDgjxpFQyC4yXuIrtgpnLPB5bhLchlQ1mu V0Ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=RIKOKCfW; dkim=pass header.i=@codeaurora.org header.s=default header.b=WIlIUl1i; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c2-v6si4439762pfn.212.2018.09.06.02.02.19; Thu, 06 Sep 2018 02:02:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=RIKOKCfW; dkim=pass header.i=@codeaurora.org header.s=default header.b=WIlIUl1i; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728164AbeIFNfR (ORCPT + 99 others); Thu, 6 Sep 2018 09:35:17 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:60494 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727672AbeIFNfR (ORCPT ); Thu, 6 Sep 2018 09:35:17 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 5692E6081A; Thu, 6 Sep 2018 09:00:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1536224450; bh=AE++BEUB1fXydUyhHP1nZ4Dbp16C6/uEvaIfdiQ+spk=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=RIKOKCfWQwdhl8hiw27so1WEuOcXwAgC9YcoK0uWs8b+swJ4RQEW7fB9GGefDjigc 9O5ySBbEsXzqp1ZK94odBr+e8+VrMzWv0TxR8EbscGpums4Ixrp6iny40u3E7W932E Q7lv5dRoAgh7R9fviXEAZTH2gW0DQkEATkEhN9gw= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from [10.204.78.89] (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: neeraju@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 5A165607B5; Thu, 6 Sep 2018 09:00:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1536224447; bh=AE++BEUB1fXydUyhHP1nZ4Dbp16C6/uEvaIfdiQ+spk=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=WIlIUl1ijJ4CRONvbVuPAIvY7q12cz13GYVIKlQgk436IGwdliYG8em1Ujwt/5OL5 DXTiqdcI2DEcw2TnM4FMiSp2kj+/3wfi7+P3JO2aV/hQKaNqrwPnTiXd/i3lavBujV e/g3+5t2oh9PBxt3ndpV5bb17LTm+7/cdzpvJohM= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 5A165607B5 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 Subject: Re: [PATCH] cpu/hotplug: Fix rollback during error-out in takedown_cpu() To: Thomas Gleixner Cc: josh@joshtriplett.org, peterz@infradead.org, mingo@kernel.org, jiangshanlai@gmail.com, dzickus@redhat.com, brendan.jackman@arm.com, malat@debian.org, linux-kernel@vger.kernel.org, sramana@codeaurora.org, linux-arm-msm@vger.kernel.org References: <1536042803-6152-1-git-send-email-neeraju@codeaurora.org> <5b0e528f-e597-9598-3ff6-b9e08ddb8165@codeaurora.org> <9cac90ff-1a43-8663-da2e-7191975b5e93@codeaurora.org> From: Neeraj Upadhyay Message-ID: <9b4609c6-284f-cfab-82ba-2f2bf7f1867a@codeaurora.org> Date: Thu, 6 Sep 2018 14:30:41 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/06/2018 01:48 PM, Thomas Gleixner wrote: > On Thu, 6 Sep 2018, Neeraj Upadhyay wrote: >> On 09/05/2018 06:47 PM, Thomas Gleixner wrote: >>> On Wed, 5 Sep 2018, Neeraj Upadhyay wrote: >>>> On 09/05/2018 05:53 PM, Thomas Gleixner wrote: >>>>> And looking closer this is a general issue. Just that the TEARDOWN state >>>>> makes it simple to observe. It's universaly broken, when the first >>>>> teardown >>>>> callback fails because, st->state is only decremented _AFTER_ the >>>>> callback >>>>> returns success, but undo_cpu_down() increments unconditionally. >>>>> >>>> As per my understanding, there are 2 problems here; one is fixed with your >>>> patch, and other is cpuhp_reset_state() is used during rollback from >>>> non-AP to >>>> AP state, which seem to result in 2 increments of st->state (one increment >>>> done by cpuhp_reset_state() and another by cpu_thread_fun()) . >>> And how did your hack fix that up magically? I'll have a look later today. >>> >>> Thanks, >>> >>> tglx >> >> The hack fixes it by not calling cpuhp_reset_state() and doing rollback state >> reset inline inĀ  _cpu_down(). > > And how is that any different from the proper patch I sent? It ends up in > the same state. So I have a hard time to understand your blurb above where > you claim that my patch just solves one of two problems? > > Thanks, > > tglx > Yes, your patch solves the problem related to smpboot unparking being skipped during rollback and with the hack we end up in same state. The second thing, which I am referring to, is that there is one additional state increment. I missed the part that, it could be required, so that we reach CPUHP_AP_ONLINE_IDLE before calling __cpuhp_kick_ap(). So, it's not a problem. * cpuhp_reset_state() does one state increment and we reach CPUHP_AP_ONLINE_IDLE. if (ret && st->state > CPUHP_TEARDOWN_CPU && st->state < prev_state) { cpuhp_reset_state(st, prev_state); __cpuhp_kick_ap(st); } CPUHP_TEARDOWN_CPU, CPUHP_AP_ONLINE_IDLE, CPUHP_AP_SMPBOOT_THREADS, * cpuhp_thread_fun() does one more increment before invoking state callback (so, we skip CPUHP_AP_ONLINE_IDLE) and we reach CPUHP_AP_SMPBOOT_THREADS: static void cpuhp_thread_fun(unsigned int cpu) if (bringup) { st->state++; state = st->state; -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation