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: 29875 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f197.google.com (mail-ig0-f197.google.com [209.85.213.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6E0E5202DD for ; Fri, 9 May 2014 01:38:02 +0000 (UTC) Received: by mail-ig0-f197.google.com with SMTP id hn18sf1594069igb.8 for ; Thu, 08 May 2014 18:38:02 -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:date:from:to:cc:subject:in-reply-to :message-id:references:user-agent:mime-version:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe :content-type; bh=aq7PcGq0HRPmkqJl94IU9NnAn7/WWBsvlHHR6yWW+IE=; b=QMDkUGXz1cRXdrHbVL7UjNL7TCxiZA5ULmjpMV/RAJyraWNmDKk1XvaPmsBSTj9aFs XDC1Wp63BdTc4Bg9lQFY0ihUPxs8fAWtzQfGudj5j5vBicJBzXttieqEDWK+x5GPRmoY xC9DI5COeGCna52CH4sXNfKkzoO3rlGJHm69uWLmj8m4MfAX8rSVPDA0Df4/kI1YmxkI EszjlQjf5uRviFY6hlKsraAd6Ww0n8+IouSQLGv6MXMeonds1tNHGVQQ9rYhfTHo+uQF F7OMvLav05edWH6YSqhY4/wHhRs/zBm/nbJcFnEx00Y4IEMp4byJ9GuINCNmiGQAd/WD RNOw== X-Gm-Message-State: ALoCoQlRExxIaQHTKNCMK5Z3wruxoCrFZVTCA6Y1R6GRdjk4sePcqO583emsY8LtNqGx6VcyZpQb X-Received: by 10.182.104.200 with SMTP id gg8mr3724503obb.45.1399599481990; Thu, 08 May 2014 18:38:01 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.107.97 with SMTP id g88ls97144qgf.40.gmail; Thu, 08 May 2014 18:38:01 -0700 (PDT) X-Received: by 10.58.111.163 with SMTP id ij3mr5668155veb.26.1399599481887; Thu, 08 May 2014 18:38:01 -0700 (PDT) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx.google.com with ESMTPS id eb17si463311veb.130.2014.05.08.18.38.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 08 May 2014 18:38:01 -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.220.175; Received: by mail-vc0-f175.google.com with SMTP id hu19so1378853vcb.34 for ; Thu, 08 May 2014 18:38:01 -0700 (PDT) X-Received: by 10.220.92.135 with SMTP id r7mr5630230vcm.11.1399599481817; Thu, 08 May 2014 18:38:01 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp39018vcb; Thu, 8 May 2014 18:38:01 -0700 (PDT) X-Received: by 10.66.171.206 with SMTP id aw14mr14459193pac.48.1399599480599; Thu, 08 May 2014 18:38:00 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id db3si1395593pbc.316.2014.05.08.18.37.30; Thu, 08 May 2014 18:37:30 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754656AbaEIBhV (ORCPT + 27 others); Thu, 8 May 2014 21:37:21 -0400 Received: from mail-qc0-f172.google.com ([209.85.216.172]:59598 "EHLO mail-qc0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751924AbaEIBhT (ORCPT ); Thu, 8 May 2014 21:37:19 -0400 Received: by mail-qc0-f172.google.com with SMTP id l6so3947509qcy.31 for ; Thu, 08 May 2014 18:37:18 -0700 (PDT) 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 cc: Doug Anderson , Viresh Kumar , "Rafael J. Wysocki" , Will Deacon , John Stultz , David Riley , "olof@lixom.net" , Sonny Rao , Richard Zhao , Santosh Shilimkar , Shawn Guo , Stephen Boyd , Marc Zyngier , Stephen Warren , Paul Gortmaker , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: nicolas.pitre@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 Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 --- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ 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; }