Page MenuHomeFreeBSD

bhyve: implement NVMe Format NVM command
ClosedPublic

Authored by chuck on May 18 2020, 3:52 PM.

Details

Summary

The Format NVM command mainly allows the host to specify the block size
and protection information used for the Namespace. As the bhyve
implementation simply maps the capabilities of the backing storage
through to the guest, there isn't anything to implement. But a side
effect of the format is the NVMe Controller shall not return any data
previously written (i.e. erase previously written data). This patch
implements this later behavior to provide a compliant implementation.

Fixes UNH Test 1.6

Test Plan

Run UNH IOL INTERACT tests

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

chuck requested review of this revision.May 18 2020, 3:52 PM
wanpengqian_gmail.com added inline comments.
usr.sbin/bhyve/pci_nvme.c
1293 ↗(On Diff #71937)

Can we zero all the memory instead of free and calloc again? calloc may not success in some situcation.

usr.sbin/bhyve/pci_nvme.c
1293 ↗(On Diff #71937)

This is a fair question and one I've gone back and forth on several times. I found some commentary that the calloc implementation could determine which previously zeroed pages were unwritten and thus still zeroed. The intent of this approach was to allow the memory allocator to use its knowledge of "dirty" pages to only zero out pages that had been written.

This revision was not accepted when it landed; it landed in state Needs Review.Jun 29 2020, 12:32 AM
This revision was automatically updated to reflect the committed changes.