svn commit: r220584 - in head/sys: amd64/amd64 i386/i386

Garrett Cooper yanegomi at gmail.com
Wed Apr 13 22:29:04 UTC 2011


On Wed, Apr 13, 2011 at 2:49 PM, Dimitry Andric <dim at freebsd.org> wrote:
> On 2011-04-13 23:41, Dimitry Andric wrote:
> ...
>>
>> But I don't really see why, yet. :)  With r220532, it worked fine.
>
> Ah, I failed to notice the commit that came before, r220583.
> Apparently, it can happen (at least in a VM environment) that the
> DELAY(1000) in this fragment from cpu_est_clockrate():
>
>                wrmsr(MSR_MPERF, 0);
>                wrmsr(MSR_APERF, 0);
>                tsc1 = rdtsc();
>                DELAY(1000);
>                mcnt = rdmsr(MSR_MPERF);
>                acnt = rdmsr(MSR_APERF);
>                tsc2 = rdtsc();
>                intr_restore(reg);
>                perf = 1000 * acnt / mcnt;
>
> will still read 0 from MSR_MPERF, leading to a division by zero.  Maybe
> just fallback to the second method in the 'else' branch then?

    Yeah, it kind of peeves me that this kind of rinky dink stuff is
done with VMware ESXi, etc (fake RAM returning 0MHz in the SMBIOS
table in certain scenarios).
Thanks,
-Garrett


More information about the svn-src-all mailing list