[Bug 236922] Virtio fails as QEMU-KVM guest with Q35 chipset on Ubuntu 18.04.2 LTS
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Sat Jan 18 08:59:30 UTC 2020
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=236922
--- Comment #49 from John Hartley <drum at graphica.com.au> ---
(In reply to John Hartley from comment #47)
Hi VirtIO'ers,
I have not got: QEMU Q35 with OVMF, VirtIO SCSI (boot device), netmap + em &
vmx.
I had to sacrifice vtnet (VirtIO networking) as it inclusion seems to break the
rest of VirtIO (if you have netmap).
Here is are key differences:
1. Remove VirtIO networking from kernel
diff sys/amd64/conf/GENERIC sys/amd64/conf/GENERIC.bak.12-1-REL
349c349
< # device vtnet # VirtIO Ethernet device
---
> device vtnet # VirtIO Ethernet device
2. Change netmap if_net.c NETMAP patch so it essentially stops VirtIO code
generation, by moving it up to stop #include <dev/virtio/network/virtio_net.h>
# diff sys/dev/netmap/if_ptnet.c sys/dev/netmap/if_ptnet.c.bak.12-1-NETMAP
88,89d87
<
< #ifdef WITH_PTNETMAP
91a90
> #ifdef WITH_PTNETMAP
here is snippet of result:
<<snip>>
...
#include <dev/netmap/netmap_mem2.h>
#ifdef WITH_PTNETMAP
#include <dev/virtio/network/virtio_net.h>
#ifndef INET
#error "INET not defined, cannot support offloadings"
#endif
...
<<end snip>>
NOTE: you could likely get same result by just remove compile from
sys/conf/files
3. Remove VirtIO network compile from sys/conf/files , but keep other VirtIO
patches
# diff sys/conf/files sys/conf/files.bak.12-1-REL
3481,3483d3480
< dev/virtio/pci/virtio_pci_if.m optional virtio_pci
< dev/virtio/pci/virtio_pci_legacy.c optional virtio_pci
< dev/virtio/pci/virtio_pci_modern.c optional virtio_pci
3485a3483
> dev/virtio/network/if_vtnet.c optional vtnet
<<snip>>
...
dev/virtio/virtio.c optional virtio
dev/virtio/virtqueue.c optional virtio
dev/virtio/virtio_bus_if.m optional virtio
dev/virtio/virtio_if.m optional virtio
dev/virtio/pci/virtio_pci.c optional virtio_pci
dev/virtio/pci/virtio_pci_if.m optional virtio_pci
dev/virtio/pci/virtio_pci_legacy.c optional virtio_pci
dev/virtio/pci/virtio_pci_modern.c optional virtio_pci
dev/virtio/mmio/virtio_mmio.c optional virtio_mmio fdt
dev/virtio/mmio/virtio_mmio_if.m optional virtio_mmio fdt
dev/virtio/block/virtio_blk.c optional virtio_blk
dev/virtio/balloon/virtio_balloon.c optional virtio_balloon
dev/virtio/scsi/virtio_scsi.c optional virtio_scsi
dev/virtio/random/virtio_random.c optional virtio_random
dev/virtio/console/virtio_console.c optional virtio_console
...
<<end snip>>
4. Replace VirtIO 12.1-RELEASE with updated VirtIO fixes from but stop VirtIO
networking
diff -q sys/dev/virtio sys/dev/virtio.bak.12-1-REL
Common subdirectories: sys/dev/virtio/balloon and
sys/dev/virtio.bak.12-1-REL/balloon
Common subdirectories: sys/dev/virtio/block and
sys/dev/virtio.bak.12-1-REL/block
Common subdirectories: sys/dev/virtio/console and
sys/dev/virtio.bak.12-1-REL/console
Common subdirectories: sys/dev/virtio/mmio and sys/dev/virtio.bak.12-1-REL/mmio
Only in sys/dev/virtio.bak.12-1-REL: network
Only in sys/dev/virtio: network.stop
Common subdirectories: sys/dev/virtio/pci and sys/dev/virtio.bak.12-1-REL/pci
Common subdirectories: sys/dev/virtio/random and
sys/dev/virtio.bak.12-1-REL/random
Common subdirectories: sys/dev/virtio/scsi and sys/dev/virtio.bak.12-1-REL/scsi
Files sys/dev/virtio/virtio.c and sys/dev/virtio.bak.12-1-REL/virtio.c differ
Files sys/dev/virtio/virtio.h and sys/dev/virtio.bak.12-1-REL/virtio.h differ
Files sys/dev/virtio/virtio_bus_if.m and
sys/dev/virtio.bak.12-1-REL/virtio_bus_if.m differ
Files sys/dev/virtio/virtio_config.h and
sys/dev/virtio.bak.12-1-REL/virtio_config.h differ
Only in sys/dev/virtio: virtio_endian.h
Files sys/dev/virtio/virtio_ids.h and sys/dev/virtio.bak.12-1-REL/virtio_ids.h
differ
Files sys/dev/virtio/virtio_if.m and sys/dev/virtio.bak.12-1-REL/virtio_if.m
differ
Files sys/dev/virtio/virtio_ring.h and
sys/dev/virtio.bak.12-1-REL/virtio_ring.h differ
Files sys/dev/virtio/virtqueue.c and sys/dev/virtio.bak.12-1-REL/virtqueue.c
differ
Only in sys/dev/virtio: virtqueue.c.ori
Files sys/dev/virtio/virtqueue.h and sys/dev/virtio.bak.12-1-REL/virtqueue.h
differ
5. Replace 12.1-RELEASE VirtIO modules config files with VirtIO batch version,
but also remove network from Makefile
# diff -q sys/modules/virtio sys/modules/virtio.bak.12-1-REL/
Files sys/modules/virtio/Makefile and sys/modules/virtio.bak.12-1-REL/Makefile
differ
Common subdirectories: sys/modules/virtio/balloon and
sys/modules/virtio.bak.12-1-REL/balloon
Common subdirectories: sys/modules/virtio/block and
sys/modules/virtio.bak.12-1-REL/block
Common subdirectories: sys/modules/virtio/console and
sys/modules/virtio.bak.12-1-REL/console
Only in sys/modules/virtio.bak.12-1-REL: network
Only in sys/modules/virtio: network.stop
Common subdirectories: sys/modules/virtio/pci and
sys/modules/virtio.bak.12-1-REL/pci
Common subdirectories: sys/modules/virtio/random and
sys/modules/virtio.bak.12-1-REL/random
Common subdirectories: sys/modules/virtio/scsi and
sys/modules/virtio.bak.12-1-REL/scsi
Common subdirectories: sys/modules/virtio/virtio and
sys/modules/virtio.bak.12-1-REL/virtio
# diff sys/modules/virtio/Makefile sys/modules/virtio.bak.12-1-REL/Makefile
2c2
< # $FreeBSD$
---
> # $FreeBSD: releng/12.1/sys/modules/virtio/Makefile 273515 2014-10-23 04:47:32Z bryanv $
26c26
< SUBDIR= virtio pci block balloon scsi random console
---
> SUBDIR= virtio pci network block balloon scsi random console
6. Use the other 12.1 netmap patches as is:
# diff sys/dev/netmap/netmap_kern.h sys/dev/netmap/netmap_kern.h.bak.12-1-REL
79c79
< /* #define WITH_PTNETMAP */ /* ptnetmap guest support */
---
> #define WITH_PTNETMAP /* ptnetmap guest support */
# diff sys/net/netmap_virt.h sys/net/netmap_virt.h.bak.12-1-REL
47,48c47,48
< #define PTNETMAP_PCI_DEVICE_ID 0xcccc /* memory device */
< #define PTNETMAP_PCI_NETIF_ID 0xcccd /* ptnet network interface */
---
> #define PTNETMAP_PCI_DEVICE_ID 0x000c /* memory device */
> #define PTNETMAP_PCI_NETIF_ID 0x000d /* ptnet network interface */
see (2) above for: sys/dev/netmap/if_ptnet.c
Are test results:
# ifconfig -a
vmx0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=e403bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,VLAN_HWTSO,RXCSUM_IPV6,TXCSUM_IPV6>
ether 52:54:00:a5:4c:f3
media: Ethernet autoselect
status: active
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=81209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,VLAN_HWFILTER>
ether 52:54:00:cb:db:07
inet 192.168.73.102 netmask 0xffffff00 broadcast 192.168.73.255
media: Ethernet autoselect (1000baseT <full-duplex>)
status: active
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
inet 127.0.0.1 netmask 0xff000000
groups: lo
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
# pciconf -lcve
hostb0 at pci0:0:0:0: class=0x060000 card=0x11001af4 chip=0x29c08086 rev=0x00
hdr=0x00
vendor = 'Intel Corporation'
device = '82G33/G31/P35/P31 Express DRAM Controller'
class = bridge
subclass = HOST-PCI
vgapci0 at pci0:0:1:0: class=0x030000 card=0x11001af4 chip=0x01001b36 rev=0x04
hdr=0x00
vendor = 'Red Hat, Inc.'
device = 'QXL paravirtual graphic card'
class = display
subclass = VGA
pcib1 at pci0:0:2:0: class=0x060400 card=0x00001b36 chip=0x000c1b36 rev=0x00
hdr=0x01
vendor = 'Red Hat, Inc.'
device = 'QEMU PCIe Root port'
class = bridge
subclass = PCI-PCI
cap 10[54] = PCI-Express 2 root port max data 128(128) ARI disabled
link x1(x1) speed 2.5(2.5) ASPM disabled(L0s)
slot 0 power limit 0 mW HotPlug(present) surprise Attn Button
PC(on) EI(disengaged)
cap 11[48] = MSI-X supports 1 message
Table in map 0x10[0x0], PBA in map 0x10[0x800]
cap 0d[40] = PCI Bridge card=0x00001b36
ecap 0001[100] = AER 2 0 fatal 0 non-fatal 0 corrected
ecap 000d[148] = ACS 1
pcib3 at pci0:0:2:1: class=0x060400 card=0x00001b36 chip=0x000c1b36 rev=0x00
hdr=0x01
vendor = 'Red Hat, Inc.'
device = 'QEMU PCIe Root port'
class = bridge
subclass = PCI-PCI
cap 10[54] = PCI-Express 2 root port max data 128(128) ARI disabled
link x1(x1) speed 2.5(2.5) ASPM disabled(L0s)
slot 0 power limit 0 mW HotPlug(present) surprise Attn Button
PC(on) EI(disengaged)
cap 11[48] = MSI-X supports 1 message
Table in map 0x10[0x0], PBA in map 0x10[0x800]
cap 0d[40] = PCI Bridge card=0x00001b36
ecap 0001[100] = AER 2 0 fatal 0 non-fatal 0 corrected
ecap 000d[148] = ACS 1
pcib4 at pci0:0:2:2: class=0x060400 card=0x00001b36 chip=0x000c1b36 rev=0x00
hdr=0x01
vendor = 'Red Hat, Inc.'
device = 'QEMU PCIe Root port'
class = bridge
subclass = PCI-PCI
cap 10[54] = PCI-Express 2 root port max data 128(128) ARI disabled
link x1(x1) speed 2.5(2.5) ASPM disabled(L0s)
slot 0 power limit 0 mW HotPlug(empty) surprise Attn Button
PC(off) EI(disengaged)
cap 11[48] = MSI-X supports 1 message
Table in map 0x10[0x0], PBA in map 0x10[0x800]
cap 0d[40] = PCI Bridge card=0x00001b36
ecap 0001[100] = AER 2 0 fatal 0 non-fatal 0 corrected
ecap 000d[148] = ACS 1
pcib5 at pci0:0:2:3: class=0x060400 card=0x00001b36 chip=0x000c1b36 rev=0x00
hdr=0x01
vendor = 'Red Hat, Inc.'
device = 'QEMU PCIe Root port'
class = bridge
subclass = PCI-PCI
cap 10[54] = PCI-Express 2 root port max data 128(128) ARI disabled
link x1(x1) speed 2.5(2.5) ASPM disabled(L0s)
slot 0 power limit 0 mW HotPlug(present) surprise Attn Button
PC(on) EI(disengaged)
cap 11[48] = MSI-X supports 1 message
Table in map 0x10[0x0], PBA in map 0x10[0x800]
cap 0d[40] = PCI Bridge card=0x00001b36
ecap 0001[100] = AER 2 0 fatal 0 non-fatal 0 corrected
ecap 000d[148] = ACS 1
pcib6 at pci0:0:2:4: class=0x060400 card=0x00001b36 chip=0x000c1b36 rev=0x00
hdr=0x01
vendor = 'Red Hat, Inc.'
device = 'QEMU PCIe Root port'
class = bridge
subclass = PCI-PCI
cap 10[54] = PCI-Express 2 root port max data 128(128) ARI disabled
link x1(x1) speed 2.5(2.5) ASPM disabled(L0s)
slot 0 power limit 0 mW HotPlug(empty) surprise Attn Button
PC(off) EI(disengaged)
cap 11[48] = MSI-X supports 1 message
Table in map 0x10[0x0], PBA in map 0x10[0x800]
cap 0d[40] = PCI Bridge card=0x00001b36
ecap 0001[100] = AER 2 0 fatal 0 non-fatal 0 corrected
ecap 000d[148] = ACS 1
pcib7 at pci0:0:2:5: class=0x060400 card=0x00001b36 chip=0x000c1b36 rev=0x00
hdr=0x01
vendor = 'Red Hat, Inc.'
device = 'QEMU PCIe Root port'
class = bridge
subclass = PCI-PCI
cap 10[54] = PCI-Express 2 root port max data 128(128) ARI disabled
link x1(x1) speed 2.5(2.5) ASPM disabled(L0s)
slot 0 power limit 0 mW HotPlug(empty) surprise Attn Button
PC(off) EI(disengaged)
cap 11[48] = MSI-X supports 1 message
Table in map 0x10[0x0], PBA in map 0x10[0x800]
cap 0d[40] = PCI Bridge card=0x00001b36
ecap 0001[100] = AER 2 0 fatal 0 non-fatal 0 corrected
ecap 000d[148] = ACS 1
uhci0 at pci0:0:29:0: class=0x0c0300 card=0x11001af4 chip=0x29348086 rev=0x03
hdr=0x00
vendor = 'Intel Corporation'
device = '82801I (ICH9 Family) USB UHCI Controller'
class = serial bus
subclass = USB
uhci1 at pci0:0:29:1: class=0x0c0300 card=0x11001af4 chip=0x29358086 rev=0x03
hdr=0x00
vendor = 'Intel Corporation'
device = '82801I (ICH9 Family) USB UHCI Controller'
class = serial bus
subclass = USB
uhci2 at pci0:0:29:2: class=0x0c0300 card=0x11001af4 chip=0x29368086 rev=0x03
hdr=0x00
vendor = 'Intel Corporation'
device = '82801I (ICH9 Family) USB UHCI Controller'
class = serial bus
subclass = USB
ehci0 at pci0:0:29:7: class=0x0c0320 card=0x11001af4 chip=0x293a8086 rev=0x03
hdr=0x00
vendor = 'Intel Corporation'
device = '82801I (ICH9 Family) USB2 EHCI Controller'
class = serial bus
subclass = USB
isab0 at pci0:0:31:0: class=0x060100 card=0x11001af4 chip=0x29188086 rev=0x02
hdr=0x00
vendor = 'Intel Corporation'
device = '82801IB (ICH9) LPC Interface Controller'
class = bridge
subclass = PCI-ISA
ahci0 at pci0:0:31:2: class=0x010601 card=0x11001af4 chip=0x29228086 rev=0x02
hdr=0x00
vendor = 'Intel Corporation'
device = '82801IR/IO/IH (ICH9R/DO/DH) 6 port SATA Controller [AHCI
mode]'
class = mass storage
subclass = SATA
cap 05[80] = MSI supports 1 message, 64 bit enabled with 1 message
cap 12[a8] = SATA Index-Data Pair
none0 at pci0:0:31:3: class=0x0c0500 card=0x11001af4 chip=0x29308086 rev=0x02
hdr=0x00
vendor = 'Intel Corporation'
device = '82801I (ICH9 Family) SMBus Controller'
class = serial bus
subclass = SMBus
pcib2 at pci0:1:0:0: class=0x060400 card=0x00000000 chip=0x000e1b36 rev=0x00
hdr=0x01
vendor = 'Red Hat, Inc.'
class = bridge
subclass = PCI-PCI
cap 05[8c] = MSI supports 1 message, 64 bit, vector masks
cap 01[84] = powerspec 3 supports D0 D3 current D0
cap 10[48] = PCI-Express 2 PCI bridge max data 128(128) ARI disabled
link x1(x1) speed 2.5(2.5) ASPM disabled(L0s)
cap 0c[40] = unknown
ecap 0001[100] = AER 2 0 fatal 0 non-fatal 0 corrected
vmx0 at pci0:2:1:0: class=0x020000 card=0x07b015ad chip=0x07b015ad rev=0x01
hdr=0x00
vendor = 'VMware'
device = 'VMXNET3 Ethernet Controller'
class = network
subclass = ethernet
cap 11[9c] = MSI-X supports 25 messages, enabled
Table in map 0x18[0x0], PBA in map 0x18[0x1000]
cap 05[84] = MSI supports 1 message, 64 bit
em0 at pci0:2:2:0: class=0x020000 card=0x11001af4 chip=0x100e8086 rev=0x03
hdr=0x00
vendor = 'Intel Corporation'
device = '82540EM Gigabit Ethernet Controller'
class = network
subclass = ethernet
vtpcim0 at pci0:3:0:0: class=0x010000 card=0x11001af4 chip=0x10481af4 rev=0x01
hdr=0x00
vendor = 'Red Hat, Inc.'
device = 'Virtio SCSI'
class = mass storage
subclass = SCSI
cap 11[dc] = MSI-X supports 4 messages, enabled
Table in map 0x14[0x0], PBA in map 0x14[0x800]
cap 09[c8] = vendor (length 20)
cap 09[b4] = vendor (length 20)
cap 09[a4] = vendor (length 16)
cap 09[94] = vendor (length 16)
cap 09[84] = vendor (length 16)
cap 01[7c] = powerspec 3 supports D0 D3 current D0
cap 10[40] = PCI-Express 2 endpoint max data 128(128)
link x1(x1) speed 2.5(2.5) ASPM disabled(L0s)
vtpcim1 at pci0:5:0:0: class=0x00ff00 card=0x11001af4 chip=0x10451af4 rev=0x01
hdr=0x00
vendor = 'Red Hat, Inc.'
device = 'Virtio memory balloon'
class = old
cap 09[c8] = vendor (length 20)
cap 09[b4] = vendor (length 20)
cap 09[a4] = vendor (length 16)
cap 09[94] = vendor (length 16)
cap 09[84] = vendor (length 16)
cap 01[7c] = powerspec 3 supports D0 D3 current D0
cap 10[40] = PCI-Express 2 endpoint max data 128(128)
link x1(x1) speed 2.5(2.5) ASPM disabled(L0s)
ls /dev/da*
/dev/da0 /dev/da0p1 /dev/da0p2 /dev/da0p3
As I am using Q35 VirtIO SCSI rather then VirtIO Block.
I am still a bit puzzled why enabling VirtIO networking with netmap results in
losing VirtIO Disk support but again it looks like there is some subtle
interaction across VirtIO and netmap that needs to be looked at closer.
My testing is complete for the time being, as I have got degree of flexibility
required:
Disk - SATA, SCSI (with VirtIO) and VirtIO
Networking - em, vmx and re
This is huge improvement from 11.3 & 12.x current situation.
Thanks to all for helping.
Cheers.
John Hartley
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-virtualization
mailing list