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: 29013 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f198.google.com (mail-ie0-f198.google.com [209.85.223.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 07B20203AC for ; Thu, 24 Apr 2014 18:07:24 +0000 (UTC) Received: by mail-ie0-f198.google.com with SMTP id to1sf15882028ieb.5 for ; Thu, 24 Apr 2014 11:07:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mime-version:in-reply-to:references :date:message-id:subject:from:to:cc:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=c07oRnKKAuAVTHca3r+By00E/ymCWj15VPIRtcTABBY=; b=TOHUvGQ+m8u6EsQUlLgXwJeBLCaFL7o5Fvjcinm3hU6yvJVyWM9+Ee+TQ0iJ9dREAX yZujcVA9Mgy+/fFkRJUwDqjqTYSYgdq6ZoLy0u/vhE82ir1CaH1kLoia4YfNkzhCY0I6 DYRveqeOrAtOW+m28uyMgsYhTEH151jv1RHisaTjwGmU1BGMmtu77Z1GvXfy/bBl24w/ LYH5KERhgEOSVw/E2Is34IjidlRqyuuDrrK9+c+DYj/LVmULUdYm4Z2sBEG8SwYd5lgs JQaDbSMjWEu/QSjqN8Nkz/TZ10G9VIukVbWYMiwhNxbYH0NUXLqEjlwesjc6NrkDRDi2 drfQ== X-Gm-Message-State: ALoCoQmDRQqwObnQaLSzpnhnR4aTs3fXkTrN5ShnQhBbeNyEKSIbkxnJzCATbrPgwvUj2zb1gVB9 X-Received: by 10.182.98.230 with SMTP id el6mr1982199obb.10.1398362844408; Thu, 24 Apr 2014 11:07:24 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.24.146 with SMTP id 18ls1262595qgr.58.gmail; Thu, 24 Apr 2014 11:07:24 -0700 (PDT) X-Received: by 10.58.243.39 with SMTP id wv7mr5412vec.51.1398362844140; Thu, 24 Apr 2014 11:07:24 -0700 (PDT) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by mx.google.com with ESMTPS id sh5si1108550vdc.140.2014.04.24.11.07.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 24 Apr 2014 11:07:24 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.128.174; Received: by mail-ve0-f174.google.com with SMTP id oz11so3332530veb.33 for ; Thu, 24 Apr 2014 11:07:24 -0700 (PDT) X-Received: by 10.52.108.164 with SMTP id hl4mr1808513vdb.25.1398362844063; Thu, 24 Apr 2014 11:07:24 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp35883vcb; Thu, 24 Apr 2014 11:07:23 -0700 (PDT) X-Received: by 10.180.10.164 with SMTP id j4mr46145wib.51.1398362840969; Thu, 24 Apr 2014 11:07:20 -0700 (PDT) Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com [209.85.212.176]) by mx.google.com with ESMTPS id cc6si2126020wib.0.2014.04.24.11.07.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 24 Apr 2014 11:07:20 -0700 (PDT) Received-SPF: none (google.com: ashwin.chaugule@linaro.org does not designate permitted sender hosts) client-ip=209.85.212.176; Received: by mail-wi0-f176.google.com with SMTP id r20so1523767wiv.9 for ; Thu, 24 Apr 2014 11:07:20 -0700 (PDT) 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 Cc: Mark Rutland , "rob.herring@linaro.org" , "anup.patel@linaro.org" , "linaro-acpi@lists.linaro.org" , Marc Zyngier , "patches@linaro.org" , "linux-arm-kernel@lists.infradead.org" , "christoffer.dall@linaro.org" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ashwin.chaugule@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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);