mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 08:33:17 +02:00
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>
This commit is contained in:
commit
cc75d43783
|
|
@ -90,11 +90,6 @@ struct xsk_buff_pool {
|
|||
* destructor callback.
|
||||
*/
|
||||
spinlock_t cq_prod_lock;
|
||||
/* Mutual exclusion of the completion ring in the SKB mode.
|
||||
* Protect: when sockets share a single cq when the same netdev
|
||||
* and queue id is shared.
|
||||
*/
|
||||
spinlock_t cq_cached_prod_lock;
|
||||
struct xdp_buff_xsk *free_heads[];
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -543,9 +543,9 @@ static int xsk_cq_reserve_locked(struct xsk_buff_pool *pool)
|
|||
{
|
||||
int ret;
|
||||
|
||||
spin_lock(&pool->cq_cached_prod_lock);
|
||||
spin_lock(&pool->cq->cq_cached_prod_lock);
|
||||
ret = xskq_prod_reserve(pool->cq);
|
||||
spin_unlock(&pool->cq_cached_prod_lock);
|
||||
spin_unlock(&pool->cq->cq_cached_prod_lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -619,9 +619,9 @@ static void xsk_cq_submit_addr_locked(struct xsk_buff_pool *pool,
|
|||
|
||||
static void xsk_cq_cancel_locked(struct xsk_buff_pool *pool, u32 n)
|
||||
{
|
||||
spin_lock(&pool->cq_cached_prod_lock);
|
||||
spin_lock(&pool->cq->cq_cached_prod_lock);
|
||||
xskq_prod_cancel_n(pool->cq, n);
|
||||
spin_unlock(&pool->cq_cached_prod_lock);
|
||||
spin_unlock(&pool->cq->cq_cached_prod_lock);
|
||||
}
|
||||
|
||||
INDIRECT_CALLABLE_SCOPE
|
||||
|
|
@ -1349,6 +1349,13 @@ static int xsk_bind(struct socket *sock, struct sockaddr_unsized *addr, int addr
|
|||
}
|
||||
|
||||
if (umem_xs->queue_id != qid || umem_xs->dev != dev) {
|
||||
/* One fill and completion ring required for each queue id. */
|
||||
if (!xsk_validate_queues(xs)) {
|
||||
err = -EINVAL;
|
||||
sockfd_put(sock);
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
/* Share the umem with another socket on another qid
|
||||
* and/or device.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ struct xsk_buff_pool *xp_create_and_assign_umem(struct xdp_sock *xs,
|
|||
INIT_LIST_HEAD(&pool->xsk_tx_list);
|
||||
spin_lock_init(&pool->xsk_tx_list_lock);
|
||||
spin_lock_init(&pool->cq_prod_lock);
|
||||
spin_lock_init(&pool->cq_cached_prod_lock);
|
||||
spin_lock_init(&xs->cq_tmp->cq_cached_prod_lock);
|
||||
refcount_set(&pool->users, 1);
|
||||
|
||||
pool->fq = xs->fq_tmp;
|
||||
|
|
@ -247,10 +247,6 @@ int xp_assign_dev_shared(struct xsk_buff_pool *pool, struct xdp_sock *umem_xs,
|
|||
u16 flags;
|
||||
struct xdp_umem *umem = umem_xs->umem;
|
||||
|
||||
/* One fill and completion ring required for each queue id. */
|
||||
if (!pool->fq || !pool->cq)
|
||||
return -EINVAL;
|
||||
|
||||
flags = umem->zc ? XDP_ZEROCOPY : XDP_COPY;
|
||||
if (umem_xs->pool->uses_need_wakeup)
|
||||
flags |= XDP_USE_NEED_WAKEUP;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,11 @@ struct xsk_queue {
|
|||
u64 invalid_descs;
|
||||
u64 queue_empty_descs;
|
||||
size_t ring_vmalloc_size;
|
||||
/* Mutual exclusion of the completion ring in the SKB mode.
|
||||
* Protect: when sockets share a single cq when the same netdev
|
||||
* and queue id is shared.
|
||||
*/
|
||||
spinlock_t cq_cached_prod_lock;
|
||||
};
|
||||
|
||||
struct parsed_desc {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user