Page MenuHomeFreeBSD

bhyve nvme: Add Temperature Threshold support
ClosedPublic

Authored by chuck on Dec 19 2021, 4:17 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 30, 4:50 AM
Unknown Object (File)
Fri, Apr 26, 11:31 PM
Unknown Object (File)
Fri, Apr 26, 9:35 PM
Unknown Object (File)
Fri, Apr 26, 9:34 PM
Unknown Object (File)
Apr 8 2024, 10:17 PM
Unknown Object (File)
Apr 8 2024, 10:57 AM
Unknown Object (File)
Feb 26 2024, 1:16 PM
Unknown Object (File)
Feb 26 2024, 12:42 PM

Details

Summary

This adds the ability for a guest OS to send Set / Get Feature,
Temperature Threshold commands. The implementation assumes a constant
temperature and will generate an Asynchronous Event Notification if the
specified threshold is above/below this value. Although the
specification allows 9 temperature values, this implementation only
implements the Composite Temperature.

While in the neighborhood, move the clear of the CSTS register in the
reset function after all other cleanup. This avoids a race with the
guest thinking the reset is complete (i.e. CSTS.RDY = 0) before the NVMe
emulation is actually complete with the reset.

Fixes UNH IOL 16.0 Test 1.7, cases 1, 2, and 4.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

chuck requested review of this revision.Dec 19 2021, 4:17 PM

Do we need to keep the first temperature warning timestamp? Later we can calculate the following warning time in the healthy log.
Warning Temp Composite Time:
Error Temp Composite Time:

usr.sbin/bhyve/pci_nvme.c
1707

uint8_t for tmpsel is enough.

1719

how about ((thsel != NVME_TEMP_THRESH_OVER) && (thsel != NVME_TEMP_THRESH_UNDER)) for easy understanding?

allanjude added inline comments.
usr.sbin/bhyve/pci_nvme.c
669

This changes the value from 310 to 296, is that intentional?

I like wanpengqian_gmail.com's suggestions as well.
310 vs 296 isn't a meaningful change. 37C vs 23C
Personally, I'd report 303 since that's 30C, but the actual number really doesn't matter.

usr.sbin/bhyve/pci_nvme.c
533

how are these numbers computed?

1047

seems unrelated, but good.

chuck added inline comments.
usr.sbin/bhyve/pci_nvme.c
533

NVMe 2.0, Figure 275 includes in the description for WCTEMP

It is recommended that implementations report a value of 0157h in this field.

669

Yes, the change was intentional. Both values are arbitrary, but 296 is room temperature, which I liked better.

usr.sbin/bhyve/pci_nvme.c
1719

No, because unsupported TMPSEL values need to return an error.

usr.sbin/bhyve/pci_nvme.c
1719

sorry, I mean this part ' (thsel > NVME_TEMP_THRESH_UNDER)'
first time I read it I have to check specification to find out what it means. Its fine, I understand now.

This revision was not accepted when it landed; it landed in state Needs Review.Jan 29 2022, 11:18 PM
This revision was automatically updated to reflect the committed changes.