Bug 192470 - [bhyve] can't boot FreeBSD in bhyve on CURRENT
Summary: [bhyve] can't boot FreeBSD in bhyve on CURRENT
Status: Closed Works As Intended
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-virtualization (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-07 16:06 UTC by Nikolai Lifanov
Modified: 2014-09-13 00:40 UTC (History)
2 users (show)

See Also:


Attachments
9.3-RELEASE boot failure on 11.0-CURRENT r269644 (339 bytes, text/plain)
2014-08-07 16:06 UTC, Nikolai Lifanov
no flags Details
sysctl hw.vmm (781 bytes, text/plain)
2014-08-27 13:38 UTC, Nikolai Lifanov
no flags Details
panic booting CURRENT (2.43 KB, text/plain)
2014-08-27 13:39 UTC, Nikolai Lifanov
no flags Details
dmesg from CURRENT boot (4.23 KB, text/plain)
2014-08-27 15:56 UTC, Nikolai Lifanov
no flags Details
cpuid difference (2.63 KB, text/plain)
2014-08-28 00:41 UTC, Nikolai Lifanov
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nikolai Lifanov 2014-08-07 16:06:27 UTC
Created attachment 145450 [details]
9.3-RELEASE boot failure on 11.0-CURRENT r269644

When trying to boot FreeBSD 9.3-RELEASE or 10.0-RELEASE ISO in bhyve on 11.0-CURRENT r269644, I get "panic: CPU0 does not support X87 or SSE: 1".
I tried the plainest possible configuration, using the sample vmrun.sh script.

Booting Linux on my CURRENT machine works. Booting 9.3-RELEASE in bhyve on 10.0-RELEASE works. I'm not sure when this broke for me and it could have been months ago. I can help bisect or diagnose this if I'm pointed to some place to start.

Full console log trying to boot 9.3-RELEASE on 11.0-CURRENT is attached.
Comment 1 Nikolai Lifanov 2014-08-07 16:22:09 UTC
Host CPU info from dmesg:

CPU: Intel(R) Xeon(R) CPU E31235 @ 3.20GHz (3200.09-MHz K8-class CPU)
  Origin="GenuineIntel"  Id=0x206a7  Family=0x6  Model=0x2a  Stepping=7
  Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,C
MOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
  Features2=0x1fbae3ff<SSE3,PCLMULQDQ,DTES64,MON,DS_CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,TSCDLT,AESNI,XSAVE,OSXSAVE,AVX>
  AMD Features=0x28100800<SYSCALL,NX,RDTSCP,LM>
  AMD Features2=0x1<LAHF>
  VT-x: PAT,HLT,MTF,PAUSE,EPT,UG,VPID
  TSC: P-state invariant, performance statistics
Comment 2 Nikolai Lifanov 2014-08-27 13:38:50 UTC
Created attachment 146376 [details]
sysctl hw.vmm

output of "sysctl hw.vmm"
Comment 3 Nikolai Lifanov 2014-08-27 13:39:31 UTC
Created attachment 146377 [details]
panic booting CURRENT

This is trying to boot CURRENT snapshot, r270458
Comment 4 Nikolai Lifanov 2014-08-27 15:56:15 UTC
Created attachment 146380 [details]
dmesg from CURRENT boot

The boot sometimes works. Trying to boot CURRENT over and over again, I was able to boot it twice out of many tries. Here is a dmesg output from a successful boot.

If FreeBSD boots, it works normally.
Comment 5 Nikolai Lifanov 2014-08-27 16:02:04 UTC
Since booting actually works once in a while, I tried pinning vcpu 0 to hostcpu 0.
If I pin vcpu 0 to hostcpu 0, boot works every time.
Comment 6 Peter Grehan freebsd_committer freebsd_triage 2014-08-27 23:50:40 UTC
Just to confirm the negative: does pinning to CPUs other than 0 result in the guest crashing ?

If so, would you be able to install the cpuid port (pkg install cpuid) and run it on all cpus

cpuset -l <cpu> cpuid

.. and see if there are any differences in what is reported between CPUs, other than obvious ones such as APIC ID.

later,

Peter.
Comment 7 Nikolai Lifanov 2014-08-28 00:39:20 UTC
Pinning vcpu 0 on hostcpu 1 does not allow boot.
It seems that all cpus other than 0 produce a similar diff.
I'm about to attach it.
Comment 8 Nikolai Lifanov 2014-08-28 00:41:00 UTC
Created attachment 146425 [details]
cpuid difference
Comment 9 Peter Grehan freebsd_committer freebsd_triage 2014-08-28 01:26:29 UTC
Comment on attachment 146425 [details]
cpuid difference

Thanks - I think this explains it.

-Vendor ID: "GenuineIntel"; CPUID level 13
+Vendor ID: "GenuineIntel"; CPUID level 2

The AP is coming up with a reduced number of CPU leaves compared to the BSP. FreeBSD (and bhyve) assumes that this is the same in all CPUs. FreeBSD itself pulls all information about the system from the BSP's leaf contents, and then assumes this is the same for all other CPUs.

bhyve's assumption is that it can call do_cpuid() on any CPU and get the
same information to pass to guests on CPUID exits.

A lot of applications also assume this and will look at CPUID values to determine whether they can use SSE/SSE2/AVX libraries etc.

What system is this ? Are there BIOS options to change max leaf values ? Is
it running nested ?

later,

Peter.
Comment 10 Nikolai Lifanov 2014-08-28 16:50:19 UTC
This is exactly it!

I had a BIOS setting called "Limit Max CPUID".
After I turned it off, every core shows the same features and bhyve works reliably.

It's still interesting that bhyve works despite this misconfiguration in 10.0, but not on CURRENT.
Comment 11 Nikolai Lifanov 2014-09-13 00:40:02 UTC
This issue can be closed. It's not valuable to fix, but anyone with a similar problem can find this bug report.