Netdev List
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: io-uring@vger.kernel.org
Cc: asml.silence@gmail.com, netdev@vger.kernel.org
Subject: [PATCH io_uring 15/16] io_uring/zcrx: lock area creation with pp_lock
Date: Fri,  7 Aug 2026 14:19:33 +0100	[thread overview]
Message-ID: <a667399971120227a28d54ebabc50e707f717bf3.1786108672.git.asml.silence@gmail.com> (raw)
In-Reply-To: <cover.1786108672.git.asml.silence@gmail.com>

Protect __zcrx_create_area() with pp_lock. It's not needed for now,
nobody can take the lock in parallel, but we'll need it for dynamic area
creation for avoiding races with the device dying.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 io_uring/zcrx.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/io_uring/zcrx.c b/io_uring/zcrx.c
index 8de142856795..fe36520994e7 100644
--- a/io_uring/zcrx.c
+++ b/io_uring/zcrx.c
@@ -330,13 +330,6 @@ static void __io_zcrx_unmap_area(struct io_zcrx_ifq *ifq,
 	}
 }
 
-static void io_zcrx_unmap_area(struct io_zcrx_ifq *ifq,
-				struct io_zcrx_area *area)
-{
-	guard(mutex)(&ifq->pp_lock);
-	__io_zcrx_unmap_area(ifq, area);
-}
-
 static void io_zcrx_unmap_areas(struct io_zcrx_ifq *ifq)
 {
 	unsigned area_idx;
@@ -508,6 +501,8 @@ static int __zcrx_create_area(struct io_zcrx_ifq *ifq,
 	unsigned nr_iovs;
 	int i, ret;
 
+	lockdep_assert_held(&ifq->pp_lock);
+
 	if (rx_buf_len) {
 		if (!is_power_of_2(rx_buf_len) || rx_buf_len < PAGE_SIZE)
 			return -EINVAL;
@@ -579,7 +574,7 @@ static int __zcrx_create_area(struct io_zcrx_ifq *ifq,
 		return 0;
 err:
 	if (area) {
-		io_zcrx_unmap_area(ifq, area);
+		__io_zcrx_unmap_area(ifq, area);
 		io_zcrx_free_area(ifq, area);
 	}
 	return ret;
@@ -589,6 +584,7 @@ static int io_zcrx_create_area(struct io_zcrx_ifq *ifq,
 			       struct io_uring_zcrx_area_reg *area_reg,
 			       struct io_uring_zcrx_ifq_reg *reg)
 {
+	guard(mutex)(&ifq->pp_lock);
 	return __zcrx_create_area(ifq, area_reg, reg->rx_buf_len);
 }
 
-- 
2.54.0


  parent reply	other threads:[~2026-08-07 13:20 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-07 13:19 [PATCH io_uring 00/16] zcrx update for-7.3 Pavel Begunkov
2026-08-07 13:19 ` [PATCH io_uring 01/16] io_uring/zcrx: scale refilling with large pages Pavel Begunkov
2026-08-07 13:19 ` [PATCH io_uring 02/16] io_uring/zcrx: move RQ head/tail to separate cache lines Pavel Begunkov
2026-08-07 13:19 ` [PATCH io_uring 03/16] io_uring/zcrx: add RQ iterator Pavel Begunkov
2026-08-07 13:19 ` [PATCH io_uring 04/16] io_uring/zcrx: cache RQ tail Pavel Begunkov
2026-08-07 13:19 ` [PATCH io_uring 05/16] io_uring/zcrx: coalesce same-niov RQEs on refill Pavel Begunkov
2026-08-07 13:19 ` [PATCH io_uring 06/16] io_uring/zcrx: constify area_reg on import Pavel Begunkov
2026-08-07 13:19 ` [PATCH io_uring 07/16] io_urint/zcrx: narrow var scope in io_zcrx_recv_skb() Pavel Begunkov
2026-08-07 13:19 ` [PATCH io_uring 08/16] io_uring/zcrx: don't reload skb_shinfo Pavel Begunkov
2026-08-07 13:19 ` [PATCH io_uring 09/16] io_uring/zcrx: add helper for deriving area token Pavel Begunkov
2026-08-07 13:19 ` [PATCH io_uring 10/16] io_uring/zcrx: don't pass ifq_reg to area creation Pavel Begunkov
2026-08-07 13:19 ` [PATCH io_uring 11/16] io_uring/zcrx: split dmabuf unmap and release Pavel Begunkov
2026-08-07 13:19 ` [PATCH io_uring 12/16] io_uring/zcrx: unmap under netdev lock Pavel Begunkov
2026-08-07 13:19 ` [PATCH io_uring 13/16] io_uring/zcrx: move freelist lock to struct zcrx Pavel Begunkov
2026-08-07 13:19 ` [PATCH io_uring 14/16] io_uring/zcrx: keep array of areas Pavel Begunkov
2026-08-07 13:19 ` Pavel Begunkov [this message]
2026-08-07 13:19 ` [PATCH io_uring 16/16] io_uring/zcrx: add dynamic area provisioning Pavel Begunkov

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=a667399971120227a28d54ebabc50e707f717bf3.1786108672.git.asml.silence@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=io-uring@vger.kernel.org \
    --cc=netdev@vger.kernel.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