Page 1 of 1
SMBIOS for calibrating the local APIC timer
Posted: Thu Mar 15, 2018 3:51 pm
by hexcoder
What are the advantages and disadvantages of using the SMBIOS (as opposed to the PIT) for getting the external bus frequency in order to know what values to write into the local APIC timer?
It seems at first glance that the SMBIOS approach would provide greater accuracy. Perhaps a hybrid approach would be best in order to make sure the values from both are actually sane.
On a side note, is SMBIOS likely to be supported on all modern x86-64 systems (i.e, can I rely on it)?
Re: SMBIOS for calibrating the local APIC timer
Posted: Thu Mar 15, 2018 10:58 pm
by Brendan
Hi,
hexcoder wrote:What are the advantages and disadvantages of using the SMBIOS (as opposed to the PIT) for getting the external bus frequency in order to know what values to write into the local APIC timer?
It seems at first glance that the SMBIOS approach would provide greater accuracy. Perhaps a hybrid approach would be best in order to make sure the values from both are actually sane.
Imagine you're maintaining a network of many computers, the accountancy department wants various information (for insurance purposes, etc), you want to keep relevant spare parts in storage, and sometimes you want to know what is in each computer on the network (to order replacement parts and upgrade parts) without actually finding the computer and walking all over a large building to where the computer might be. You might have tools built into the OS on every computer to provide the information, network protocols (CIM, WBEM, SNMP) and an application or database somewhere. This is what SMBIOS is intended for - to provide information to an asset management system.
It was never intended for any OS initialisation purposes (there are other standards/techniques that are designed for that, like ACPI). Using SMBIOS to determine local APIC's frequency (by making random assumptions like "local APIC frequency = bus frequency") is a little bit like using a hammer to spread jam on your toast even though a normal knife (that is the right tool for the job) is easier to find than a hammer.
Of course even for its intended purpose SMBIOS is relatively awful (e.g. provides no information on anything that isn't built into the motherboard, suffers from "design by committee" problems, etc), and because it's only really used by large companies the information it provides is often dodgy anyway (especially for cheap/home/gamer systems that aren't used by large companies).
hexcoder wrote:On a side note, is SMBIOS likely to be supported on all modern x86-64 systems (i.e, can I rely on it)?
It's very likely that it will exist on all "PC compatible" 80x86 computers made in the last 20 years or so (but "exists" isn't quite the same as "reliable").
Cheers,
Brendan
Re: SMBIOS for calibrating the local APIC timer
Posted: Sat Mar 17, 2018 2:17 pm
by hexcoder
Okay, thanks for the information.
Guess I'll just use the PIT then. I was just hoping for a more 'accurate' method, but I suppose this'll do. I'll also update the wiki to emphasise what you said.