hw/nvme: skip queue processing if notifier is cleared

While it is safe to process the queues when they are empty, skip it if
the event notifier callback was invoked spuriously.

Reviewed-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Jinhao Fan <fanjinhao21s@ict.ac.cn>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
This commit is contained in:
Klaus Jensen 2022-07-28 08:36:07 +02:00
parent 3916603e0c
commit a2da737729
1 changed files with 6 additions and 2 deletions

View File

@ -4238,7 +4238,9 @@ static void nvme_cq_notifier(EventNotifier *e)
NvmeCQueue *cq = container_of(e, NvmeCQueue, notifier);
NvmeCtrl *n = cq->ctrl;
event_notifier_test_and_clear(&cq->notifier);
if (!event_notifier_test_and_clear(e)) {
return;
}
nvme_update_cq_head(cq);
@ -4275,7 +4277,9 @@ static void nvme_sq_notifier(EventNotifier *e)
{
NvmeSQueue *sq = container_of(e, NvmeSQueue, notifier);
event_notifier_test_and_clear(&sq->notifier);
if (!event_notifier_test_and_clear(e)) {
return;
}
nvme_process_sq(sq);
}