From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932164AbcGCTLE (ORCPT ); Sun, 3 Jul 2016 15:11:04 -0400 Received: from pandora.armlinux.org.uk ([78.32.30.218]:54540 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932139AbcGCTLB (ORCPT ); Sun, 3 Jul 2016 15:11:01 -0400 Date: Sun, 3 Jul 2016 20:10:51 +0100 From: Russell King - ARM Linux To: Andrew Lunn Cc: Jon Masters , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Jon Mason Subject: Re: [RFC 0/1] ARM: print MHz in /proc/cpuinfo Message-ID: <20160703191051.GM1041@n2100.armlinux.org.uk> References: <1465333713-14339-1-git-send-email-jon.mason@broadcom.com> <20160607221809.GP1041@n2100.armlinux.org.uk> <32b30c50-4712-568e-4044-9f533ca497b2@jonmasters.org> <20160703165431.GL1041@n2100.armlinux.org.uk> <20160703184945.GB9421@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160703184945.GB9421@lunn.ch> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jul 03, 2016 at 08:49:45PM +0200, Andrew Lunn wrote: > On Sun, Jul 03, 2016 at 05:54:31PM +0100, Russell King - ARM Linux wrote: > > Right, so having read all your email, there's no reason why we couldn't > > just print: > > > > cpu MHz : 99999999.999 > > Since it is a float, how about using the value NaN? I think that > nicely summaries it is a useless value. ;) > However, i agree, we first need a technical justification for needing > a value at all. The only case where we've had a userspace "failure" is with the Jack audio server, which wanted to parse the cpu MHz value to use it in this calculation: static jack_time_t jack_get_microseconds_from_cycles (void) { return get_cycles() / __jack_cpu_mhz; } Now, let's say that we did provide the CPU MHz, so __jack_cpu_mhz reflects this value. Great, Jack can initialise this value, but there's two fundamental problems: 1. Jack is not aware of cpufreq, so the CPU MHz value it read at one point in time may not be the current CPU MHz - the CPU frequency can change at any moment depending on the governor's decisions. 2. get_cycles()... we have no userspace accessible CPU cycle counters on 32-bit ARM, which means knowing the CPU MHz for use like this gets you nowhere as get_cycles() can't return the number of CPU cycles. It certainly can't return a number based on the CPU MHz. Hence why this change to jack was the only sane thing to do: https://github.com/jackaudio/jack2/commit/d425d8035b761b4a362c538c41eca874ff4 This wasn't even a kernel regression - the kernel never provided the value on ARM, and in many cases the kernel doesn't know the right value (as I've said previously in this thread.) -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net.