Dr-Noob / cpufetch

Simple yet fancy CPU architecture fetching tool
GNU General Public License v2.0
1.83k stars 100 forks source link

Bhyve: Unknown hypervisor vendor #193

Closed Tectu closed 8 months ago

Tectu commented 10 months ago

Running cpufetch in a bhyve VM (FreeBSD) prints:

[ERROR]: Unknown hypervisor vendor: bhyve bhyve 
[VERSION]: cpufetch v1.04 (FreeBSD x86_64 build)
Please, create a new issue with this error message, the output of 'cpufetch' and 'cpufetch --debug' on https://github.com/Dr-Noob/cpufetch/issues

Output of cpufetch:

Name:                Intel Xeon E5-2680
Hypervisor:          Unknown
Microarchitecture:   Sandy Bridge
Technology:          32nm
Max Frequency:       Unknown
Sockets:             2
Cores:               7 cores (14 threads)
Cores (Total):       14 cores (28 threads)
AVX:                 AVX
FMA:                 No
L1i Size:            32KB (448KB Total)
L1d Size:            32KB (448KB Total)
L2 Size:             256KB (3.5MB Total)
L3 Size:             20MB (40MB Total)
Peak Performance:    Unknown                                                       

Output of cpufetch --debug:

Intel(R) Xeon(R) CPU E5-2680 0 @ 2.70GHz
- Hypervisor: Unknown
- Max standard level: 0x0000000D
- Max extended level: 0x80000008
- Hybrid Flag: 0
- CPUID dump: 0x000206D7

On bare metal, cpufetch works well under FreeBSD (from what I can tell). If it helps: I'm the FreeBSD port maintainer of cpufetch.

Dr-Noob commented 9 months ago

Interesting! Patch 45854a0 should have fixed it.

Tectu commented 9 months ago

Doesn't look like it (cpufetch built from bc9b9c1e99040db1b82f75e6d12517eb17704e95):

root@vm01:~/cpufetch # ./cpufetch --debug
[ERROR]: Unknown hypervisor vendor: bhyve bhyve 
[VERSION]: cpufetch v1.04-18-gbc9b (FreeBSD x86_64 build)
Please, create a new issue with this error message, the output of 'cpufetch' and 'cpufetch --debug' on https://github.com/Dr-Noob/cpufetch/issues
cpufetch v1.04-18-gbc9b (FreeBSD x86_64 build)
Intel(R) Xeon(R) CPU E5-2680 0 @ 2.70GHz
- Hypervisor: Unknown
- Max standard level: 0x0000000D
- Max extended level: 0x80000008
- Hybrid Flag: 0
- CPUID dump: 0x000206D7
Dr-Noob commented 9 months ago

Can you try with the latest commit in bugfix4 branch?

Tectu commented 9 months ago

That one appears to be working.

I checked the commit and... I don't even want to ask :D If you can tell me where/how cpufetch queries that string from the system I can have a look at the FreeBSD bhyve implementation to check whether there is a stray whitespace for no good reason (I doubt it tho, but it's easy to check).

Dr-Noob commented 9 months ago

Yeah, it's quite strange :sweat_smile:

cpufetch runs the cpuid instruction and fetches the hypervisor level (0x40000000). You can find more details here: https://www.sandpile.org/x86/cpuid.htm#level_4000_0000h. Then it converts the hex from EBX-ECX-EDX into a string (using get_name_cpuid) and compares against the list in hv_vendors_string. Let me know if you find anything interesting!

Tectu commented 8 months ago

Unfortunately, I won't be able to dive into this any time soon. I'd propose that the working commit gets merged.

Dr-Noob commented 8 months ago

Unfortunately, I won't be able to dive into this any time soon. I'd propose that the working commit gets merged.

Sure, maybe we'll have another opportunity to investigate the issue further in the future