Closed zacaway closed 2 years ago
@zacaway Are you running in a VM?
Yes, I am running under Xen.
It must have a buggy implementation of its cpuid emulation, then.
Is it possible for you to insert this:
@@ -848,6 +858,11 @@ func (c *CPUInfo) cacheSize() {
if typ == 0 {
return
}
+ fmt.Printf("EAX: 0x%08x, EBX: 0x%08x, ECX: 0x%08x; ", eax, ebx, ecx)
+ fmt.Println("type", typ, "size:", size)
+ if i > 100 {
+ return
+ }
switch level {
case 1:
I need a secondary break condition.
The docs specify that EAX low 4==0 bits indicates that there are no more (page 33).
(I will need the output to look at a fix)
Hi, here is the output (from running cmd/cpuid/main.go
with that patch):
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
EAX: 0x00004121, EBX: 0x01c0003f, ECX: 0x0000003f; type 1 size: 32768
Name: AMD Ryzen 7 5700G with Radeon Graphics
Vendor String: AuthenticAMD
Vendor ID: AMD
PhysicalCores: 16
Threads Per Core: 2
Logical Cores: 32
CPU Family 25 Model: 80
Features: ADX,AESNI,AVX,AVX2,BMI1,BMI2,CLMUL,CLZERO,CMOV,CMPXCHG8,CX16,ERMS,F16C,FMA3,FXSR,FXSROPT,HTT,HYPERVISOR,LAHF,LZCNT,MMX,MMXEXT,MOVBE,MSR_PAGEFLUSH,NX,OSXSAVE,POPCNT,RDRAND,RDSEED,RDTSCP,SCE,SEV,SEV_64BIT,SEV_ALTERNATIVE,SEV_DEBUGSWAP,SEV_ES,SEV_RESTRICTED,SHA,SME,SSE,SSE2,SSE3,SSE4,SSE42,SSE4A,SSSE3,VTE,X87,XGETBV1,XSAVE,XSAVEC,XSAVEOPT,XSAVES
Microarchitecture level: 3
Cacheline bytes: 64
L1 Instruction Cache: 32768 bytes
L1 Data Cache: 32768 bytes
L2 Cache: 524288 bytes
L3 Cache: -1 bytes
Thanks
ok, this is buggy, unless you have endless level 1 data cache :)
Seems like it just ignores ECX value given, which should return different cache levels.
Great, thanks. Yes, I don't think I have an infinite cache unfortunately :)
Thanks for the help.
You can try the cpuid of the latest release: https://github.com/klauspost/cpuid/releases/tag/v2.0.14 - should catch your case.
I will upstream if you can confirm it works.
I've tested v2.0.14 and can confirm it is working. Many thanks!
Found this as it affects minio, which uses cpuid, but it is easily reproducible just using the example program. Running that example program on my machine hangs for about an hour, then the program continues normally. Seems to be due to this for-loop which loops about 4 billion times on my machine.
Here is my CPU spec (from
/proc/cpuinfo
) if it helps: