[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z4C7Un9FoSGZ5q98@mev-dev.igk.intel.com>
Date: Fri, 10 Jan 2025 07:16:50 +0100
From: Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com,
pabeni@...hat.com, andrew+netdev@...n.ch, horms@...nel.org,
jdamato@...tly.com, almasrymina@...gle.com
Subject: Re: [PATCH net-next] net: warn during dump if NAPI list is not sorted
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@...nel.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@...tly.com
> CC: almasrymina@...gle.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@...ux.intel.com>
> --
> 2.47.1
Powered by blists - more mailing lists