Regression: 11184 causes kernel hang during boot on CPUs without ARAT
I have an old box running openindiana hipster. Recently after a pkg update, the machine hung at boot. Disabling ACPI in the bootloader works around the issue. Looking between the illumos-gate commit hashes, "11184 Want CPU Temperature Sensors" stood out. Compiling a non-incremental build of this commit and the previous commit confirmed that this was where the regression was introduced. The issue occurs whether or not pkg:/driver/cpu/sensor is installed, so I was able to isolate the issue fairly quickly. An explanation is below and a patch is attached.
cpuid_pass2 clobbers the cached cpuid result cp->cp_eax with the leaf number when it skips leaves 6 and 7. The result of this is that the cached eax for leaf 6 becomes 6 == CPUID_INTC_EAX_ARAT | CPUID_INTC_EAX_TURBO. So cpuid_arat_supported always returns true on intel processors (at least if it's called after cpuid_pass2). This appears to cause the boot hang I experienced on Intel processors without ARAT support unless ACPI is disabled.
None of the other callers of cpuid_insn appear to use the eax register for leaves 6 or 7, so I don't think any processors other than Intel processors without ARAT support are affected by this bug or patch, except users of the cpuid driver.