From: Jakub Kicinski <kuba@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>,
<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>
Subject: Re: [Intel-wired-lan] [PATCH net-next v2 4/8] net: napi: add CPU affinity to napi->config
Date: Fri, 20 Dec 2024 11:37:11 -0800 [thread overview]
Message-ID: <20241220113711.5b09140b@kernel.org> (raw)
In-Reply-To: <35441a41-d543-4e7b-b0dc-537062d32c9c@intel.com>
On Fri, 20 Dec 2024 12:15:33 -0700 Ahmed Zaki wrote:
> > I don't understand what you're trying to say, could you rephrase?
>
> Sure. After this patch, we have (simplified):
>
> void netif_napi_set_irq(struct napi_struct *napi, int irq, unsigned long
> flags)
> {
> struct irq_glue *glue = NULL;
> int rc;
>
> napi->irq = irq;
>
> #ifdef CONFIG_RFS_ACCEL
> if (napi->dev->rx_cpu_rmap && flags & NAPIF_IRQ_ARFS_RMAP) {
> rc = irq_cpu_rmap_add(napi->dev->rx_cpu_rmap, irq, napi,
> netif_irq_cpu_rmap_notify);
> .
> .
> .
> }
> #endif
>
> if (flags & NAPIF_IRQ_AFFINITY) {
> glue = kzalloc(sizeof(*glue), GFP_KERNEL);
> if (!glue)
> return;
> glue->notify.notify = netif_irq_cpu_rmap_notify;
> glue->notify.release = netif_napi_affinity_release;
> .
> .
> }
> }
>
>
> Both branches assign the new cb function "netif_irq_cpu_rmap_notify()"
> as the new IRQ notifier, but the first branch calls irq_cpu_rmap_add()
> where the notifier is embedded in "struct irq_glue". So the cb function
> needs to assume the notifier is inside irq_glue, so the second "if"
> branch needs to do the same.
First off, I'm still a bit confused why you think the flags should be
per NAPI call and not set at init time, once.
Perhaps rename netif_enable_cpu_rmap() suggested earlier to something
more generic (netif_enable_irq_tracking()?) and pass the flags there?
Or is there a driver which wants to vary the flags per NAPI instance?
Then you can probably register a single unified handler, and inside
that handler check if the device wanted to have rmap or just affinity?
WARNING: multiple messages have this Message-ID (diff)
From: Jakub Kicinski <kuba@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>,
<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>
Subject: Re: [PATCH net-next v2 4/8] net: napi: add CPU affinity to napi->config
Date: Fri, 20 Dec 2024 11:37:11 -0800 [thread overview]
Message-ID: <20241220113711.5b09140b@kernel.org> (raw)
In-Reply-To: <35441a41-d543-4e7b-b0dc-537062d32c9c@intel.com>
On Fri, 20 Dec 2024 12:15:33 -0700 Ahmed Zaki wrote:
> > I don't understand what you're trying to say, could you rephrase?
>
> Sure. After this patch, we have (simplified):
>
> void netif_napi_set_irq(struct napi_struct *napi, int irq, unsigned long
> flags)
> {
> struct irq_glue *glue = NULL;
> int rc;
>
> napi->irq = irq;
>
> #ifdef CONFIG_RFS_ACCEL
> if (napi->dev->rx_cpu_rmap && flags & NAPIF_IRQ_ARFS_RMAP) {
> rc = irq_cpu_rmap_add(napi->dev->rx_cpu_rmap, irq, napi,
> netif_irq_cpu_rmap_notify);
> .
> .
> .
> }
> #endif
>
> if (flags & NAPIF_IRQ_AFFINITY) {
> glue = kzalloc(sizeof(*glue), GFP_KERNEL);
> if (!glue)
> return;
> glue->notify.notify = netif_irq_cpu_rmap_notify;
> glue->notify.release = netif_napi_affinity_release;
> .
> .
> }
> }
>
>
> Both branches assign the new cb function "netif_irq_cpu_rmap_notify()"
> as the new IRQ notifier, but the first branch calls irq_cpu_rmap_add()
> where the notifier is embedded in "struct irq_glue". So the cb function
> needs to assume the notifier is inside irq_glue, so the second "if"
> branch needs to do the same.
First off, I'm still a bit confused why you think the flags should be
per NAPI call and not set at init time, once.
Perhaps rename netif_enable_cpu_rmap() suggested earlier to something
more generic (netif_enable_irq_tracking()?) and pass the flags there?
Or is there a driver which wants to vary the flags per NAPI instance?
Then you can probably register a single unified handler, and inside
that handler check if the device wanted to have rmap or just affinity?
next prev parent reply other threads:[~2024-12-20 19:37 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-18 16:58 [Intel-wired-lan] [PATCH net-next v2 0/8] net: napi: add CPU affinity to napi->config Ahmed Zaki
2024-12-18 16:58 ` Ahmed Zaki
2024-12-18 16:58 ` [Intel-wired-lan] [PATCH net-next v2 1/8] net: napi: add irq_flags to napi struct Ahmed Zaki
2024-12-18 16:58 ` Ahmed Zaki
2024-12-20 3:34 ` [Intel-wired-lan] " Jakub Kicinski
2024-12-20 3:34 ` Jakub Kicinski
2024-12-20 14:50 ` [Intel-wired-lan] " Ahmed Zaki
2024-12-20 14:50 ` Ahmed Zaki
2024-12-18 16:58 ` [Intel-wired-lan] [PATCH net-next v2 2/8] net: allow ARFS rmap management in core Ahmed Zaki
2024-12-18 16:58 ` Ahmed Zaki
2024-12-18 19:56 ` [Intel-wired-lan] " kernel test robot
2024-12-18 16:58 ` [Intel-wired-lan] [PATCH net-next v2 3/8] lib: cpu_rmap: allow passing a notifier callback Ahmed Zaki
2024-12-18 16:58 ` Ahmed Zaki
2024-12-18 16:58 ` [Intel-wired-lan] [PATCH net-next v2 4/8] net: napi: add CPU affinity to napi->config Ahmed Zaki
2024-12-18 16:58 ` Ahmed Zaki
2024-12-18 20:16 ` [Intel-wired-lan] " kernel test robot
2024-12-18 20:27 ` kernel test robot
2024-12-20 3:42 ` Jakub Kicinski
2024-12-20 3:42 ` Jakub Kicinski
2024-12-20 14:51 ` [Intel-wired-lan] " Ahmed Zaki
2024-12-20 14:51 ` Ahmed Zaki
2024-12-20 17:23 ` [Intel-wired-lan] " Jakub Kicinski
2024-12-20 17:23 ` Jakub Kicinski
2024-12-20 19:15 ` [Intel-wired-lan] " Ahmed Zaki
2024-12-20 19:15 ` Ahmed Zaki
2024-12-20 19:37 ` Jakub Kicinski [this message]
2024-12-20 19:37 ` Jakub Kicinski
2024-12-20 20:14 ` [Intel-wired-lan] " Ahmed Zaki
2024-12-20 20:14 ` Ahmed Zaki
2024-12-20 20:51 ` [Intel-wired-lan] " Jakub Kicinski
2024-12-20 20:51 ` Jakub Kicinski
2024-12-18 16:58 ` [Intel-wired-lan] [PATCH net-next v2 5/8] bnxt: use napi's irq affinity Ahmed Zaki
2024-12-18 16:58 ` Ahmed Zaki
2024-12-18 16:58 ` [Intel-wired-lan] [PATCH net-next v2 6/8] ice: " Ahmed Zaki
2024-12-18 16:58 ` Ahmed Zaki
2024-12-18 16:58 ` [Intel-wired-lan] [PATCH net-next v2 7/8] idpf: " Ahmed Zaki
2024-12-18 16:58 ` Ahmed Zaki
2024-12-18 16:58 ` [Intel-wired-lan] [PATCH net-next v2 8/8] mlx4: " Ahmed Zaki
2024-12-18 16:58 ` Ahmed Zaki
2024-12-22 9:23 ` [Intel-wired-lan] [PATCH net-next v2 0/8] net: napi: add CPU affinity to napi->config Shay Drori
2024-12-22 9:23 ` Shay Drori
2025-01-02 21:38 ` [Intel-wired-lan] " Ahmed Zaki
2025-01-02 21:38 ` 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=20241220113711.5b09140b@kernel.org \
--to=kuba@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=michael.chan@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.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 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.