All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com,
	pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org,
	jdamato@fastly.com, almasrymina@google.com
Subject: Re: [PATCH net-next] net: warn during dump if NAPI list is not sorted
Date: Fri, 10 Jan 2025 07:16:50 +0100	[thread overview]
Message-ID: <Z4C7Un9FoSGZ5q98@mev-dev.igk.intel.com> (raw)
In-Reply-To: <20250110004505.3210140-1-kuba@kernel.org>

On Thu, Jan 09, 2025 at 04:45:04PM -0800, Jakub Kicinski wrote:
> Dump continuation depends on the NAPI list being sorted.
> Broken netlink dump continuation may be rare and hard to debug
> so add a warning if we notice the potential problem while walking
> the list.
> 
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> This is really a follow up to commit d6c7b03497ee ("net: make sure
> we retain NAPI ordering on netdev->napi_list") but I had to wait
> for some fixes to make it to net-next.
> 
> CC: jdamato@fastly.com
> CC: almasrymina@google.com
> ---
>  net/core/netdev-genl.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c
> index a3bdaf075b6b..c59619a2ec23 100644
> --- a/net/core/netdev-genl.c
> +++ b/net/core/netdev-genl.c
> @@ -263,14 +263,21 @@ netdev_nl_napi_dump_one(struct net_device *netdev, struct sk_buff *rsp,
>  			struct netdev_nl_dump_ctx *ctx)
>  {
>  	struct napi_struct *napi;
> +	unsigned int prev_id;
>  	int err = 0;
>  
>  	if (!(netdev->flags & IFF_UP))
>  		return err;
>  
> +	prev_id = UINT_MAX;
>  	list_for_each_entry(napi, &netdev->napi_list, dev_list) {
>  		if (napi->napi_id < MIN_NAPI_ID)
>  			continue;
> +
> +		/* Dump continuation below depends on the list being sorted */
> +		WARN_ON_ONCE(napi->napi_id >= prev_id);
> +		prev_id = napi->napi_id;
> +
>  		if (ctx->napi_id && napi->napi_id >= ctx->napi_id)
>  			continue;
>  

Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>

> -- 
> 2.47.1

  reply	other threads:[~2025-01-10  6:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-10  0:45 [PATCH net-next] net: warn during dump if NAPI list is not sorted Jakub Kicinski
2025-01-10  6:16 ` Michal Swiatkowski [this message]
2025-01-10 18:06 ` Joe Damato
2025-01-11  2:50 ` patchwork-bot+netdevbpf

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=Z4C7Un9FoSGZ5q98@mev-dev.igk.intel.com \
    --to=michal.swiatkowski@linux.intel.com \
    --cc=almasrymina@google.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jdamato@fastly.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.