diff mbox series

[v3,06/14] RDMA/irdma: Use irq_set_affinity_and_hint

Message ID 20210713211502.464259-7-nitesh@redhat.com
State Superseded
Headers show
Series genirq: Cleanup the usage of irq_set_affinity_hint | expand

Commit Message

Nitesh Narayan Lal July 13, 2021, 9:14 p.m. UTC
The driver uses irq_set_affinity_hint() to update the affinity_hint mask
that is consumed by the userspace to distribute the interrupts and to apply
the provided mask as the affinity for its interrupts. However,
irq_set_affinity_hint() applying the provided cpumask as an affinity for
the interrupt is an undocumented side effect.

To remove this side effect irq_set_affinity_hint() has been marked
as deprecated and new interfaces have been introduced. Hence, replace the
irq_set_affinity_hint() with the new interface irq_set_affinity_and_hint()
where the provided mask needs to be applied as the affinity and
affinity_hint pointer needs to be set and replace with
irq_update_affinity_hint() where only affinity_hint needs to be updated.

Signed-off-by: Nitesh Narayan Lal <nitesh@redhat.com>
---
 drivers/infiniband/hw/irdma/hw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Leon Romanovsky July 14, 2021, 12:03 p.m. UTC | #1
On Tue, Jul 13, 2021 at 05:14:54PM -0400, Nitesh Narayan Lal wrote:
> The driver uses irq_set_affinity_hint() to update the affinity_hint mask
> that is consumed by the userspace to distribute the interrupts and to apply
> the provided mask as the affinity for its interrupts. However,
> irq_set_affinity_hint() applying the provided cpumask as an affinity for
> the interrupt is an undocumented side effect.
> 
> To remove this side effect irq_set_affinity_hint() has been marked
> as deprecated and new interfaces have been introduced. Hence, replace the
> irq_set_affinity_hint() with the new interface irq_set_affinity_and_hint()
> where the provided mask needs to be applied as the affinity and
> affinity_hint pointer needs to be set and replace with
> irq_update_affinity_hint() where only affinity_hint needs to be updated.
> 
> Signed-off-by: Nitesh Narayan Lal <nitesh@redhat.com>
> ---
>  drivers/infiniband/hw/irdma/hw.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/irdma/hw.c b/drivers/infiniband/hw/irdma/hw.c
> index 7afb8a6a0526..7f13a051d4de 100644
> --- a/drivers/infiniband/hw/irdma/hw.c
> +++ b/drivers/infiniband/hw/irdma/hw.c
> @@ -537,7 +537,7 @@ static void irdma_destroy_irq(struct irdma_pci_f *rf,
>  	struct irdma_sc_dev *dev = &rf->sc_dev;
>  
>  	dev->irq_ops->irdma_dis_irq(dev, msix_vec->idx);
> -	irq_set_affinity_hint(msix_vec->irq, NULL);
> +	irq_update_affinity_hint(msix_vec->irq, NULL);
>  	free_irq(msix_vec->irq, dev_id);
>  }
>  
> @@ -1087,7 +1087,7 @@ irdma_cfg_ceq_vector(struct irdma_pci_f *rf, struct irdma_ceq *iwceq,
>  	}
>  	cpumask_clear(&msix_vec->mask);
>  	cpumask_set_cpu(msix_vec->cpu_affinity, &msix_vec->mask);
> -	irq_set_affinity_hint(msix_vec->irq, &msix_vec->mask);
> +	irq_set_affinity_and_hint(msix_vec->irq, &msix_vec->mask);

I think that it needs to be irq_update_affinity_hint().

>  	if (status) {
>  		ibdev_dbg(&rf->iwdev->ibdev, "ERR: ceq irq config fail\n");
>  		return IRDMA_ERR_CFG;
> -- 
> 2.27.0
>
Nitesh Lal July 14, 2021, 12:56 p.m. UTC | #2
On Wed, Jul 14, 2021 at 8:03 AM Leon Romanovsky <leonro@nvidia.com> wrote:
>
> On Tue, Jul 13, 2021 at 05:14:54PM -0400, Nitesh Narayan Lal wrote:
> > The driver uses irq_set_affinity_hint() to update the affinity_hint mask
> > that is consumed by the userspace to distribute the interrupts and to apply
> > the provided mask as the affinity for its interrupts. However,
> > irq_set_affinity_hint() applying the provided cpumask as an affinity for
> > the interrupt is an undocumented side effect.
> >
> > To remove this side effect irq_set_affinity_hint() has been marked
> > as deprecated and new interfaces have been introduced. Hence, replace the
> > irq_set_affinity_hint() with the new interface irq_set_affinity_and_hint()
> > where the provided mask needs to be applied as the affinity and
> > affinity_hint pointer needs to be set and replace with
> > irq_update_affinity_hint() where only affinity_hint needs to be updated.
> >
> > Signed-off-by: Nitesh Narayan Lal <nitesh@redhat.com>
> > ---
> >  drivers/infiniband/hw/irdma/hw.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/infiniband/hw/irdma/hw.c b/drivers/infiniband/hw/irdma/hw.c
> > index 7afb8a6a0526..7f13a051d4de 100644
> > --- a/drivers/infiniband/hw/irdma/hw.c
> > +++ b/drivers/infiniband/hw/irdma/hw.c
> > @@ -537,7 +537,7 @@ static void irdma_destroy_irq(struct irdma_pci_f *rf,
> >       struct irdma_sc_dev *dev = &rf->sc_dev;
> >
> >       dev->irq_ops->irdma_dis_irq(dev, msix_vec->idx);
> > -     irq_set_affinity_hint(msix_vec->irq, NULL);
> > +     irq_update_affinity_hint(msix_vec->irq, NULL);
> >       free_irq(msix_vec->irq, dev_id);
> >  }
> >
> > @@ -1087,7 +1087,7 @@ irdma_cfg_ceq_vector(struct irdma_pci_f *rf, struct irdma_ceq *iwceq,
> >       }
> >       cpumask_clear(&msix_vec->mask);
> >       cpumask_set_cpu(msix_vec->cpu_affinity, &msix_vec->mask);
> > -     irq_set_affinity_hint(msix_vec->irq, &msix_vec->mask);
> > +     irq_set_affinity_and_hint(msix_vec->irq, &msix_vec->mask);
>
> I think that it needs to be irq_update_affinity_hint().
>

Ah! I got a little confused from our last conversation about mlx5.

IIUC mlx5 sub-function use case uses irdma (?) and that's why I thought
that perhaps we would also want to define the affinity here from the beginning.

In any case, I will make the change and re-post.

--
Thanks
Nitesh
Nitesh Lal July 15, 2021, 1:25 p.m. UTC | #3
On Wed, Jul 14, 2021 at 9:03 AM Leon Romanovsky <leonro@nvidia.com> wrote:
>

> On Wed, Jul 14, 2021 at 08:56:41AM -0400, Nitesh Lal wrote:

> > On Wed, Jul 14, 2021 at 8:03 AM Leon Romanovsky <leonro@nvidia.com> wrote:

> > >

> > > On Tue, Jul 13, 2021 at 05:14:54PM -0400, Nitesh Narayan Lal wrote:

> > > > The driver uses irq_set_affinity_hint() to update the affinity_hint mask

> > > > that is consumed by the userspace to distribute the interrupts and to apply

> > > > the provided mask as the affinity for its interrupts. However,

> > > > irq_set_affinity_hint() applying the provided cpumask as an affinity for

> > > > the interrupt is an undocumented side effect.

> > > >

> > > > To remove this side effect irq_set_affinity_hint() has been marked

> > > > as deprecated and new interfaces have been introduced. Hence, replace the

> > > > irq_set_affinity_hint() with the new interface irq_set_affinity_and_hint()

> > > > where the provided mask needs to be applied as the affinity and

> > > > affinity_hint pointer needs to be set and replace with

> > > > irq_update_affinity_hint() where only affinity_hint needs to be updated.

> > > >

> > > > Signed-off-by: Nitesh Narayan Lal <nitesh@redhat.com>

> > > > ---

> > > >  drivers/infiniband/hw/irdma/hw.c | 4 ++--

> > > >  1 file changed, 2 insertions(+), 2 deletions(-)

> > > >

> > > > diff --git a/drivers/infiniband/hw/irdma/hw.c b/drivers/infiniband/hw/irdma/hw.c

> > > > index 7afb8a6a0526..7f13a051d4de 100644

> > > > --- a/drivers/infiniband/hw/irdma/hw.c

> > > > +++ b/drivers/infiniband/hw/irdma/hw.c

> > > > @@ -537,7 +537,7 @@ static void irdma_destroy_irq(struct irdma_pci_f *rf,

> > > >       struct irdma_sc_dev *dev = &rf->sc_dev;

> > > >

> > > >       dev->irq_ops->irdma_dis_irq(dev, msix_vec->idx);

> > > > -     irq_set_affinity_hint(msix_vec->irq, NULL);

> > > > +     irq_update_affinity_hint(msix_vec->irq, NULL);

> > > >       free_irq(msix_vec->irq, dev_id);

> > > >  }

> > > >

> > > > @@ -1087,7 +1087,7 @@ irdma_cfg_ceq_vector(struct irdma_pci_f *rf, struct irdma_ceq *iwceq,

> > > >       }

> > > >       cpumask_clear(&msix_vec->mask);

> > > >       cpumask_set_cpu(msix_vec->cpu_affinity, &msix_vec->mask);

> > > > -     irq_set_affinity_hint(msix_vec->irq, &msix_vec->mask);

> > > > +     irq_set_affinity_and_hint(msix_vec->irq, &msix_vec->mask);

> > >

> > > I think that it needs to be irq_update_affinity_hint().

> > >

> >

> > Ah! I got a little confused from our last conversation about mlx5.

> >

> > IIUC mlx5 sub-function use case uses irdma (?) and that's why I thought

> > that perhaps we would also want to define the affinity here from the beginning.

>

> mlx5 is connected to mlx5_ib/mlx5_vdpa e.t.c.

>

> Not sure about that, but I think that only mlx5 implements SIOV model.

>

> >

> > In any case, I will make the change and re-post.

> >


Just FYI, I am hoping to collect more comments in the non-reviewed
patches and address them in v4.
Hence, I will wait for this week if I don't get anything I will just
post another version by making the change in this driver.

-- 
Thanks
Nitesh
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/irdma/hw.c b/drivers/infiniband/hw/irdma/hw.c
index 7afb8a6a0526..7f13a051d4de 100644
--- a/drivers/infiniband/hw/irdma/hw.c
+++ b/drivers/infiniband/hw/irdma/hw.c
@@ -537,7 +537,7 @@  static void irdma_destroy_irq(struct irdma_pci_f *rf,
 	struct irdma_sc_dev *dev = &rf->sc_dev;
 
 	dev->irq_ops->irdma_dis_irq(dev, msix_vec->idx);
-	irq_set_affinity_hint(msix_vec->irq, NULL);
+	irq_update_affinity_hint(msix_vec->irq, NULL);
 	free_irq(msix_vec->irq, dev_id);
 }
 
@@ -1087,7 +1087,7 @@  irdma_cfg_ceq_vector(struct irdma_pci_f *rf, struct irdma_ceq *iwceq,
 	}
 	cpumask_clear(&msix_vec->mask);
 	cpumask_set_cpu(msix_vec->cpu_affinity, &msix_vec->mask);
-	irq_set_affinity_hint(msix_vec->irq, &msix_vec->mask);
+	irq_set_affinity_and_hint(msix_vec->irq, &msix_vec->mask);
 	if (status) {
 		ibdev_dbg(&rf->iwdev->ibdev, "ERR: ceq irq config fail\n");
 		return IRDMA_ERR_CFG;