On Fri, 28 Jan 2011, Ralf Baechle wrote:
> 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
Right. We had this discussion on x86 over and over and using a
vsyscall is the correct approach. That's also a huge win in general if
you can avoid going into the kernel to read the time. gettimeofday()
and clock_gettime() belong to the most frequently called syscalls on
any Linux system.