Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Sep 2019 23:38:53 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 240475] [PATCH]: Add support for CPUID 0x16 in tsc_freq_cpuid() (TSC clock)
Message-ID:  <bug-240475-227-Npc6A4fcyA@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-240475-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-240475-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D240475

--- Comment #7 from Neel Chauhan <neel@neelc.org> ---
It's true that Linux does this (lines 660-661):

    crystal_khz =3D eax_base_mhz * 1000 *
        eax_denominator / ebx_numerator;

But in the same function, Linux returns this (line 674):

    return crystal_khz * ebx_numerator / eax_denominator;

So the numerator and denominator in crystal_khz effectively cancels out on
CPUID 0x16.

>From what I understand, Linux expects the value in kilohertz, so a multipli=
er
of 1000 works on Linux. I believe FreeBSD expects hertz, so a multiplier of
1000000 is needed.

For unit conversion of megahertz to hertz, 1000 Hz =3D 1 KHz and 1000 KHz =
=3D 1
MHz, so 1 MHz =3D 1000 KHz * 1000 Hz.

Also, using the numerator and denominator wouldn't work (I've tried that, I=
 got
a kernel panic).

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-240475-227-Npc6A4fcyA>