Skip to content

Commit 4f602f3

Browse files
isilenceaxboe
authored andcommitted
io_uring/zcrx: rename dma lock
In preparation for reusing the lock for other purposes, rename it to "pp_lock". As before, it can be taken deeper inside the networking stack by page pool, and so the syscall io_uring must avoid holding it while doing queue reconfiguration or anything that can result in immediate pp init/destruction. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent d8d135d commit 4f602f3

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

io_uring/zcrx.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ static void io_zcrx_unmap_area(struct io_zcrx_ifq *ifq,
253253
{
254254
int i;
255255

256-
guard(mutex)(&ifq->dma_lock);
256+
guard(mutex)(&ifq->pp_lock);
257257
if (!area->is_mapped)
258258
return;
259259
area->is_mapped = false;
@@ -273,7 +273,7 @@ static int io_zcrx_map_area(struct io_zcrx_ifq *ifq, struct io_zcrx_area *area)
273273
{
274274
int ret;
275275

276-
guard(mutex)(&ifq->dma_lock);
276+
guard(mutex)(&ifq->pp_lock);
277277
if (area->is_mapped)
278278
return 0;
279279

@@ -478,7 +478,7 @@ static struct io_zcrx_ifq *io_zcrx_ifq_alloc(struct io_ring_ctx *ctx)
478478
ifq->ctx = ctx;
479479
spin_lock_init(&ifq->lock);
480480
spin_lock_init(&ifq->rq_lock);
481-
mutex_init(&ifq->dma_lock);
481+
mutex_init(&ifq->pp_lock);
482482
return ifq;
483483
}
484484

@@ -527,7 +527,7 @@ static void io_zcrx_ifq_free(struct io_zcrx_ifq *ifq)
527527
put_device(ifq->dev);
528528

529529
io_free_rbuf_ring(ifq);
530-
mutex_destroy(&ifq->dma_lock);
530+
mutex_destroy(&ifq->pp_lock);
531531
kfree(ifq);
532532
}
533533

io_uring/zcrx.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,12 @@ struct io_zcrx_ifq {
5454
struct net_device *netdev;
5555
netdevice_tracker netdev_tracker;
5656
spinlock_t lock;
57-
struct mutex dma_lock;
57+
58+
/*
59+
* Page pool and net configuration lock, can be taken deeper in the
60+
* net stack.
61+
*/
62+
struct mutex pp_lock;
5863
struct io_mapped_region region;
5964
};
6065

0 commit comments

Comments
 (0)