From patchwork Fri May 9 01:37:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 4139931 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DD34EBFF02 for ; Fri, 9 May 2014 01:39:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1E3CE202EC for ; Fri, 9 May 2014 01:39:47 +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 489B3202EA for ; Fri, 9 May 2014 01:39:46 +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 1WiZkt-0000pb-2r; Fri, 09 May 2014 01:37:43 +0000 Received: from mail-qc0-f177.google.com ([209.85.216.177]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WiZkq-0000gM-48 for linux-arm-kernel@lists.infradead.org; Fri, 09 May 2014 01:37:40 +0000 Received: by mail-qc0-f177.google.com with SMTP id i17so3804681qcy.36 for ; Thu, 08 May 2014 18:37:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version:content-type; bh=An4C10JZ8iMkEj+3XhnUxoLlUodt6NYeEjfjoaJqXb8=; b=kVjiP386S9KynAKegFEeIPT4W9IsE6VGY4HJMVYv8JiiOVQArZmlGtU0vX9Ia/dmJc j978jDywrToFhNnqWq0mV1sl9kGcWgtY5uQT7ya+VXzgzxLs9l5rY4ls1VT8gHBu/hnF gkpeHdG1qNueMsCbUc0YB8ibE4B/ple+6t8FxIFzd1YZtzwuTRNgisG5OUOMV8uXpEgv 9S4uhBuyTH6CzZfVDsIicgsS1i5nasXi8l2xCRlfYdCyG/3Z9hdZUOZZsqyLl2S3zCmu sWgHNLP84fQLbNiIEA3YRKUJqQ08O1jfD9yg/INZr0zKZVNe3WkfF6DlwI2aLV3NbU9Z LyOg== X-Gm-Message-State: ALoCoQm9i5y1Oe12EKRZl4e3qpKX8phUsLvZRkLIPH2Wm5dedcxo1U2u0E0yS0IkEgjUQG65ihjw X-Received: by 10.229.220.197 with SMTP id hz5mr10331294qcb.9.1399599438160; Thu, 08 May 2014 18:37:18 -0700 (PDT) Received: from xanadu.home (modemcable177.143-130-66.mc.videotron.ca. [66.130.143.177]) by mx.google.com with ESMTPSA id v44sm3086159qge.13.2014.05.08.18.37.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 08 May 2014 18:37:17 -0700 (PDT) Date: Thu, 8 May 2014 21:37:15 -0400 (EDT) From: Nicolas Pitre To: Russell King - ARM Linux Subject: Re: [PATCH] ARM: Don't ever downscale loops_per_jiffy in SMP systems In-Reply-To: <20140508205223.GI3693@n2100.arm.linux.org.uk> Message-ID: References: <1399504982-31181-1-git-send-email-dianders@chromium.org> <20140508192209.GH3693@n2100.arm.linux.org.uk> <20140508205223.GI3693@n2100.arm.linux.org.uk> User-Agent: Alpine 2.11 (LFD 23 2013-08-11) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140508_183740_231931_91B58807 X-CRM114-Status: GOOD ( 17.17 ) X-Spam-Score: -0.7 (/) Cc: Stephen Boyd , David Riley , Stephen Warren , Marc Zyngier , Viresh Kumar , "Rafael J. Wysocki" , Doug Anderson , Will Deacon , "linux-kernel@vger.kernel.org" , Paul Gortmaker , John Stultz , "olof@lixom.net" , Santosh Shilimkar , Shawn Guo , Sonny Rao , Richard Zhao , "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 Thu, 8 May 2014, Russell King - ARM Linux wrote: > If you're in a preempt or SMP environment, provide a timer for udelay(). > IF you're in an environment with IRQs which can take a long time, use > a timer for udelay(). If you're in an environment where the CPU clock > can change unexpectedly, use a timer for udelay(). Longer delays are normally not a problem. If they are, then simply disabling IRQs may solve it if absolutely required. With much shorter delays than expected this is another story. What about the following: Nicolas diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index 7c4fada440..10030cc5a0 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c @@ -682,6 +682,15 @@ static int cpufreq_callback(struct notifier_block *nb, cpufreq_scale(per_cpu(l_p_j_ref, cpu), per_cpu(l_p_j_ref_freq, cpu), freq->new); + /* + * Another CPU might have called udelay() just before LPJ + * and a shared CPU clock is increased. That other CPU still + * looping on the old LPJ value would return significantly + * sooner than expected. The actual fix is to provide a + * timer based udelay() implementation instead. + */ + if (freq->old < freq->new) + pr_warn_once("*** udelay() on SMP is racy and may be much shorter than expected ***\n"); } return NOTIFY_OK; }