linux-mips
[Top] [All Lists]

Re: Publishing mips_hpt_frequency in /proc/cpuinfo

To: Earl Chew <echew@ixiacom.com>
Subject: Re: Publishing mips_hpt_frequency in /proc/cpuinfo
From: Ralf Baechle <ralf@linux-mips.org>
Date: Fri, 28 Jan 2011 11:57:20 +0100
Cc: linux-mips@linux-mips.org, Thomas Gleixner <tglx@linutronix.de>
In-reply-to: <4D424D4B.5090002@ixiacom.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <4D424D4B.5090002@ixiacom.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.5.21 (2010-09-15)
On Thu, Jan 27, 2011 at 08:59:55PM -0800, Earl Chew wrote:

> The CPU frequency is known to the Linux kernel. For example:
> 
> > CPU revision is: 00019374 (MIPS 24Kc)
> > Atheros AR7161 rev 2, CPU:680.000 MHz, AHB:170.000 MHz, DDR:340.000 MHz
> > ...
> > Calibrating delay loop... 452.19 BogoMIPS (lpj=2260992)
> 
> Unfortunately that information is not available from userspace:
> 
> > cpu model               : MIPS 24Kc V7.4
> > BogoMIPS                : 452.19
> 
> This makes it difficult to use CPU timers (rdhwr) from user space
> applications.
> 
> 
> Is there any reason not to publish mips_hpt_frequency in /proc/cpuinfo ?

The CPU clock frequency may change at any time due to clockscaling  A
process might be rescheduled to another CPU running at a different clock
rate.  A suspended process might miss counter wraparounds.

This right approach is to handle this in a virtual syscall, something like
vsys_clock_gettime().

  Ralf

<Prev in Thread] Current Thread [Next in Thread>