From: Klaus Jensen <its@irrelevant.dk>
To: qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>
Cc: Keith Busch <kbusch@kernel.org>,
qemu-block@nongnu.org, Klaus Jensen <its@irrelevant.dk>,
Klaus Jensen <k.jensen@samsung.com>,
Jinhao Fan <fanjinhao21s@ict.ac.cn>
Subject: [PULL for-7.1 1/3] hw/nvme: skip queue processing if notifier is cleared
Date: Mon, 1 Aug 2022 12:05:54 +0200 [thread overview]
Message-ID: <20220801100556.2217492-2-its@irrelevant.dk> (raw)
In-Reply-To: <20220801100556.2217492-1-its@irrelevant.dk>
From: Klaus Jensen <k.jensen@samsung.com>
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>
---
hw/nvme/ctrl.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 533ad14e7a61..8aa73b048d51 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -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);
}
--
2.36.1
next prev parent reply other threads:[~2022-08-01 10:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-01 10:05 [PULL for-7.1 0/3] hw/nvme fixes Klaus Jensen
2022-08-01 10:05 ` Klaus Jensen [this message]
2022-08-01 10:05 ` [PULL for-7.1 2/3] hw/nvme: unregister the event notifier handler on the main loop Klaus Jensen
2022-08-01 10:05 ` [PULL for-7.1 3/3] hw/nvme: do not enable ioeventfd by default Klaus Jensen
2022-08-01 15:49 ` [PULL for-7.1 0/3] hw/nvme fixes Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220801100556.2217492-2-its@irrelevant.dk \
--to=its@irrelevant.dk \
--cc=fanjinhao21s@ict.ac.cn \
--cc=k.jensen@samsung.com \
--cc=kbusch@kernel.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).