Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Feb 2019 15:00:22 -0700
From:      John Nielsen <lists@jnielsen.net>
To:        Christian Kratzer <ck@cksoft.de>
Cc:        "virtualization@freebsd.org" <virtualization@FreeBSD.org>
Subject:   Re: 12.0-RELEASE und kvm/qemu using <cpu mode='host-model' check='partial'> on AMD EPYC
Message-ID:  <A84F1AAF-02D2-4B2A-9E59-98886767763E@jnielsen.net>
In-Reply-To: <alpine.BSF.2.21.9999.1902111418120.835@nocfra1.cksoft.de>
References:  <alpine.BSF.2.21.9999.1902111418120.835@nocfra1.cksoft.de>

next in thread | previous in thread | raw e-mail | index | archive | help
> On Feb 11, 2019, at 6:32 AM, Christian Kratzer <ck-lists@cksoft.de> =
wrote:
>=20
> I am running freebsd vm on debian 10 buster with libvirt/kvm/qemu.
>=20
> I have several kvm hosts in the cluster.  Some with various intel xeon =
and others with AMD EPYC 7301 cpu.
>=20
> FreeBSD vms upto 11.2-RELEASE-p9 boo fine on all systems when passing =
through the host cpu using following libvirt xml
>=20
>  <cpu mode=3D'host-model' check=3D'partial'>
>    <model fallback=3D'allow'/>
>  </cpu>

Probably not the same issue, but this sounds similar to this bug I =
reported a few years ago:
https://bugs.launchpad.net/qemu/+bug/1329956

It's just as likely to be a bug in Qemu or KVM as it is in FreeBSD IMO. =
Maybe you can start by determining which CPU feature or features =
trigger(s) the issue. You'll have to hand-roll either some libvirt XML =
or qemu command lines to do it. Assuming you want to stick with XML, =
first grab the CPU model and features list from `virsh capabilities`. =
Then start with just the model without any extra features (using AMD =
hardware I have access to as an example, replace "Opteron_G3" as =
appropriate):

  <cpu mode=3D'custom' match=3D'exact' check=3D'partial'>
    <model fallback=3D'forbid'>Opteron_G3</model>
    <topology sockets=3D'1' cores=3D'2' threads=3D'1'/>
  </cpu>

If that works, then add the other features a few at a time until you =
break it. Here's an example feature list from my same hardware.

  <cpu mode=3D'custom' match=3D'exact' check=3D'partial'>
    <model fallback=3D'forbid'>Opteron_G3</model>
    <topology sockets=3D'1' cores=3D'2' threads=3D'1'/>
    <feature name=3D'vme'/>
    <feature name=3D'ht'/>
    <feature name=3D'mmxext'/>
    <feature name=3D'fxsr_opt'/>
    <feature name=3D'pdpe1gb'/>
    <feature name=3D'3dnowext'/>
    <feature name=3D'3dnow'/>
    <feature name=3D'cmp_legacy'/>
    <feature name=3D'extapic'/>
    <feature name=3D'cr8legacy'/>
    <feature name=3D'3dnowprefetch'/>
    <feature name=3D'osvw'/>
    <feature name=3D'ibs'/>
    <feature name=3D'skinit'/>
    <feature name=3D'wdt'/>
    <feature name=3D'nodeid_msr'/>
    <feature name=3D'invtsc'/>
  </cpu>

Once you identify the feature or features that cause things to break, =
you can report back here, look for open bugs in Qemu or KVM regarding =
those features, and/or open new bugs.

> FreeBSD 12.0-RELEASE and later hang after boot when swithcing to =
usermode in start_init: trying /sbin/init
>=20
> Following is dmesg from a succesfull boot of 12.0-RELEASE using =
host-model on Intel CPU
>=20
> 	Copyright (c) 1992-2018 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 12.0-RELEASE-p3 GENERIC amd64
> 	FreeBSD clang version 6.0.1 (tags/RELEASE_601/final 335540) =
(based on LLVM 6.0.1)
> 	VT(vga): text 80x25
> 	CPU: QEMU Virtual CPU version 2.1.0 (2400.13-MHz K8-class CPU)
> 	  Origin=3D"GenuineIntel"  Id=3D0x663  Family=3D0x6  Model=3D0x6 =
 Stepping=3D3
> 	  =
Features=3D0x783fbfd<FPU,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,=
CMOV,PAT,PSE36,MMX,FXSR,SSE,SSE2>
> 	  Features2=3D0x80a02001<SSE3,CX16,x2APIC,POPCNT,HV>
> 	  AMD Features=3D0x20100800<SYSCALL,NX,LM>
> 	  AMD Features2=3D0x1<LAHF>
> 	Hypervisor: Origin =3D "KVMKVMKVM"
> 	real memory  =3D 1073741824 (1024 MB)
> 	avail memory =3D 1000058880 (953 MB)
> 	Event timer "LAPIC" quality 100
> 	ACPI APIC Table: <BOCHS  BXPCAPIC>
> 	FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs
> 	FreeBSD/SMP: 4 package(s) x 1 core(s)
> 	...
>=20
> Following is dmesg from a succesfull boot of 12.0-RELEASE using =
host-model on the qemu virtual cpu
>=20
>=20
> 	Copyright (c) 1992-2018 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 12.0-RELEASE-p3 GENERIC amd64
> 	FreeBSD clang version 6.0.1 (tags/RELEASE_601/final 335540) =
(based on LLVM 6.0.1)
> 	VT(vga): text 80x25
> 	CPU: QEMU Virtual CPU version 2.1.0 (2200.06-MHz K8-class CPU)
> 	  Origin=3D"AuthenticAMD"  Id=3D0x663  Family=3D0x6  Model=3D0x6 =
 Stepping=3D3
> 	  =
Features=3D0x783fbfd<FPU,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,=
CMOV,PAT,PSE36,MMX,FXSR,SSE,SSE2>
> 	  Features2=3D0x80a02001<SSE3,CX16,x2APIC,POPCNT,HV>
> 	  AMD Features=3D0x20100800<SYSCALL,NX,LM>
> 	  AMD Features2=3D0x65<LAHF,SVM,ABM,SSE4A>
> 	  SVM: NAsids=3D16
> 	Hypervisor: Origin =3D "KVMKVMKVM"
> 	real memory  =3D 4294967296 (4096 MB)
> 	avail memory =3D 4099080192 (3909 MB)
> 	Event timer "LAPIC" quality 100
> 	ACPI APIC Table: <BOCHS  BXPCAPIC>
> 	FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs
> 	FreeBSD/SMP: 4 package(s) x 1 core(s)
>=20
> Following is dmesg from a succesfull boot of 11.2-RELEASE using =
host-model on AMD EPYC
>=20
> 	Copyright (c) 1992-2018 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 11.2-RELEASE-p9 #0: Tue Feb  5 15:30:36 UTC 2019
> 	    =
root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64
> 	FreeBSD clang version 6.0.0 (tags/RELEASE_600/final 326565) =
(based on LLVM 6.0.0)
> 	VT(vga): text 80x25
> 	CPU: AMD EPYC Processor (with IBPB) (2200.05-MHz K8-class CPU)
> 	  Origin=3D"AuthenticAMD"  Id=3D0x800f12  Family=3D0x17  =
Model=3D0x1  Stepping=3D2
> 	  =
Features=3D0x783fbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,=
MCA,CMOV,PAT,PSE36,MMX,FXSR,SSE,SSE2>
> 	  =
Features2=3D0xfff83203<SSE3,PCLMULQDQ,SSSE3,FMA,CX16,SSE4.1,SSE4.2,x2APIC,=
MOVBE,POPCNT,TSCDLT,AESNI,XSAVE,OSXSAVE,AVX,F16C,RDRAND,HV>
> 	  AMD =
Features=3D0x2e500800<SYSCALL,NX,MMX+,FFXSR,Page1GB,RDTSCP,LM>
> 	  AMD =
Features2=3D0x8003f7<LAHF,CMP,SVM,CR8,ABM,SSE4A,MAS,Prefetch,OSVW,PCXC>
> 	  Structured Extended =
Features=3D0x201c01ab<FSGSBASE,TSCADJ,BMI1,AVX2,SMEP,BMI2,RDSEED,ADX,SMAP,=
SHA>
> 	  XSAVE Features=3D0x7<XSAVEOPT,XSAVEC,XINUSE>
> 	  AMD Extended Feature Extensions ID EBX=3D0x2001000
> 	  SVM: NAsids=3D16
> 	Hypervisor: Origin =3D "KVMKVMKVM"
> 	real memory  =3D 4294967296 (4096 MB)
> 	avail memory =3D 4088360960 (3898 MB)
> 	Event timer "LAPIC" quality 600
> 	ACPI APIC Table: <BOCHS  BXPCAPIC>
> 	FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs
> 	FreeBSD/SMP: 4 package(s)
> 	...
>=20
>=20
> And finally following is the failing verbose boot of 12.0-RELEASE on =
AMD-EPYC
>=20
> 	Table 'FACP' at 0xbffe104e
> 	Table 'APIC' at 0xbffe10c2
> 	APIC: Found table at 0xbffe10c2
> 	APIC: Using the MADT enumerator.
> 	Copyright (c) 1992-2018 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 12.0-RELEASE-p3 GENERIC amd64
> 	FreeBSD clang version 6.0.1 (tags/RELEASE_601/final 335540) =
(based on LLVM 6.0.1)
> 	Table 'FACP' at 0xbffe104e
> 	Table 'APIC' at 0xbffe10c2
> 	Table 'HPET' at 0xbffe1152
> 	ACPI: No SRAT table found
> 	PPIM 0: PA=3D0xb8000, VA=3D0xffffffff82810000, size=3D0x8000, =
mode=3D0
> 	pmap: large map 8 PML4 slots (4096 Gb)
> 	VT(vga): text 80x25
> 	Preloaded elf kernel "/boot/kernel/kernel" at =
0xffffffff8263e000.
> 	Preloaded boot_entropy_cache "/boot/entropy" at =
0xffffffff826471d0.
> 	Table 'FACP' at 0xbffe104e
> 	FACP: Found table at 0xbffe104e
> 	Calibrating TSC clock ... TSC clock: 2200048246 Hz
> 	CPU: AMD EPYC Processor (with IBPB) (2200.05-MHz K8-class CPU)
> 	  Origin=3D"AuthenticAMD"  Id=3D0x800f12  Family=3D0x17  =
Model=3D0x1  Stepping=3D2
> 	  =
Features=3D0x783fbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,=
MCA,CMOV,PAT,PSE36,MMX,FXSR,SSE,SSE2>
> 	  =
Features2=3D0xfff83203<SSE3,PCLMULQDQ,SSSE3,FMA,CX16,SSE4.1,SSE4.2,x2APIC,=
MOVBE,POPCNT,TSCDLT,AESNI,XSAVE,OSXSAVE,AVX,F16C,RDRAND,HV>
> 	  AMD =
Features=3D0x2e500800<SYSCALL,NX,MMX+,FFXSR,Page1GB,RDTSCP,LM>
> 	  AMD =
Features2=3D0x8003f7<LAHF,CMP,SVM,CR8,ABM,SSE4A,MAS,Prefetch,OSVW,PCXC>
> 	  Structured Extended =
Features=3D0x209c01ab<FSGSBASE,TSCADJ,BMI1,AVX2,SMEP,BMI2,RDSEED,ADX,SMAP,=
CLFLUSHOPT,SHA>
> 	  XSAVE Features=3D0x7<XSAVEOPT,XSAVEC,XINUSE>
> 	  AMD Extended Feature Extensions ID EBX=3D0x2001000
> 	  SVM: Features=3D0x0
> 	Revision=3D1, ASIDs=3D16
> 	L1 2MB data TLB: 255 entries, 1-way associative
> 	L1 2MB instruction TLB: 255 entries, 1-way associative
> 	L1 4KB data TLB: 255 entries, 1-way associative
> 	L1 4KB instruction TLB: 255 entries, 1-way associative
> 	L1 data cache: 64 kbytes, 64 bytes/line, 1 lines/tag, 2-way =
associative
> 	L1 instruction cache: 64 kbytes, 64 bytes/line, 1 lines/tag, =
2-way associative
> 	L2 2MB unified TLB: 0 entries, disabled/not present
> 	L2 4KB data TLB: 512 entries, 4-way associative
> 	L2 4KB instruction TLB: 512 entries, 4-way associative
> 	L2 unified cache: 512 kbytes, 64 bytes/line, 1 lines/tag, 16-way =
associative
> 	Hypervisor: Origin =3D "KVMKVMKVM"
> 	real memory  =3D 4294967296 (4096 MB)
> 	Physical memory chunk(s):
> 	0x0000000000001000 - 0x000000000009efff, 647168 bytes (158 =
pages)
> 	0x0000000000103000 - 0x00000000001fffff, 1036288 bytes (253 =
pages)
> 	0x0000000002800000 - 0x00000000b7d44fff, 3042201600 bytes =
(742725 pages)
> 	0x0000000100000000 - 0x000000013ffe7fff, 1073643520 bytes =
(262120 pages)
> 	avail memory =3D 4099080192 (3909 MB)
> 	Table 'FACP' at 0xbffe104e
> 	Table 'APIC' at 0xbffe10c2
> 	Table 'HPET' at 0xbffe1152
> 	ACPI: No DMAR table found
> 	...
> 	...
> 	...
> 	ata0: stat0=3D0x00 err=3D0x00 lsb=3D0x00 msb=3D0x00
> 	ata0: stat1=3D0x00 err=3D0x00 lsb=3D0x00 msb=3D0x00
> 	ata0: reset tp2 stat0=3D00 stat1=3D00 devices=3D0x0
> 	ata1: reset tp1 mask=3D03 ostat0=3D00 ostat1=3D00
> 	ata1: stat0=3D0x00 err=3D0x00 lsb=3D0x00 msb=3D0x00
> 	ata1: stat1=3D0x00 err=3D0x00 lsb=3D0x00 msb=3D0x00
> 	ata1: reset tp2 stat0=3D00 stat1=3D00 devices=3D0x0
> 	Trying to mount root from ufs:/dev/vtbd0p2 [rw]...
> 	atrtc0: providing initial system time
> 	start_init: trying /sbin/init
> 	uhub0: 2 ports with 2 removable, self powered
>=20
> After that the system freezes.
>=20
> I can provide more complete information if somebody tells me what =
would be helpfull.
>=20
> How should I go about debugging this ???
>=20
> Greetings
> Christian
>=20
> --=20
> Christian Kratzer                   CK Software GmbH
> Email:   ck@cksoft.de               Wildberger Weg 24/2
> Phone:   +49 7032 893 997 - 0       D-71126 Gaeufelden
> Fax:     +49 7032 893 997 - 9       HRB 245288, Amtsgericht Stuttgart
> Mobile:  +49 171 1947 843           Geschaeftsfuehrer: Christian =
Kratzer
> Web:     http://www.cksoft.de/
> _______________________________________________
> freebsd-virtualization@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
> To unsubscribe, send any mail to =
"freebsd-virtualization-unsubscribe@freebsd.org"
>=20




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?A84F1AAF-02D2-4B2A-9E59-98886767763E>