linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Haiyang Zhang <haiyangz@microsoft.com>
To: "Michael Kelley (LINUX)" <mikelley@microsoft.com>,
	"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Cc: Dexuan Cui <decui@microsoft.com>,
	KY Srinivasan <kys@microsoft.com>,
	Paul Rosswurm <paulros@microsoft.com>,
	"olaf@aepfle.de" <olaf@aepfle.de>,
	"vkuznets@redhat.com" <vkuznets@redhat.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: RE: [PATCH net, 1/2] net: mana: Fix hint value before free irq
Date: Sun, 29 Jan 2023 18:54:29 +0000	[thread overview]
Message-ID: <PH7PR21MB3116242A4D898271E933A23DCAD29@PH7PR21MB3116.namprd21.prod.outlook.com> (raw)
In-Reply-To: <BYAPR21MB1688E80FB5C75DEA549B3FD5D7D29@BYAPR21MB1688.namprd21.prod.outlook.com>



> -----Original Message-----
> From: Michael Kelley (LINUX) <mikelley@microsoft.com>
> Sent: Sunday, January 29, 2023 9:26 AM
> To: Haiyang Zhang <haiyangz@microsoft.com>; linux-hyperv@vger.kernel.org;
> netdev@vger.kernel.org
> Cc: Haiyang Zhang <haiyangz@microsoft.com>; Dexuan Cui
> <decui@microsoft.com>; KY Srinivasan <kys@microsoft.com>; Paul Rosswurm
> <paulros@microsoft.com>; olaf@aepfle.de; vkuznets@redhat.com;
> davem@davemloft.net; linux-kernel@vger.kernel.org; stable@vger.kernel.org
> Subject: RE: [PATCH net, 1/2] net: mana: Fix hint value before free irq
> 
> From: LKML haiyangz <lkmlhyz@microsoft.com> On Behalf Of Haiyang Zhang
> Sent: Thursday, January 26, 2023 1:05 PM
> >
> > Need to clear affinity_hint before free_irq(), otherwise there is a
> > one-time warning and stack trace during module unloading.
> >
> > To fix this bug, set affinity_hint to NULL before free as required.
> >
> > Cc: stable@vger.kernel.org
> > Fixes: 71fa6887eeca ("net: mana: Assign interrupts to CPUs based on NUMA
> nodes")
> > Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> > ---
> >  drivers/net/ethernet/microsoft/mana/gdma_main.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/drivers/net/ethernet/microsoft/mana/gdma_main.c
> > b/drivers/net/ethernet/microsoft/mana/gdma_main.c
> > index b144f2237748..3bae9d4c1f08 100644
> > --- a/drivers/net/ethernet/microsoft/mana/gdma_main.c
> > +++ b/drivers/net/ethernet/microsoft/mana/gdma_main.c
> > @@ -1297,6 +1297,8 @@ static int mana_gd_setup_irqs(struct pci_dev
> *pdev)
> >  	for (j = i - 1; j >= 0; j--) {
> >  		irq = pci_irq_vector(pdev, j);
> >  		gic = &gc->irq_contexts[j];
> > +
> > +		irq_update_affinity_hint(irq, NULL);
> >  		free_irq(irq, gic);
> >  	}
> >
> > @@ -1324,6 +1326,9 @@ static void mana_gd_remove_irqs(struct pci_dev
> *pdev)
> >  			continue;
> >
> >  		gic = &gc->irq_contexts[i];
> > +
> > +		/* Need to clear the hint before free_irq */
> > +		irq_update_affinity_hint(irq, NULL);
> >  		free_irq(irq, gic);
> >  	}
> >
> > --
> > 2.25.1
> 
> I think this patch should be folded into the second patch of this series.  While
> this patch makes the warning go away, it doesn't really solve any problems by
> itself.  It just papers over the warning.  My first reaction on seeing this patch
> is that the warning exists because the memory for the mask likely had
> been incorrectly managed, which is exactly the case.  Since this patch doesn't
> really fix a problem on its own, I'd say merge it into the second patch.
> 
> That's just my $.02.  If you really want to keep it separate, that's not a
> blocker for me.

Will do.

Thanks,
- Haiyang

  reply	other threads:[~2023-01-29 18:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-26 21:04 [PATCH net, 0/2] Fix usage of irq affinity_hint Haiyang Zhang
2023-01-26 21:04 ` [PATCH net, 1/2] net: mana: Fix hint value before free irq Haiyang Zhang
2023-01-29  9:27   ` Leon Romanovsky
2023-01-29 18:51     ` Haiyang Zhang
2023-01-29 14:26   ` Michael Kelley (LINUX)
2023-01-29 18:54     ` Haiyang Zhang [this message]
2023-01-26 21:04 ` [PATCH net, 2/2] net: mana: Fix accessing freed irq affinity_hint Haiyang Zhang
2023-01-29  9:35   ` Leon Romanovsky
2023-01-29 14:26   ` Michael Kelley (LINUX)
2023-01-29 18:51     ` Haiyang Zhang
2023-01-29 19:05       ` Haiyang Zhang

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=PH7PR21MB3116242A4D898271E933A23DCAD29@PH7PR21MB3116.namprd21.prod.outlook.com \
    --to=haiyangz@microsoft.com \
    --cc=davem@davemloft.net \
    --cc=decui@microsoft.com \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikelley@microsoft.com \
    --cc=netdev@vger.kernel.org \
    --cc=olaf@aepfle.de \
    --cc=paulros@microsoft.com \
    --cc=stable@vger.kernel.org \
    --cc=vkuznets@redhat.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).