linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@armlinux.org.uk>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Jon Masters <jcm@jonmasters.org>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Jon Mason <jon.mason@broadcom.com>
Subject: Re: [RFC 0/1] ARM: print MHz in /proc/cpuinfo
Date: Sun, 3 Jul 2016 20:10:51 +0100	[thread overview]
Message-ID: <20160703191051.GM1041@n2100.armlinux.org.uk> (raw)
In-Reply-To: <20160703184945.GB9421@lunn.ch>

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.

  reply	other threads:[~2016-07-03 19:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-07 21:08 Jon Mason
2016-06-07 21:08 ` [RFC 1/1] " Jon Mason
2016-06-08  8:34   ` Sudeep Holla
2016-06-08 19:31     ` Jon Mason
2016-06-09  9:09       ` Sudeep Holla
2016-06-09 17:36         ` Jon Mason
2016-06-07 22:18 ` [RFC 0/1] " Russell King - ARM Linux
2016-06-07 22:58   ` Jon Mason
2016-07-02 23:58   ` Jon Masters
2016-07-03 16:54     ` Russell King - ARM Linux
2016-07-03 18:49       ` Andrew Lunn
2016-07-03 19:10         ` Russell King - ARM Linux [this message]
2016-07-18 10:02       ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160703191051.GM1041@n2100.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=andrew@lunn.ch \
    --cc=jcm@jonmasters.org \
    --cc=jon.mason@broadcom.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [RFC 0/1] ARM: print MHz in /proc/cpuinfo' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).