Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'xsk-move-cq_cached_prod_lock'

Jason Xing says:

====================
xsk: move cq_cached_prod_lock

From: Jason Xing <kernelxing@tencent.com>

Move cq_cached_prod_lock to avoid touching new cacheline.

Acked-by: Stanislav Fomichev <sdf@fomichev.me>
====================

Link: https://patch.msgid.link/20260104012125.44003-1-kerneljasonxing@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

+17 -14
-5
include/net/xsk_buff_pool.h
··· 90 90 * destructor callback. 91 91 */ 92 92 spinlock_t cq_prod_lock; 93 - /* Mutual exclusion of the completion ring in the SKB mode. 94 - * Protect: when sockets share a single cq when the same netdev 95 - * and queue id is shared. 96 - */ 97 - spinlock_t cq_cached_prod_lock; 98 93 struct xdp_buff_xsk *free_heads[]; 99 94 }; 100 95
+11 -4
net/xdp/xsk.c
··· 543 543 { 544 544 int ret; 545 545 546 - spin_lock(&pool->cq_cached_prod_lock); 546 + spin_lock(&pool->cq->cq_cached_prod_lock); 547 547 ret = xskq_prod_reserve(pool->cq); 548 - spin_unlock(&pool->cq_cached_prod_lock); 548 + spin_unlock(&pool->cq->cq_cached_prod_lock); 549 549 550 550 return ret; 551 551 } ··· 619 619 620 620 static void xsk_cq_cancel_locked(struct xsk_buff_pool *pool, u32 n) 621 621 { 622 - spin_lock(&pool->cq_cached_prod_lock); 622 + spin_lock(&pool->cq->cq_cached_prod_lock); 623 623 xskq_prod_cancel_n(pool->cq, n); 624 - spin_unlock(&pool->cq_cached_prod_lock); 624 + spin_unlock(&pool->cq->cq_cached_prod_lock); 625 625 } 626 626 627 627 INDIRECT_CALLABLE_SCOPE ··· 1349 1349 } 1350 1350 1351 1351 if (umem_xs->queue_id != qid || umem_xs->dev != dev) { 1352 + /* One fill and completion ring required for each queue id. */ 1353 + if (!xsk_validate_queues(xs)) { 1354 + err = -EINVAL; 1355 + sockfd_put(sock); 1356 + goto out_unlock; 1357 + } 1358 + 1352 1359 /* Share the umem with another socket on another qid 1353 1360 * and/or device. 1354 1361 */
+1 -5
net/xdp/xsk_buff_pool.c
··· 91 91 INIT_LIST_HEAD(&pool->xsk_tx_list); 92 92 spin_lock_init(&pool->xsk_tx_list_lock); 93 93 spin_lock_init(&pool->cq_prod_lock); 94 - spin_lock_init(&pool->cq_cached_prod_lock); 94 + spin_lock_init(&xs->cq_tmp->cq_cached_prod_lock); 95 95 refcount_set(&pool->users, 1); 96 96 97 97 pool->fq = xs->fq_tmp; ··· 246 246 { 247 247 u16 flags; 248 248 struct xdp_umem *umem = umem_xs->umem; 249 - 250 - /* One fill and completion ring required for each queue id. */ 251 - if (!pool->fq || !pool->cq) 252 - return -EINVAL; 253 249 254 250 flags = umem->zc ? XDP_ZEROCOPY : XDP_COPY; 255 251 if (umem_xs->pool->uses_need_wakeup)
+5
net/xdp/xsk_queue.h
··· 46 46 u64 invalid_descs; 47 47 u64 queue_empty_descs; 48 48 size_t ring_vmalloc_size; 49 + /* Mutual exclusion of the completion ring in the SKB mode. 50 + * Protect: when sockets share a single cq when the same netdev 51 + * and queue id is shared. 52 + */ 53 + spinlock_t cq_cached_prod_lock; 49 54 }; 50 55 51 56 struct parsed_desc {