bhyve: passthrough SMART info from host nvme controller

Wanpeng Qian wanpengqian at gmail.com
Wed Mar 18 13:31:03 UTC 2020


Hi Robert

> I don't see why the guest needs to know about an implementation detail of the host hardware.
> If the host hardware is failing, that's something to be fixed on the host. The guest should never realize that something was broken.

I totally agree with you in this opinion. except one time when I am
running a NAS virtual machine.
providing two nvme disks for cache purpose. the NAS server cannot use
them at first.

currently the SMART data structure is all zero. so following two field
of are zero when present to VM..

Available spare: 0
Available spare threshold: 0

The NAS server is thinking the disks are falling and suggest replacing them.
I have to patch bhyve, providing some fake data.

And I am thinking if we can provide the real hardware SMART to virtual machine,
may be the virtual machine can monitor that information and send alert when
hardware is falling. instead of the using smartmontools in FreeBSD host.

And that is your decision whether you passthrough this information or not.
the system just provide this ability.

BR.

Qian

On Wed, Mar 18, 2020 at 9:57 PM Robert Crowston <crowston at protonmail.com> wrote:
>
> I don't see why the guest needs to know about an implementation detail of the host hardware.
>
> If the host hardware is failing, that's something to be fixed on the host. The guest should never realize that something was broken.
>
> Just my opinion.
>
>
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> On Wednesday, 18 March 2020 04:05, Wanpeng Qian <wanpengqian at gmail.com> wrote:
>
> > Hello all.
> >
> > I have an idea about provide SMART of nvme controller.
> >
> > Currently bhyve's nvme controller didn't provide any SMART information.
> > if we provide fake SMART, that is meaningless.
> >
> > I am thinking we can read the host nvme controller SMART and provide
> > that to guest.
> >
> > such as
> >
> > nvme,disk1.img,maxq=16,qsz=8,ioslots=1,sectsz=512,ser=QNVME778,smart=nvme0
> >
> > I have done some draft code. and it work.
> > here is the output of nvmecontrol identify and logpage.
> >
> > root at smart:~ # nvmecontrol identify nvme0
> > Controller Capabilities/Features
> >
> > ========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
> >
> > Vendor ID: fb5d
> > Subsystem Vendor ID: 0000
> > Serial Number: QNVME778
> > Model Number: bhyve-NVMe
> > Firmware Version: 1.0
> > Recommended Arb Burst: 4
> > IEEE OUI Identifier: 58 9c fc
> > Multi-Path I/O Capabilities: Not Supported
> > Max Data Transfer Size: 2097152 bytes
> > Controller ID: 0x0000
> > Version: 1.3.0
> >
> > Admin Command Set Attributes
> >
> > ============================================================================================================================================================================================================================================================================================================================
> >
> > Security Send/Receive: Not Supported
> > Format NVM: Supported
> > Firmware Activate/Download: Not Supported
> > Namespace Managment: Not Supported
> > Device Self-test: Not Supported
> > Directives: Not Supported
> > NVMe-MI Send/Receive: Not Supported
> > Virtualization Management: Not Supported
> > Doorbell Buffer Config: Not Supported
> > Get LBA Status: Not Supported
> > Sanitize: Not Supported
> > Abort Command Limit: 3
> > Async Event Request Limit: 5
> > Number of Firmware Slots: N/A
> > Firmware Slot 1 Read-Only: N/A
> > Per-Namespace SMART Log: No
> > Error Log Page Entries: 1
> > Number of Power States: 2
> > Total NVM Capacity: 0 bytes
> > Unallocated NVM Capacity: 0 bytes
> >
> > NVM Command Set Attributes
> >
> > ======================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
> >
> > Submission Queue Entry Size
> > Max: 64
> > Min: 64
> > Completion Queue Entry Size
> > Max: 16
> > Min: 16
> > Number of Namespaces: 1
> > Compare Command: Not Supported
> > Write Uncorrectable Command: Not Supported
> > Dataset Management Command: Not Supported
> > Write Zeroes Command: Not Supported
> > Save Features: Not Supported
> > Reservations: Not Supported
> > Timestamp feature: Not Supported
> > Verify feature: Not Supported
> > Fused Operation Support: Not Supported
> > Format NVM Attributes: All-NVM Erase, All-NVM Format
> > Volatile Write Cache: Not Present
> >
> > NVM Subsystem Name:
> > root at smart:~ # nvmecontrol logpage -p 2 nvme0
> > SMART/Health Information Log
> >
> > ==============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
> >
> > Critical Warning State: 0x00
> > Available spare: 0
> > Temperature: 0
> > Device reliability: 0
> > Read only: 0
> > Volatile memory backup: 0
> > Temperature: 309 K, 35.85 C, 96.53 F
> > Available spare: 100
> > Available spare threshold: 10
> > Percentage used: 0
> > Data units (512,000 byte) read: 173065
> > Data units written: 9381970
> > Host read commands: 4123220
> > Host write commands: 846568092
> > Controller busy time (minutes): 948
> > Power cycles: 918
> > Power on hours: 2631
> > Unsafe shutdowns: 812
> > Media errors: 0
> > No. error info log entries: 2546
> > Warning Temp Composite Time: 75
> > Error Temp Composite Time: 58
> > Temperature 1 Transition Count: 0
> > Temperature 2 Transition Count: 0
> > Total Time For Temperature 1: 0
> > Total Time For Temperature 2: 0
> >
> > But currently bhyve has Capsicum capability, I cannot
> > open /dev/nvme0 within pci_nvme.c without extra code.
> > (currently I just disable the Capsicum capability)
> >
> > any feedback?
> >
> > freebsd-virtualization at freebsd.org mailing list
> > https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
> > To unsubscribe, send any mail to "freebsd-virtualization-unsubscribe at freebsd.org"
>
>


More information about the freebsd-virtualization mailing list