Re: bhyve NVMe 1.4 support

From: Mario Marietto <marietto2008_at_gmail.com>
Date: Sun, 20 Mar 2022 10:43:58 UTC
Please check this situation :

(I'm on :

FreeBSD marietto 13.0-RELEASE-p8 FreeBSD 13.0-RELEASE-p8 #6
n244863-45b90a014c11: Thu Mar 17 18:42:4
0 CET 2022     marietto@marietto:/usr/obj/usr/src/amd64.amd64/sys/GENERIC
 amd64)


ubuntu21-10-nvidia495-vm0.sh :


bhyve -S -c sockets=2,cores=2,threads=2 -m 8G -w -H -A \
-s 0,hostbridge \
-s 1,virtio-blk,/mnt/$vmdisk'p2'/bhyve/os/Linux/impish-cuda-11-5-nvidia-495.img
\
-s 2,nvme,/dev/nvd0 \
-s 3,passthru,5/0/0 \
-s 4,passthru,1/0/0 \
-s 8,virtio-net,tap0 \
-s 9,virtio-9p,sharename=/ \
-s 29,fbuf,tcp=0.0.0.0:5900,w=1440,h=900 \
-s 30,xhci,tablet \
-s 31,lpc \
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_BHF_CODE.fd \
vm0 < /dev/null & sleep 2 && vncviewer 0:0


on the Ubuntu 21.10 guest os :

mario@marietto-BHYVE:/home/marietto# fdisk -l

Disk /dev/nvme0n1: 931,51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: bhyve-NVMe
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


The nvme disk is not recognized. This is how it looks on FreeBSD :

1. Name: nvd0
  Mediasize: 1000204886016 (932G)
  Sectorsize: 512
  Mode: r0w0e0
  descr: CT1000P1SSD8
  lunid: 000000000000000100a07520285f1175
  ident: 2022285F1175
  rotationrate: 0
  fwsectors: 0
  fwheads: 0

=>        34  1953525101  nvd0  GPT  (932G)

         34        2014        - free -  (1.0M)
       2048     1748992     1  efi  (854M)
    1751040   921985024     2  ms-basic-data  (440G)
  923736064   191522816        - free -  (91G)
 1115258880   833185547     7  ms-basic-data  (397G)
 1948444427         245        - free -  (123K)
 1948444672     1318912     3  ms-recovery  (644M)
 1949763584        2048        - free -  (1.0M)
 1949765632     1310720     4  ms-recovery  (640M)
 1951076352        2048        - free -  (1.0M)
 1951078400     1265657     5  ms-basic-data  (618M)
 1952344057           7        - free -  (3.5K)
 1952344064     1179641     6  ms-basic-data  (576M)
 1953523705        1430        - free -  (715K)




Il giorno mar 11 gen 2022 alle ore 04:01 <jason@tubnor.net> ha scritto:

> > -----Original Message-----
> > From: Chuck Tuffli <chuck@tuffli.net>
> > Sent: Tuesday, 11 January 2022 10:58 AM
> > To: jason@tubnor.net
> > Cc: FreeBSD virtualization <freebsd-virtualization@freebsd.org>
> > Subject: Re: bhyve NVMe 1.4 support
> >
> > On Wed, Jan 5, 2022 at 4:33 PM Chuck Tuffli <chuck@tuffli.net> wrote:
> > >
> > > On Mon, Jan 3, 2022 at 4:49 PM <jason@tubnor.net> wrote:
> > > >
> > > > Hi Chuck,
> > > >
> > > > Testing on 14.0-CURRENT shows the following:
> > > >
> > > > OpenBSD 6.9 - NVMe read/write OK
> > > > Windows 10 - NVMe read OK, write FAIL Windows Server 2022 - NVMe
> > > > read OK, write FAIL Alma Linux 8.5 - NVMe read OK, write FAIL.
> > >
> > > Thanks for the report, Jason. I have Alma 8.5 installed and am
> investigating.
> >
> > OK, I found and fixed the regression. New version of the file in the same
> > place is up for folks who are interested.
> >
> > --chuck
>
> This version looks good. No regression on the following guest platforms
> under 14.0-CURRENT:
>
> OpenBSD 6.9 - NVMe read/write OK
> Windows 10 - NVMe read/write OK
> Windows Server 2022 - NVMe read/write OK
> Alma Linux 8.5 - NVMe read/write OK
> FreeBSD 13.0 - NVMe read/write OK
>
> From a storage presentation layer in a production perspective, I can't
> find any issues with the proposed update to pci_nvme.c
>
> Some of our tests included:
>
> The removal and addition of partitions on the NVMe presentation layer
> Installation of all the operating system listed above
> Where supported by the guest operating system, the TRIM command executed
> on the presentation layer and guest rebooted to ensure no data corruption
> was caused by TRIM
>
> Cheers,
>
> Jason.
>
>
>

-- 
Mario.