Page MenuHomeFreeBSD

Fix bhyve's NVMe queue bookkeeping
ClosedPublic

Authored by chuck on Dec 31 2018, 6:52 PM.
Tags
Referenced Files
Unknown Object (File)
Sat, Dec 14, 4:02 PM
Unknown Object (File)
Sun, Dec 1, 12:29 PM
Unknown Object (File)
Sun, Dec 1, 7:54 AM
Unknown Object (File)
Oct 27 2024, 9:46 AM
Unknown Object (File)
Oct 15 2024, 10:11 PM
Unknown Object (File)
Sep 30 2024, 5:27 PM
Unknown Object (File)
Sep 30 2024, 1:08 PM
Unknown Object (File)
Sep 26 2024, 12:27 AM
Subscribers

Details

Summary

Many size / length parameters in NVMe are "0's based", meaning, a value
of 0x0 represents 1, 0x1 represents 2, etc.. While this leads to an
efficient encoding, it can lead to subtle bugs. With respect to queues,
these parameters include:

  • Maximum number of queue entries
  • Maximum number of queues
  • Number of Completion Queues
  • Number of Submission Queues

To be consistent, convert all 0's based values from the host to 1's
based value internally. Likewise, covert internal 1's based values to
0's based values when returned to the host. This fixes an off-by-one bug
when creating IO queues and simplifies some of the code. Note that this
bug is masked by another bug.

While in the neighborhood,

  • fix an erroneous queue ID check (checking CQ count when deleting SQ)
  • check for queue ID of 0x0 in a few places where this is illegal
  • clean up the Set Features, Number of Queues command and check for illegal values

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 21794

Event Timeline

Use ONE_BASED() macro for CQ creation as well as SQ

LGTM! Do you mind set a MFC?

This revision is now accepted and ready to land.Jan 2 2019, 4:20 AM
araujo added a reviewer: bhyve.

This looks good to me as well...

This revision was automatically updated to reflect the committed changes.