summary refs log tree commit diff stats
path: root/util/coroutine-sigaltstack.c
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2020-06-17 14:21:58 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2020-06-23 15:46:08 +0100
commit1086e95da1705087db542276dcbb8ba4d55cb97f (patch)
tree902fab085bd0d37440711bc03acd15647c41af5c /util/coroutine-sigaltstack.c
parent04b3fb39c815e6de67c5003e610d1cdecc911980 (diff)
downloadfocaccia-qemu-1086e95da1705087db542276dcbb8ba4d55cb97f.tar.gz
focaccia-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 'util/coroutine-sigaltstack.c')
0 files changed, 0 insertions, 0 deletions