diff options
| author | Stefan Hajnoczi | 2020-06-17 15:21:58 +0200 |
|---|---|---|
| committer | Stefan Hajnoczi | 2020-06-23 16:46:08 +0200 |
| commit | 1086e95da1705087db542276dcbb8ba4d55cb97f (patch) | |
| tree | 902fab085bd0d37440711bc03acd15647c41af5c /include/exec/address-spaces.h | |
| parent | block/nvme: don't access CQE after moving cq.head (diff) | |
| download | qemu-1086e95da1705087db542276dcbb8ba4d55cb97f.tar.gz qemu-1086e95da1705087db542276dcbb8ba4d55cb97f.tar.xz qemu-1086e95da1705087db542276dcbb8ba4d55cb97f.zip | |
block/nvme: switch to a NVMeRequest freelist
There are three issues with the current NVMeRequest->busy field:
1. The busy field is accidentally accessed outside q->lock when request
submission fails.
2. Waiters on free_req_queue are not woken when a request is returned
early due to submission failure.
2. Finding a free request involves scanning all requests. This makes
request submission O(n^2).
Switch to an O(1) freelist that is always accessed under the lock.
Also differentiate between NVME_QUEUE_SIZE, the actual SQ/CQ size, and
NVME_NUM_REQS, the number of usable requests. This makes the code
simpler than using NVME_QUEUE_SIZE everywhere and having to keep in mind
that one slot is reserved.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Sergio Lopez <slp@redhat.com>
Message-id: 20200617132201.1832152-5-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'include/exec/address-spaces.h')
0 files changed, 0 insertions, 0 deletions
