FreeBSD-amd64 fails to start with SMP on quemu-kvm

Artur Samborski
2013-01-07T17:23:16Z

Hello,

When i try to run FreeBSD-amd64 on more than 1 vcpu in quemu-kvm (Fedora
Core 17) eg. to run FreeBSD-9.0-RELEASE-amd64 with:

qemu-kvm -m 1024m -cpu host -smp 2 -cdrom
/storage/iso/FreeBSD-9.0-RELEASE-amd64-dvd1.iso

it freezes KVM with:

KVM internal error. Suberror: 1
emulation failure
RAX=ffffffff80b0d4c0 RBX=000000000009f000 RCX=00000000c0000080
RDX=0000000000000000
RSI=000000000000d238 RDI=0000000000000000 RBP=0000000000000000
RSP=0000000000000000
R8 =0000000000000000 R9 =0000000000000000 R10=0000000000000000
R11=0000000000000000
R12=0000000000000000 R13=0000000000000000 R14=0000000000000000
R15=0000000000000000
RIP=000000000009f076 RFL=00010086 [--S--P-] CPL=0 II=0 A20=1 SMM=0 HLT=0
ES =0000 0000000000000000 0000ffff 0000f300 DPL=3 DS16 [-WA]
CS =0008 0000000000000000 00000000 00209900 DPL=0 CS64 [--A]
SS =9f00 000000000009f000 0000ffff 0000f300 DPL=3 DS16 [-WA]
DS =0018 0000000000000000 ffffffff 00c09300 DPL=0 DS [-WA]
FS =0000 0000000000000000 0000ffff 0000f300 DPL=3 DS16 [-WA]
GS =0000 0000000000000000 0000ffff 0000f300 DPL=3 DS16 [-WA]
LDT=0000 0000000000000000 0000ffff 00008200 DPL=0 LDT
TR =0000 0000000000000000 0000ffff 00008b00 DPL=0 TSS64-busy
GDT= 000000000009f080 00000020
IDT= 0000000000000000 0000ffff
CR0=80000011 CR2=0000000000000000 CR3=000000000009c000 CR4=00000030
DR0=0000000000000000 DR1=0000000000000000 DR2=0000000000000000
DR3=0000000000000000
DR6=00000000ffff0ff0 DR7=0000000000000400
EFER=0000000000000501
Code=00 00 00 80 0f 22 c0 ea 70 f0 09 00 08 00 48 b8 c0 d4 b0 80 <ff> ff
ff ff ff e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 99 20 00
ff ff 00 00

Freeze occurs immediately after FreeBSD kernel messages:

Copyright (c) 1992-2012 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 9.0-RELEASE #0: Tue Jan 3 07:46:30 UTC 2012
root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64
CPU: Intel(R) Xeon(R) CPU X5570 @ 2.93GHz (2925.91-MHz
K8-class CPU)
Origin = "GenuineIntel" Id = 0x106a5 Family = 6 Model = 1a
Stepping = 5

Features=0xf83fbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR,SSE,SSE2,SS>
Features2=0x80982201<SSE3,SSSE3,CX16,SSE4.1,SSE4.2,POPCNT,HV>
AMD Features=0x28100800<SYSCALL,NX,RDTSCP,LM>
AMD Features2=0x1<LAHF>
real memory = 1073741824 (1024 MB)
avail memory = 1011343360 (964 MB)
Event timer "LAPIC" quality 400
ACPI APIC Table: <BOCHS BXPCAPIC>

so just prior to probing of SMP.

This also applies to FreeBSD-7.3-RELEASE-amd64 and FreeBSD-9.1-RC3-amd64
(other releases not tested).

When quemu-kvm is started without SMP (1 vpcu) amd64 FreeBSD kernel
boots correctly. I did not notice this problem (SMP) for the i386
versions (FreeBSD-7.3-RELEASE-i386, FreeBSD-9.0-RELEASE-i386,
FreeBSD-9.1-RC3-i386).

Additional info:

- KVM Host OS:
Fedora Core 17

- CPUs on my KVM host -- Xeons X5570

# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 26
model name : Intel(R) Xeon(R) CPU X5570 @ 2.93GHz
stepping : 5
microcode : 0x11
cpu MHz : 2926.183
cache size : 8192 KB
physical id : 1
siblings : 8
core id : 0
cpu cores : 4
apicid : 16
initial apicid : 16
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe
syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl
xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx est tm2
ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 popcnt lahf_lm ida dtherm
tpr_shadow vnmi flexpriority ept vpid
bogomips : 5852.36
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management:

- kernel (from FC17 repo):
3.6.9 (kernel-3.6.9-2.fc17.x86_64)
- quemu version:
qemu-kvm 1.0.1 (qemu-kvm-1.0.1-2.fc17.x86_64)
- neither the -no-kvm-irqchip nor -no-kvm-pit switch helps
- with he -no-kvm switch FreeBSD boots correctly
- linux guest (x86_64 with SMP) works perfectly ok

I suspect that this bug is related in some way with the hardware. I
tested the same KVM-host system (exact clone) with the same guest
(FreeBSD-amd64) on another machine (i3-2120 workstation) and have not
noticed a similar problems witch SMP.

I will be grateful for any hints.

Regards,
Artur Samborski