Skip to content

Commit

Permalink
net: avoid false positive warnings in __net_mp_close_rxq()
Browse files Browse the repository at this point in the history
Commit under Fixes solved the problem of spurious warnings when we
uninstall an MP from a device while its down. The __net_mp_close_rxq()
which is used by io_uring was not fixed. Move the fix over and reuse
__net_mp_close_rxq() in the devmem path.

Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Fixes: a70f891 ("net: devmem: do not WARN conditionally after netdev_rx_queue_restart()")
Reviewed-by: Mina Almasry <almasrymina@google.com>
Link: https://patch.msgid.link/20250403013405.2827250-3-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Jakub Kicinski committed Apr 4, 2025
1 parent ec304b7 commit 34f71de
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 5 additions & 7 deletions net/core/devmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,21 +116,19 @@ void net_devmem_unbind_dmabuf(struct net_devmem_dmabuf_binding *binding)
struct netdev_rx_queue *rxq;
unsigned long xa_idx;
unsigned int rxq_idx;
int err;

if (binding->list.next)
list_del(&binding->list);

xa_for_each(&binding->bound_rxqs, xa_idx, rxq) {
WARN_ON(rxq->mp_params.mp_priv != binding);

rxq->mp_params.mp_priv = NULL;
rxq->mp_params.mp_ops = NULL;
const struct pp_memory_provider_params mp_params = {
.mp_priv = binding,
.mp_ops = &dmabuf_devmem_ops,
};

rxq_idx = get_netdev_rx_queue_index(rxq);

err = netdev_rx_queue_restart(binding->dev, rxq_idx);
WARN_ON(err && err != -ENETDOWN);
__net_mp_close_rxq(binding->dev, rxq_idx, &mp_params);
}

xa_erase(&net_devmem_dmabuf_bindings, binding->id);
Expand Down
4 changes: 3 additions & 1 deletion net/core/netdev_rx_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ void __net_mp_close_rxq(struct net_device *dev, unsigned int ifq_idx,
const struct pp_memory_provider_params *old_p)
{
struct netdev_rx_queue *rxq;
int err;

if (WARN_ON_ONCE(ifq_idx >= dev->real_num_rx_queues))
return;
Expand All @@ -173,7 +174,8 @@ void __net_mp_close_rxq(struct net_device *dev, unsigned int ifq_idx,

rxq->mp_params.mp_ops = NULL;
rxq->mp_params.mp_priv = NULL;
WARN_ON(netdev_rx_queue_restart(dev, ifq_idx));
err = netdev_rx_queue_restart(dev, ifq_idx);
WARN_ON(err && err != -ENETDOWN);
}

void net_mp_close_rxq(struct net_device *dev, unsigned ifq_idx,
Expand Down

0 comments on commit 34f71de

Please sign in to comment.