Port-amd64 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: rdmsr(MSR_TSC) vs rdtsc



On Mon, Jan 31, 2011 at 11:21:08AM +0100, Manuel Bouyer wrote:

> I have a i586 CPU where rdmsr(MSR_TSC) doesn't work but rdtsc does.
> This is easily visible with cpu_get_tsc_freq(): with the current code
> I get random values as cpu_cc_freq; if I remplace the calls to
> rdmsr(MSR_TSC) with cpu_counter() I get the right frequency.

In case it's not clear, rdmsr(MSR_TSC) is intended to be serializing,
whereas rdtdsc need not be.
 
> How could this be fixed ? I guess we'll have to use rdmsr(MSR_TSC)
> or cpu_counter() depending on the CPU ?

How about another routine like cpu_counter_serializing() or something
that does a test and picks which one to use?
 


Home | Main Index | Thread Index | Old Index