netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] bnxt_en: use irq_update_affinity_hint()
@ 2024-11-06 18:08 Mohammad Heib
  2024-11-06 23:24 ` Andy Gospodarek
  2024-11-12  0:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 4+ messages in thread
From: Mohammad Heib @ 2024-11-06 18:08 UTC (permalink / raw)
  To: netdev, michael.chan; +Cc: Mohammad Heib

irq_set_affinity_hint() is deprecated, Use irq_update_affinity_hint()
instead. This removes the side-effect of actually applying the affinity.

The driver does not really need to worry about spreading its IRQs across
CPUs. The core code already takes care of that. when the driver applies the
affinities by itself, it breaks the users' expectations:

 1. The user configures irqbalance with IRQBALANCE_BANNED_CPULIST in
    order to prevent IRQs from being moved to certain CPUs that run a
    real-time workload.

 2. bnxt_en device reopening will resets the affinity
    in bnxt_open().

 3. bnxt_en has no idea about irqbalance's config, so it may move an IRQ to
    a banned CPU. The real-time workload suffers unacceptable latency.

Signed-off-by: Mohammad Heib <mheib@redhat.com>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 99d025b69079..cd82f93b20a1 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -10885,7 +10885,7 @@ static void bnxt_free_irq(struct bnxt *bp)
 		irq = &bp->irq_tbl[map_idx];
 		if (irq->requested) {
 			if (irq->have_cpumask) {
-				irq_set_affinity_hint(irq->vector, NULL);
+				irq_update_affinity_hint(irq->vector, NULL);
 				free_cpumask_var(irq->cpu_mask);
 				irq->have_cpumask = 0;
 			}
@@ -10940,10 +10940,10 @@ static int bnxt_request_irq(struct bnxt *bp)
 			irq->have_cpumask = 1;
 			cpumask_set_cpu(cpumask_local_spread(i, numa_node),
 					irq->cpu_mask);
-			rc = irq_set_affinity_hint(irq->vector, irq->cpu_mask);
+			rc = irq_update_affinity_hint(irq->vector, irq->cpu_mask);
 			if (rc) {
 				netdev_warn(bp->dev,
-					    "Set affinity failed, IRQ = %d\n",
+					    "Update affinity hint failed, IRQ = %d\n",
 					    irq->vector);
 				break;
 			}
-- 
2.34.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net] bnxt_en: use irq_update_affinity_hint()
  2024-11-06 18:08 [PATCH net] bnxt_en: use irq_update_affinity_hint() Mohammad Heib
@ 2024-11-06 23:24 ` Andy Gospodarek
  2024-11-07  3:42   ` Somnath Kotur
  2024-11-12  0:10 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 4+ messages in thread
From: Andy Gospodarek @ 2024-11-06 23:24 UTC (permalink / raw)
  To: Mohammad Heib; +Cc: netdev, michael.chan, skotur

On Wed, Nov 06, 2024 at 08:08:11PM +0200, Mohammad Heib wrote:
> irq_set_affinity_hint() is deprecated, Use irq_update_affinity_hint()
> instead. This removes the side-effect of actually applying the affinity.
> 
> The driver does not really need to worry about spreading its IRQs across
> CPUs. The core code already takes care of that. when the driver applies the
> affinities by itself, it breaks the users' expectations:
> 
>  1. The user configures irqbalance with IRQBALANCE_BANNED_CPULIST in
>     order to prevent IRQs from being moved to certain CPUs that run a
>     real-time workload.
> 
>  2. bnxt_en device reopening will resets the affinity
>     in bnxt_open().
> 
>  3. bnxt_en has no idea about irqbalance's config, so it may move an IRQ to
>     a banned CPU. The real-time workload suffers unacceptable latency.
> 

Thanks for the patch.  This seems inline with what have been done in other
drivers.

> Signed-off-by: Mohammad Heib <mheib@redhat.com>
Reviewed-by: Andy Gospodarek <gospo@broadcom.com>

> ---
>  drivers/net/ethernet/broadcom/bnxt/bnxt.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> index 99d025b69079..cd82f93b20a1 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> @@ -10885,7 +10885,7 @@ static void bnxt_free_irq(struct bnxt *bp)
>  		irq = &bp->irq_tbl[map_idx];
>  		if (irq->requested) {
>  			if (irq->have_cpumask) {
> -				irq_set_affinity_hint(irq->vector, NULL);
> +				irq_update_affinity_hint(irq->vector, NULL);
>  				free_cpumask_var(irq->cpu_mask);
>  				irq->have_cpumask = 0;
>  			}
> @@ -10940,10 +10940,10 @@ static int bnxt_request_irq(struct bnxt *bp)
>  			irq->have_cpumask = 1;
>  			cpumask_set_cpu(cpumask_local_spread(i, numa_node),
>  					irq->cpu_mask);
> -			rc = irq_set_affinity_hint(irq->vector, irq->cpu_mask);
> +			rc = irq_update_affinity_hint(irq->vector, irq->cpu_mask);
>  			if (rc) {
>  				netdev_warn(bp->dev,
> -					    "Set affinity failed, IRQ = %d\n",
> +					    "Update affinity hint failed, IRQ = %d\n",
>  					    irq->vector);
>  				break;
>  			}
> -- 
> 2.34.3
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] bnxt_en: use irq_update_affinity_hint()
  2024-11-06 23:24 ` Andy Gospodarek
@ 2024-11-07  3:42   ` Somnath Kotur
  0 siblings, 0 replies; 4+ messages in thread
From: Somnath Kotur @ 2024-11-07  3:42 UTC (permalink / raw)
  To: Andy Gospodarek; +Cc: Mohammad Heib, netdev, michael.chan, skotur

[-- Attachment #1: Type: text/plain, Size: 3005 bytes --]

On Thu, Nov 7, 2024 at 4:54 AM Andy Gospodarek
<andrew.gospodarek@broadcom.com> wrote:
>
> On Wed, Nov 06, 2024 at 08:08:11PM +0200, Mohammad Heib wrote:
> > irq_set_affinity_hint() is deprecated, Use irq_update_affinity_hint()
> > instead. This removes the side-effect of actually applying the affinity.
> >
> > The driver does not really need to worry about spreading its IRQs across
> > CPUs. The core code already takes care of that. when the driver applies the
> > affinities by itself, it breaks the users' expectations:
> >
> >  1. The user configures irqbalance with IRQBALANCE_BANNED_CPULIST in
> >     order to prevent IRQs from being moved to certain CPUs that run a
> >     real-time workload.
> >
> >  2. bnxt_en device reopening will resets the affinity
> >     in bnxt_open().
> >
> >  3. bnxt_en has no idea about irqbalance's config, so it may move an IRQ to
> >     a banned CPU. The real-time workload suffers unacceptable latency.
> >
>
> Thanks for the patch.  This seems inline with what have been done in other
> drivers.
>
> > Signed-off-by: Mohammad Heib <mheib@redhat.com>
> Reviewed-by: Andy Gospodarek <gospo@broadcom.com>
>
> > ---
> >  drivers/net/ethernet/broadcom/bnxt/bnxt.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> > index 99d025b69079..cd82f93b20a1 100644
> > --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> > +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> > @@ -10885,7 +10885,7 @@ static void bnxt_free_irq(struct bnxt *bp)
> >               irq = &bp->irq_tbl[map_idx];
> >               if (irq->requested) {
> >                       if (irq->have_cpumask) {
> > -                             irq_set_affinity_hint(irq->vector, NULL);
> > +                             irq_update_affinity_hint(irq->vector, NULL);
> >                               free_cpumask_var(irq->cpu_mask);
> >                               irq->have_cpumask = 0;
> >                       }
> > @@ -10940,10 +10940,10 @@ static int bnxt_request_irq(struct bnxt *bp)
> >                       irq->have_cpumask = 1;
> >                       cpumask_set_cpu(cpumask_local_spread(i, numa_node),
> >                                       irq->cpu_mask);
> > -                     rc = irq_set_affinity_hint(irq->vector, irq->cpu_mask);
> > +                     rc = irq_update_affinity_hint(irq->vector, irq->cpu_mask);
> >                       if (rc) {
> >                               netdev_warn(bp->dev,
> > -                                         "Set affinity failed, IRQ = %d\n",
> > +                                         "Update affinity hint failed, IRQ = %d\n",
> >                                           irq->vector);
> >                               break;
> >                       }
> > --
> > 2.34.3
> >
>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4212 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] bnxt_en: use irq_update_affinity_hint()
  2024-11-06 18:08 [PATCH net] bnxt_en: use irq_update_affinity_hint() Mohammad Heib
  2024-11-06 23:24 ` Andy Gospodarek
@ 2024-11-12  0:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-11-12  0:10 UTC (permalink / raw)
  To: Mohammad Heib; +Cc: netdev, michael.chan

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed,  6 Nov 2024 20:08:11 +0200 you wrote:
> irq_set_affinity_hint() is deprecated, Use irq_update_affinity_hint()
> instead. This removes the side-effect of actually applying the affinity.
> 
> The driver does not really need to worry about spreading its IRQs across
> CPUs. The core code already takes care of that. when the driver applies the
> affinities by itself, it breaks the users' expectations:
> 
> [...]

Here is the summary with links:
  - [net] bnxt_en: use irq_update_affinity_hint()
    https://git.kernel.org/netdev/net-next/c/fcf42409c6e1

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-11-12  0:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-06 18:08 [PATCH net] bnxt_en: use irq_update_affinity_hint() Mohammad Heib
2024-11-06 23:24 ` Andy Gospodarek
2024-11-07  3:42   ` Somnath Kotur
2024-11-12  0:10 ` patchwork-bot+netdevbpf

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