Bug 205178 - virtio-blk not working correctly in powerpc
Summary: virtio-blk not working correctly in powerpc
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: powerpc Any
: --- Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-10 04:50 UTC by Kenneth Salerno
Modified: 2015-12-10 04:50 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kenneth Salerno 2015-12-10 04:50:23 UTC
When attaching a disk as a virtio block device, the FreeBSD kernel discovers the geometry incorrectly and sees only a small portion of the available capacity.

kens@freebsd-ppc64> gpart show vtbd0
=>16  48  vtbd0  MBR  (8.0M)
  16  48         - free -  (6.0M)

Here is the same disk attached to the guest as a SCSI device:

kens@freebsd-ppc64> gpart show da1
=>    255  4194049  da1  MBR  (2.0G)
      255  4194049       - free -  (2.0G)

In other ppc64 guest Operating Systems (Linux) I run with the same host,
virtio block devices work as expected (i.e. their reported size by the OS matches what I created with qemu-img).

Hypervisor: QEMU version 2.4.0.1
Operating System configuration details:
-------------------------------------------------------------
kens@freebsd-ppc64> freebsd-version -ku
11.0-CURRENT
11.0-CURRENT

kens@freebsd-ppc64> uname -a
FreeBSD freebsd-ppc64.kpsalerno.us.ibm.com 11.0-CURRENT FreeBSD 11.0-CURRENT #3 r291616: Sat Dec  5 15:04:53 EST 2015     root@freebsd-amd64.kpsalerno.us.ibm.com:/usr/obj/powerpc.powerpc64/usr/src/sys/SALERNO  powerpc

kens@freebsd-ppc64> sysctl kern.conftxt
kern.conftxt: options   CONFIG_AUTOGENERATED
ident   SALERNO
machine powerpc
cpu     AIM
options SMP
options INCLUDE_CONFIG_FILE
options _KPOSIX_PRIORITY_SCHEDULING
options SCSI_DELAY=5000
options COMPAT_FREEBSD32
options UFS_DIRHASH
options INET
options PREEMPTION
options SCHED_ULE
options FDT
options PSERIES
options NEW_PCIB
options GEOM_PART_MBR
options GEOM_PART_BSD
device  uart_ns8250
device  pci
device  scbus
device  da
device  cd
device  pass
device  scc
device  uart
device  uart_z8530
device  loop
device  random
device  ether
device  ofwd
device  bpf
device  powermac_nvram

kens@freebsd-ppc64> kldstat
Id Refs Address            Size     Name
 1   25 0x100000 673ab0   kernel
 2    1 0x775000 1bcb0    geom_label.ko
 3    1 0x791000 b5cc0    if_em.ko
 4    1 0x847000 6a578    ufs.ko
 5    1 0x8b2000 13770    mem.ko
 6    4 0x8c6000 16a20    virtio.ko
 7    1 0x8dd000 22c60    if_vtnet.ko
 8    1 0x900000 18e90    virtio_pci.ko
 9    1 0x919000 18b18    virtio_blk.ko

kens@freebsd-ppc64> cat make.conf
MAKE_JOBS_NUMBER = 5
KPS_FLAGS = -O2 -fomit-frame-pointer -pipe
CFLAGS = ${KPS_FLAGS}
COPTFLAGS = ${KPS_FLAGS}

WITHOUT_PROFILE = yes
WITHOUT_CAPSICUM = yes
WITHOUT_TESTS = yes
MALLOC_PRODUCTION = yes

NO_WERROR =
WERROR =

# temp disable these modules until Makefile fixed in 11-CURRENT
# linux64 linprocfs linsysfs \

MODULES_OVERRIDE = \
        geom/geom_label \
        sysvipc \
        ufs fdescfs tmpfs msdosfs cd9660 procfs pseudofs \
        mem \
        md firmware \
        em \
        virtio/virtio virtio/network virtio/pci virtio/block

kens@freebsd-ppc64> dmesg | grep -e vt -e virtio
virtio_pci0: <VirtIO PCI Block adapter> port 0x40-0x7f mem 0xc0000000-0xc0000fff irq 4100 at device 1.0 on pci0
vtblk0: <VirtIO Block Adapter> on virtio_pci0
vtblk0: 8MB (64 131072 byte sectors)

kens@freebsd-ppc64> sysctl dev.vtblk
dev.vtblk.0.writecache_mode: 1
dev.vtblk.0.%parent: virtio_pci0
dev.vtblk.0.%pnpinfo:
dev.vtblk.0.%location:
dev.vtblk.0.%driver: vtblk
dev.vtblk.0.%desc: VirtIO Block Adapter
dev.vtblk.%parent:

Details of same disk image when attached to guest as SCSI device:
-------------------------------------------------------------
kens@freebsd-ppc64> dmesg|grep da1
da1 at vscsi0 bus 0 scbus0 target 0 lun 2
da1: <QEMU QEMU HARDDISK 2.4.> Fixed Direct Access SPC-3 SCSI device
da1: 150.000MB/s transfers
da1:  2048MB (4194304 512 byte sectors)