In some recent commercial virtual machine environments cache line of 0 was actually spotted and that resulted in panics and failures of GDM to initialize leading to the SAD SCREEN. The code used to provide default nonzero cache line size should be also used in case when CPU cache line size is extracted from CPUID leaf 0x80000006. The following correction is suggested: src/gallium/auxiliary/util/u_cpu_detect.c: ... void util_cpu_detect(void) if (regs[0] >= 0x80000006) { cpuid(0x80000006, regs2); + if (cacheline > 0) util_cpu_caps.cacheline = regs2[2] & 0xFF; }
The bug exists since 9.2.5 and in the most recent versions of the project.
Sorry, the correct code would be something like: if (regs[0] >= 0x80000006) { cpuid(0x80000006, regs2); + if ((regs2[2] & 0xFF) > 0) util_cpu_caps.cacheline = regs2[2] & 0xFF; }
I'm wondering if we actually should use this detection method if the other one (which queries clflush size in fact) is also available. I guess though there's some (amd) cpus where the other method isn't available. Not sure what's the better method to use in any case if both are available (might even provide the same number on all existing cpus). Regardless, the patch looks good.
In virtual environments you would never know which is the safest method. It depends on the implementation and correctness of the hypervisor. I would just add the suggested fix and wait to see if any new related issues will be reported.
Fixed by 5fea39ace311723dab53460ae7b51b80746e0d3f.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.