Bareflank/boxy

[BUG] If the TSC info is missing, the Linux kernel will attempt to use the PIT

rianquinn opened this issue · 6 comments

If the TSC info is missing, the Linux kernel will attempt to use the PIT instead of erroring out and telling the user that the TSC info is missing and that this hardware is not supported. A serial device should not be needed to get this information.

This runtime error message requiring a serial device to be viewed is produced in PR #46 in vclock.cpp#L302.
More context on gitter.

So yeah, this code needs to report this information in some way that the Boxy VM can output a lack of support from userspace without the need for serial.

In which header would make the most sense to export the calibrate_tsc_freq_khz() function to be used by both bfexec and bfvmm?

I also tried implementing this fix by using vmcall which seemed at first like the "proper" way to do it but turns out to actually complicate things unnecessarily.
The problem with this approach is that every vcpu need to vmcall at initialization to set the tsc freq, including domU which defeats the purpose...

Huh... interesting question. Why not just move this to it's own header and implement it as a header only function that can be used to get this info?

That makes perfect sense. Should it go under bfsdk/include/bftsc.h ?

for now, yeah that sounds like a solid place to put it.