netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Ahmed Zaki <ahmed.zaki@intel.com>
Cc: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org,
	andrew+netdev@lunn.ch, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, davem@davemloft.net,
	michael.chan@broadcom.com, tariqt@nvidia.com,
	anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com,
	jdamato@fastly.com, shayd@nvidia.com, akpm@linux-foundation.org,
	shayagr@amazon.com, kalesh-anakkur.purayil@broadcom.com
Subject: Re: [PATCH net-next v4 2/6] net: napi: add internal ARFS rmap management
Date: Fri, 10 Jan 2025 11:55:48 +0000	[thread overview]
Message-ID: <20250110115548.GB7706@kernel.org> (raw)
In-Reply-To: <20250109233107.17519-3-ahmed.zaki@intel.com>

On Thu, Jan 09, 2025 at 04:31:03PM -0700, Ahmed Zaki wrote:
> For drivers using the netif_enable_cpu_rmap(), move the IRQ rmap notifier
> inside the napi_struct.
> 
> Signed-off-by: Ahmed Zaki <ahmed.zaki@intel.com>

...

> diff --git a/net/core/dev.c b/net/core/dev.c

...

> +static int napi_irq_cpu_rmap_add(struct napi_struct *napi, int irq)
> +{
> +	struct cpu_rmap *rmap = napi->dev->rx_cpu_rmap;
> +	int rc;
> +
> +	if (!napi || !rmap)
> +		return -EINVAL;

Hi Ahmed,

Here it is assumed that napi may be NULL.  But it is dereferenced
unconditionally on the first like of this function.

Flagged by Smatch.

> +	napi->notify.notify = netif_irq_cpu_rmap_notify;
> +	napi->notify.release = netif_napi_affinity_release;
> +	cpu_rmap_get(rmap);
> +	rc = cpu_rmap_add(rmap, napi);
> +	if (rc < 0)
> +		goto err_add;
> +
> +	napi->napi_rmap_idx = rc;
> +	rc = irq_set_affinity_notifier(irq, &napi->notify);
> +	if (rc)
> +		goto err_set;
> +
> +	return 0;
> +
> +err_set:
> +	rmap->obj[napi->napi_rmap_idx] = NULL;
> +err_add:
> +	cpu_rmap_put(rmap);
> +	return rc;
> +}
>  #endif
>  
>  void netif_napi_set_irq(struct napi_struct *napi, int irq)

...

-- 
pw-bot: changes-requested

  reply	other threads:[~2025-01-10 11:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-09 23:31 [PATCH net-next v4 0/6] net: napi: add CPU affinity to napi->config Ahmed Zaki
2025-01-09 23:31 ` [PATCH net-next v4 1/6] net: move ARFS rmap management to core Ahmed Zaki
2025-01-10 11:59   ` Simon Horman
2025-01-10 15:13     ` Ahmed Zaki
2025-01-09 23:31 ` [PATCH net-next v4 2/6] net: napi: add internal ARFS rmap management Ahmed Zaki
2025-01-10 11:55   ` Simon Horman [this message]
2025-01-10 15:16     ` Ahmed Zaki
2025-01-09 23:31 ` [PATCH net-next v4 3/6] net: napi: add CPU affinity to napi_config Ahmed Zaki
2025-01-10  2:28   ` [Intel-wired-lan] " kernel test robot
2025-01-10  3:00   ` kernel test robot
2025-01-09 23:31 ` [PATCH net-next v4 4/6] bnxt: use napi's irq affinity Ahmed Zaki
2025-01-09 23:31 ` [PATCH net-next v4 5/6] ice: " Ahmed Zaki
2025-01-09 23:31 ` [PATCH net-next v4 6/6] idpf: " Ahmed Zaki

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=20250110115548.GB7706@kernel.org \
    --to=horms@kernel.org \
    --cc=ahmed.zaki@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jdamato@fastly.com \
    --cc=kalesh-anakkur.purayil@broadcom.com \
    --cc=kuba@kernel.org \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=shayagr@amazon.com \
    --cc=shayd@nvidia.com \
    --cc=tariqt@nvidia.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).