public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: anthony.l.nguyen@intel.com
Cc: Simon Horman <horms@kernel.org>,
	magnus.karlsson@intel.com, maciej.fijalkowski@intel.com,
	sdf@fomichev.me, nxne.cnse.osdt.itp.upstreaming@intel.com,
	daniel@iogearbox.net, davem@davemloft.net,
	aleksander.lobakin@intel.com, kohei@enjuk.jp, pabeni@redhat.com,
	hawk@kernel.org, ast@kernel.org, andrew+netdev@lunn.ch,
	netdev@vger.kernel.org, kuba@kernel.org, edumazet@google.com,
	aleksandr.loktionov@intel.com, john.fastabend@gmail.com,
	bpf@vger.kernel.org, jacob.e.keller@intel.com
Subject: Re: [PATCH net-next v2 3/5] ice: migrate to netdev ops lock
Date: Fri, 27 Mar 2026 13:57:09 +0000	[thread overview]
Message-ID: <20260327135707.590630-3-horms@kernel.org> (raw)
In-Reply-To: <20260325200644.2528726-4-anthony.l.nguyen@intel.com>

This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.

For local reproduction steps see https://netdev-ai.bots.linux.dev/ai-local.html
---
ice: migrate to netdev ops lock

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).

> diff --git a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c
> index bd77f1c001ee..2ca3fc6e8abd 100644
> --- a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c
> +++ b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c

[ ... ]

> @@ -273,14 +273,13 @@ void ice_vsi_cfg_dcb_rings(struct ice_vsi *vsi)
>  /**
>   * ice_dcb_ena_dis_vsi - disable certain VSIs for DCB config/reconfig
>   * @pf: pointer to the PF instance
>   * @ena: true to enable VSIs, false to disable
> - * @locked: true if caller holds RTNL lock, false otherwise
>   *
>   * Before a new DCB configuration can be applied, VSIs of type PF, SWITCHDEV
>   * and CHNL need to be brought down. Following completion of DCB configuration
>   * the VSIs that were downed need to be brought up again. This helper function
>   * does both.
>   */
> -static void ice_dcb_ena_dis_vsi(struct ice_pf *pf, bool ena, bool locked)
> +static void ice_dcb_ena_dis_vsi(struct ice_pf *pf, bool ena)
>  {
>  	int i;
>
> @@ -294,9 +293,9 @@ static void ice_dcb_ena_dis_vsi(struct ice_pf *pf, bool ena, bool locked)
>  		case ICE_VSI_CHNL:
>  		case ICE_VSI_PF:
>  			if (ena)
> -				ice_ena_vsi(vsi, locked);
> +				ice_ena_vsi(vsi);
>  			else
> -				ice_dis_vsi(vsi, locked);
> +				ice_dis_vsi(vsi);
>  			break;
>  		default:
>  			continue;

[Simon says: this seems to be a false positive and what the AI
 suggests seems to be the exact opposite of what is correct]

The DCB callers all hold the RTNL lock rather than the netdev lock. While
ice_ena_vsi() and ice_dis_vsi() now take the netdev lock internally, their
_locked counterparts (ice_ena_vsi_locked and ice_dis_vsi_locked) would be
more appropriate here since the netdev lock is not held by ice_pf_dcb_cfg()
or ice_dcb_process_lldp_set_mib_change().

> diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
> index e7308e381e2f..82f6523bc726 100644
> --- a/drivers/net/ethernet/intel/ice/ice_main.c
> +++ b/drivers/net/ethernet/intel/ice/ice_main.c

[ ... ]

> @@ -7263,7 +7271,7 @@ static void ice_napi_disable_all(struct ice_vsi *vsi)
>  		struct ice_q_vector *q_vector = vsi->q_vectors[q_idx];
>
>  		if (q_vector->rx.rx_ring || q_vector->tx.tx_ring)
> -			napi_disable(&q_vector->napi);
> +			napi_disable_locked(&q_vector->napi);
>
>  		cancel_work_sync(&q_vector->tx.dim.work);
>  		cancel_work_sync(&q_vector->rx.dim.work);

[Simon says: this one seems plausible to me. Could you take a look?]

Does this introduce a lockdep warning in the eswitch/switchdev path?

ice_napi_disable_all() is called via ice_down(), and ice_down() can be
reached through the eswitch path without holding the netdev lock:

ice_eswitch_attach()
  -> ice_eswitch_enable_switchdev()
    -> ice_eswitch_setup_env()
      -> ice_down(uplink_vsi)
        -> ice_napi_disable_all()
          -> napi_disable_locked()

At this point napi_disable_locked() will assert that the netdev lock is
held, but the eswitch code path doesn't take it. The uplink_vsi is the
main PF VSI with a valid netdev, so the early return won't trigger.

Should ice_eswitch_setup_env() take the netdev lock before calling
ice_down(), or should ice_down() have both locked and unlocked variants?

  reply	other threads:[~2026-03-27 13:59 UTC|newest]

Thread overview: 7+ 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 [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=20260327135707.590630-3-horms@kernel.org \
    --to=horms@kernel.org \
    --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=jacob.e.keller@intel.com \
    --cc=john.fastabend@gmail.com \
    --cc=kohei@enjuk.jp \
    --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