]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
nvme: Use adaptive spinning when polling for completion or state change
authorWarner Losh <imp@FreeBSD.org>
Fri, 1 Oct 2021 17:32:48 +0000 (11:32 -0600)
committerWarner Losh <imp@FreeBSD.org>
Sat, 2 Oct 2021 01:17:55 +0000 (19:17 -0600)
commit83581511d9476ef5084f47e3cc379be7191ae866
tree00f9dee42a1c9efcff5351e7bcb00382ade5539f
parentef7d2c1fc1605acdbffb233925ab69f8d57de22a
nvme: Use adaptive spinning when polling for completion or state change

We only use nvme_completion_poll in the initialization path. The
commands they queue and wait for finish quickly as they involve no I/O
to the drive's media. These command take about 20-200 microsecnds
each. Set the wait time to 1us and then increase it by 1.5 each
successive iteration (max 1ms). This reduces initialization time by
80ms in cpervica's tests.

Use this same technique waiting for RDY state transitions. This saves
another 20ms. In total we're down from ~330ms to ~2ms.

Tested by: cperciva
Sponsored by: Netflix
Reviewed by: mav
Differential Review: https://reviews.freebsd.org/D32259
sys/dev/nvme/nvme_ctrlr.c
sys/dev/nvme/nvme_private.h