summaryrefslogtreecommitdiffstats
path: root/include/exec/tb-hash.h
diff options
context:
space:
mode:
authorStefan Hajnoczi2020-06-17 15:21:58 +0200
committerStefan Hajnoczi2020-06-23 16:46:08 +0200
commit1086e95da1705087db542276dcbb8ba4d55cb97f (patch)
tree902fab085bd0d37440711bc03acd15647c41af5c /include/exec/tb-hash.h
parentblock/nvme: don't access CQE after moving cq.head (diff)
downloadqemu-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/tb-hash.h')
0 files changed, 0 insertions, 0 deletions