Received: by 10.223.164.202 with SMTP id h10csp2083302wrb; Thu, 16 Nov 2017 09:05:58 -0800 (PST) X-Google-Smtp-Source: AGs4zMa0A2h9FZU+pyKq+9IYhZKprcOQB8L2tV5tl53BwYYAJr9oEPeICPF+Xr5FKwgYXXWCSsiS X-Received: by 10.101.67.66 with SMTP id k2mr2276257pgq.20.1510851957984; Thu, 16 Nov 2017 09:05:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510851957; cv=none; d=google.com; s=arc-20160816; b=xMqDl4oBfO0PXUwkkP+9RWkSjTKFx1wZRzPJD47z6amINISPL2UN7/RdrqAWr5uSqr cd75DjgxTfq5f449fZbqMV45KReV4FFzRKPcRw3Gs6YrjfmliPWdxFpLpkItLnvMC2x0 zNr4igczUOjlEvWOxqQIZGkmBKoZfaMxREH/l25eG+vQmHPHVRDdBHjjnS6f2PMQrk6i T2KGyRf76o8IhEYWsf4YmUpZSvR/+IcNkIuOSCpyTqYloh+76TmZzYHF2Rov197A2Xj8 u5SkxClG76lC1GSZ8dXYqBtNpkMgHiKIbuaMxa09TeonnPk6H6HyeBcwSvBS+y6k21lC 8WsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=EFEMchlMkR8Gbe9FsfaUbBiwBrS8CjWUnVsxEOIEdu0=; b=WBD1j2tt1zUT/VhkMRLauslQhK4jQ9jVlaEqakSruKu/4dNglRfbB/T7OzTJoSqDhG 6jNi4nMMLp8BEie1WspcTphoefIzcd+NqiR2tjYg90oW/fgqLJkFvFYVUzQRLtqH+gr0 LD1QMdehL7hMNziBApHROssMr/lK3ZfXCYWdzgMAn/fWVd7PjWa4x5XouDS83matRAOt JBuTga4GzYOmEWz84XmYyTpNjjARpgAJqkqXn4V+PefifkKbH+untrNxPmQkoiOXvqBD YGE7L1+113PoKcYFhzKYraL3VaWB2fncbNO/Ku5Hnatud7KO0DHBswUBoB7i0aFKtMuQ mVjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@armlinux.org.uk header.s=pandora-2014 header.b=rDpeybfD; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ay6si1169886plb.336.2017.11.16.09.05.44; Thu, 16 Nov 2017 09:05:57 -0800 (PST) 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=fail header.i=@armlinux.org.uk header.s=pandora-2014 header.b=rDpeybfD; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935619AbdKPPgp (ORCPT + 91 others); Thu, 16 Nov 2017 10:36:45 -0500 Received: from pandora.armlinux.org.uk ([78.32.30.218]:47440 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933485AbdKPPgk (ORCPT ); Thu, 16 Nov 2017 10:36:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2014; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=EFEMchlMkR8Gbe9FsfaUbBiwBrS8CjWUnVsxEOIEdu0=; b=rDpeybfDtOqsDjtZ4L1louipTXcaxjfpkOerWfK8/iNcCIkJPwqSoJcL/bqAghFdpYPkkaPsaKPnCHBeBr4rShuUan1aSZj5wMU92QRjfGoQ4Gm6MOyy4HlSefyxlfi+SCUP64Dx0n89oaR5WJrAbIyvkwwIXkem8hpiThZdkuo=; Received: from n2100.armlinux.org.uk ([fd8f:7570:feb6:1:214:fdff:fe10:4f86]:59795) by pandora.armlinux.org.uk with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1eFMDN-0007KT-64; Thu, 16 Nov 2017 15:36:29 +0000 Received: from linux by n2100.armlinux.org.uk with local (Exim 4.76) (envelope-from ) id 1eFMDK-00026E-0L; Thu, 16 Nov 2017 15:36:26 +0000 Date: Thu, 16 Nov 2017 15:36:25 +0000 From: Russell King - ARM Linux To: Marc Gonzalez Cc: Linus Torvalds , Alan Cox , LKML , Linux ARM , Steven Rostedt , Ingo Molnar , Thomas Gleixner , Peter Zijlstra , John Stultz , Douglas Anderson , Nicolas Pitre , Mark Rutland , Will Deacon , Jonathan Austin , Arnd Bergmann , Kevin Hilman , Michael Turquette , Stephen Boyd , Boris Brezillon , Thibaud Cornic , Mason Subject: Re: [RFC] Improving udelay/ndelay on platforms where that is possible Message-ID: <20171116153625.GJ31757@n2100.armlinux.org.uk> References: <20171101175325.2557ce85@alans-desktop> <4b707ce0-6067-ab36-e167-1acf348d26bf@free.fr> <11393e07-b042-180c-3bcd-484bf51eada6@sigmadesigns.com> <20171115131351.GE31757@n2100.armlinux.org.uk> <1fa81694-7bd2-564b-e5b9-ae53b9ea6620@sigmadesigns.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1fa81694-7bd2-564b-e5b9-ae53b9ea6620@sigmadesigns.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 16, 2017 at 04:26:51PM +0100, Marc Gonzalez wrote: > On 15/11/2017 14:13, Russell King - ARM Linux wrote: > > > udelay() needs to offer a consistent interface so that drivers know > > what to expect no matter what the implementation is. Making one > > implementation conform to your ideas while leaving the other > > implementations with other expectations is a recipe for bugs. > > > > If you really want to do this, fix the loops_per_jiffy implementation > > as well so that the consistency is maintained. > > Hello Russell, > > It seems to me that, when using DFS, there's a serious issue with loop-based > delays. (IIRC, it was you who pointed this out a few years ago.) > > If I'm reading arch/arm/kernel/smp.c correctly, loops_per_jiffy is scaled > when the frequency changes. > > But arch/arm/lib/delay-loop.S starts by loading the current value of > loops_per_jiffy, computes the number of times to loop, and then loops. > If the frequency increases when the core is in __loop_delay, the > delay will be much shorter than requested. > > Is this a correct assessment of the situation? Absolutely correct, and it's something that people are aware of, and have already catered for while writing their drivers. > (BTW, does arch/arm/lib/delay-loop.S load the per_cpu loops_per_jiffy > or the system-wide variable?) > > Should loop-based delays be disabled when CPUFREQ is enabled? What about platforms (and there are those in the kernel today) which have CPUFREQ enabled and also have no timer based delay registered? These rely on using the delay loop mechanism today. What this means is you can't just "turn off" loop-based delays just because CPUFREQ is enabled, because that's going to cause regressions. -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up According to speedtest.net: 8.21Mbps down 510kbps up From 1584168277148459169@xxx Wed Nov 15 21:16:38 +0000 2017 X-GM-THRID: 1582790467810046578 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread