From patchwork Thu Apr 24 18:07:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ashwin Chaugule X-Patchwork-Id: 4053151 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 551B49F319 for ; Thu, 24 Apr 2014 18:10:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7ACA52034E for ; Thu, 24 Apr 2014 18:10:26 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7FA4B20219 for ; Thu, 24 Apr 2014 18:10:25 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WdO3p-0002SD-Bv; Thu, 24 Apr 2014 18:07:49 +0000 Received: from mail-we0-f179.google.com ([74.125.82.179]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WdO3m-0002OK-Kf for linux-arm-kernel@lists.infradead.org; Thu, 24 Apr 2014 18:07:47 +0000 Received: by mail-we0-f179.google.com with SMTP id x48so2630959wes.10 for ; Thu, 24 Apr 2014 11:07:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=c07oRnKKAuAVTHca3r+By00E/ymCWj15VPIRtcTABBY=; b=KPtT8A6XdgdP3tx0apk4ARk44409j45IkF4SFivuc2dZEIViwtaY6KQMkTeGdyrxiA 8JVTAlcTVhAlev8xIdcAYh3JEW6ECBWrv+aKIDN1xTZ4SWocVcS5C2IzCaKLvx+4urav aB2cqHV0xBv4iMH7qgx3cdx4INKEvyv+STkLkudWzptK+0JSsmq174Zd03BmDiX93gV2 gKVpzfUgag7qMjyWqSiD98jbUXExzd+wowtgORDO6HiAdoo+XLMSM7qnk+ri27IvT80v ejHdlHuZ207O2Bb+OY+eMk+0ee+E1TUS4gSrRO5LCc8R/QN5TTzt/8puCXIfKFgkIs9h OVpA== X-Gm-Message-State: ALoCoQlIdJy/p6uvO2qMfLMK4DP3wgRw4FQs+owjrvMOObzpHU7P0AhbaCHf3i00wat6RZYD1yv7 MIME-Version: 1.0 X-Received: by 10.194.88.74 with SMTP id be10mr2773400wjb.71.1398362840432; Thu, 24 Apr 2014 11:07:20 -0700 (PDT) Received: by 10.217.42.202 with HTTP; Thu, 24 Apr 2014 11:07:20 -0700 (PDT) In-Reply-To: References: <1397762146-8337-1-git-send-email-ashwin.chaugule@linaro.org> <1397762146-8337-4-git-send-email-ashwin.chaugule@linaro.org> <20140417195009.GC24195@e106331-lin.cambridge.arm.com> Date: Thu, 24 Apr 2014 14:07:20 -0400 Message-ID: Subject: Re: [PATCH v6 3/3] ARM: Check if a CPU has gone offline From: Ashwin Chaugule To: Rob Herring X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140424_110746_876158_CA7571CA X-CRM114-Status: GOOD ( 16.33 ) X-Spam-Score: -0.7 (/) Cc: Mark Rutland , "rob.herring@linaro.org" , "anup.patel@linaro.org" , "patches@linaro.org" , Marc Zyngier , "linaro-acpi@lists.linaro.org" , "christoffer.dall@linaro.org" , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 24 April 2014 11:11, Rob Herring wrote: >> >> Hi Rob, I've already got your Reviewed-by on this patch without this >> "retry" thing. Are you okay with this as well? I can then roll it up >> in one patch. > > Yes. My only comment is I would perhaps add a sleep (or delay if this > context cannot sleep) on the retry. I'm not sure what I reasonable > time would be, but at least then you are waiting a defined amount of > time versus how long it takes this code to execute. Yea, its tricky to get the delay right. Does this look better? The caller has a wait_for_completion (which waits for 5secs max) in it, so this context should be sleepable. "100 msecs ought to be enough for anyone". ;) diff --git a/arch/arm/kernel/psci_smp.c b/arch/arm/kernel/psci_smp.c index 3a83dcf..94485e0 100644 --- a/arch/arm/kernel/psci_smp.c +++ b/arch/arm/kernel/psci_smp.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -70,22 +71,23 @@ void __ref psci_cpu_die(unsigned int cpu) int __ref psci_cpu_kill(unsigned int cpu) { - int err, retries; + int err, retry = 0; if (!psci_ops.affinity_info) return 1; /* * cpu_kill could race with cpu_die and we can * potentially end up declaring this cpu undead - * while it is dying. So retry a couple of times. + * while it is dying. So, try once more if it fails. */ -retry: +retry_once: err = psci_ops.affinity_info(cpu_logical_map(cpu), 0); if (err != PSCI_AFFINITY_INFO_RET_OFF) { - if (++retries < 3) { - pr_info("Retrying check for CPU kill: %d\n", retries); - goto retry; + if (!retry++) { + msleep(100); + pr_info("Retrying once more to check for CPU kill\n"); + goto retry_once; } pr_err("psci: Cannot kill CPU:%d, psci ret val: %d\n", cpu, err);