public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: [email protected]
Cc: Jens Axboe <[email protected]>, [email protected]
Subject: [PATCH 2/2] io_uring/notif: disable LAZY_WAKE for linked notifs
Date: Tue, 30 Apr 2024 16:42:31 +0100	[thread overview]
Message-ID: <0a5accdb7d2d0d27ebec14f8106e14e0192fae17.1714488419.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>

Notifications may now be linked and thus a single tw can post multiple
CQEs, it's not safe to use LAZY_WAKE with them. Disable LAZY_WAKE for
now, if that'd prove to be a problem we can count them and pass the
expected number of CQEs into __io_req_task_work_add().

Fixes: 6fe4220912d19 ("io_uring/notif: implement notification stacking")
Signed-off-by: Pavel Begunkov <[email protected]>
---
 io_uring/notif.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/io_uring/notif.c b/io_uring/notif.c
index d58cdc01e691..28859ae3ee6e 100644
--- a/io_uring/notif.c
+++ b/io_uring/notif.c
@@ -38,6 +38,7 @@ void io_tx_ubuf_complete(struct sk_buff *skb, struct ubuf_info *uarg,
 {
 	struct io_notif_data *nd = container_of(uarg, struct io_notif_data, uarg);
 	struct io_kiocb *notif = cmd_to_io_kiocb(nd);
+	unsigned tw_flags;
 
 	if (nd->zc_report) {
 		if (success && !nd->zc_used && skb)
@@ -53,8 +54,10 @@ void io_tx_ubuf_complete(struct sk_buff *skb, struct ubuf_info *uarg,
 		io_tx_ubuf_complete(skb, &nd->head->uarg, success);
 		return;
 	}
+
+	tw_flags = nd->next ? 0 : IOU_F_TWQ_LAZY_WAKE;
 	notif->io_task_work.func = io_notif_tw_complete;
-	__io_req_task_work_add(notif, IOU_F_TWQ_LAZY_WAKE);
+	__io_req_task_work_add(notif, tw_flags);
 }
 
 static int io_link_skb(struct sk_buff *skb, struct ubuf_info *uarg)
-- 
2.44.0


  parent reply	other threads:[~2024-04-30 15:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-30 15:42 [PATCH 0/2] LAZY_WAKE misuse fixes Pavel Begunkov
2024-04-30 15:42 ` [PATCH 1/2] io_uring/net: fix sendzc lazy wake polling Pavel Begunkov
2024-04-30 15:42 ` Pavel Begunkov [this message]
2024-04-30 19:06 ` [PATCH 0/2] LAZY_WAKE misuse fixes Jens Axboe

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=0a5accdb7d2d0d27ebec14f8106e14e0192fae17.1714488419.git.asml.silence@gmail.com \
    [email protected] \
    [email protected] \
    [email protected] \
    /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