public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Kohei Enju <kohei@enjuk.jp>
To: Tony Nguyen <anthony.l.nguyen@intel.com>
Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
	edumazet@google.com, andrew+netdev@lunn.ch,
	netdev@vger.kernel.org,
	Alexander Lobakin <aleksander.lobakin@intel.com>,
	jacob.e.keller@intel.com,
	nxne.cnse.osdt.itp.upstreaming@intel.com, horms@kernel.org,
	maciej.fijalkowski@intel.com, magnus.karlsson@intel.com,
	ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org,
	john.fastabend@gmail.com, sdf@fomichev.me, bpf@vger.kernel.org,
	Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Subject: Re: [PATCH net-next v2 3/5] ice: migrate to netdev ops lock
Date: Mon, 30 Mar 2026 03:01:04 +0900	[thread overview]
Message-ID: <aclmhA5yjXfzX_Jk@x1> (raw)
In-Reply-To: <20260325200644.2528726-4-anthony.l.nguyen@intel.com>

On 03/25 13:06, Tony Nguyen wrote:
> From: Alexander Lobakin <aleksander.lobakin@intel.com>
> 
> Queue management ops unconditionally enable netdev locking. The same
> lock is taken by default by several NAPI configuration functions,
> such as napi_enable() and netif_napi_set_irq().
> Request ops locking in advance and make sure we use the _locked
> counterparts of those functions to avoid deadlocks, taking the lock
> manually where needed (suspend/resume, queue rebuild and resets).
> 

I've been testing this series and found that attaching XDP program
hangs:
    ip/1033 is trying to acquire lock:
    ffff888103d8ec30 (&dev->lock){+.+.}-{4:4}, at: xdp_features_set_redirect_target+0x1f/0x80
    
    but task is already holding lock:
    ffff888103d8ec30 (&dev->lock){+.+.}-{4:4}, at: do_setlink.isra.0+0x261/0x39a0
    
    other info that might help us debug this:
     Possible unsafe locking scenario:
    
           CPU0
           ----
      lock(&dev->lock);
      lock(&dev->lock);
    
     *** DEADLOCK ***
    
     May be due to missing lock nesting notation
    
    3 locks held by ip/1033:
     #0: ffffffff86d8b548 (rtnl_mutex){+.+.}-{4:4}, at: rtnl_newlink+0x6c4/0x22a0
     #1: ffff888103d8ec30 (&dev->lock){+.+.}-{4:4}, at: do_setlink.isra.0+0x261/0x39a0
     #2: ffff888104e1c5b8 (&vsi->xdp_state_lock){+.+.}-{4:4}, at: ice_xdp+0x96/0xef0
    
    stack backtrace:
    CPU: 1 UID: 0 PID: 1033 Comm: ip Not tainted 7.0.0-rc4-enjuk-tnguy-00940-gadae968a1b0a #316 PREEMPT(full)
    Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
    Call Trace:
     <TASK>
     dump_stack_lvl+0x6f/0xb0
     print_deadlock_bug.cold+0xc0/0xce
     __lock_acquire+0x123d/0x1b90
     lock_acquire+0x192/0x310
     __mutex_lock+0x193/0x2860
     xdp_features_set_redirect_target+0x1f/0x80
     ice_xdp+0x64d/0xef0
     dev_xdp_install+0x3c4/0x840
     dev_xdp_attach+0x50a/0x10a0
     dev_change_xdp_fd+0x175/0x210
     do_setlink.isra.0+0x1c1b/0x39a0
    [...]


I think we should use locked versions for both
xdp_features_{set,clear}_redirect_target(), and this fixed that for me.

---
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index 3477c53316ba..0be225ab9372 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -3015,9 +3015,9 @@ ice_xdp_setup_prog(struct ice_vsi *vsi, struct bpf_prog *prog,
                                goto resume_if;
                        }
                }
-               xdp_features_set_redirect_target(vsi->netdev, true);
+               xdp_features_set_redirect_target_locked(vsi->netdev, true);
        } else if (ice_is_xdp_ena_vsi(vsi) && !prog) {
-               xdp_features_clear_redirect_target(vsi->netdev);
+               xdp_features_clear_redirect_target_locked(vsi->netdev);
                xdp_ring_err = ice_destroy_xdp_rings(vsi, ICE_XDP_CFG_FULL);
                if (xdp_ring_err)
                        NL_SET_ERR_MSG_MOD(extack, "Freeing XDP Tx resources failed");


  parent reply	other threads:[~2026-03-29 18:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-25 20:06 [PATCH net-next v2 0/5][pull request] ice: add support for devmem/io_uring Rx and Tx Tony Nguyen
2026-03-25 20:06 ` [PATCH net-next v2 1/5] libeth: pass Rx queue index to PP when creating a fill queue Tony Nguyen
2026-03-25 20:06 ` [PATCH net-next v2 2/5] libeth: handle creating pools with unreadable buffers Tony Nguyen
2026-03-25 20:06 ` [PATCH net-next v2 3/5] ice: migrate to netdev ops lock Tony Nguyen
2026-03-27 13:57   ` Simon Horman
2026-03-29 18:01   ` Kohei Enju [this message]
2026-03-25 20:06 ` [PATCH net-next v2 4/5] ice: implement Rx queue management ops Tony Nguyen
2026-03-25 20:06 ` [PATCH net-next v2 5/5] ice: add support for transmitting unreadable frags Tony Nguyen

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=aclmhA5yjXfzX_Jk@x1 \
    --to=kohei@enjuk.jp \
    --cc=aleksander.lobakin@intel.com \
    --cc=aleksandr.loktionov@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=horms@kernel.org \
    --cc=jacob.e.keller@intel.com \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=maciej.fijalkowski@intel.com \
    --cc=magnus.karlsson@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=nxne.cnse.osdt.itp.upstreaming@intel.com \
    --cc=pabeni@redhat.com \
    --cc=sdf@fomichev.me \
    /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