Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Mar 2020 13:05:40 +0900
From:      Wanpeng Qian <wanpengqian@gmail.com>
To:        FreeBSD virtualization <freebsd-virtualization@freebsd.org>
Subject:   bhyve: passthrough SMART info from host nvme controller
Message-ID:  <CANBJ%2BxRdvTUHV0PQeBK2y2bCWDi5idqrD-AsHCT02fWkBLzeQQ@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
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@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@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?



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANBJ%2BxRdvTUHV0PQeBK2y2bCWDi5idqrD-AsHCT02fWkBLzeQQ>