From: Wei Liu <wei.liu@kernel.org>
To: "Michael Kelley (LINUX)" <mikelley@microsoft.com>
Cc: Dexuan Cui <decui@microsoft.com>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"jgg@ziepe.ca" <jgg@ziepe.ca>,
"bhelgaas@google.com" <bhelgaas@google.com>,
Haiyang Zhang <haiyangz@microsoft.com>,
"kw@linux.com" <kw@linux.com>, KY Srinivasan <kys@microsoft.com>,
"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
"lpieralisi@kernel.org" <lpieralisi@kernel.org>,
"robh@kernel.org" <robh@kernel.org>,
"wei.liu@kernel.org" <wei.liu@kernel.org>,
"helgaas@kernel.org" <helgaas@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] PCI: hv: Fix a crash in hv_pci_restore_msi_msg() during hibernation
Date: Tue, 22 Aug 2023 01:22:17 +0000 [thread overview]
Message-ID: <ZOQNyVtQ9Cilfk92@liuwe-devbox-debian-v2> (raw)
In-Reply-To: <BYAPR21MB16888FCA41CEB8569685FBB1D715A@BYAPR21MB1688.namprd21.prod.outlook.com>
On Wed, Aug 16, 2023 at 08:10:25PM +0000, Michael Kelley (LINUX) wrote:
> From: Dexuan Cui <decui@microsoft.com> Sent: Wednesday, August 16, 2023 11:00 AM
> >
> > When a Linux VM with an assigned PCI device runs on Hyper-V, if the PCI
> > device driver is not loaded yet (i.e. MSI-X/MSI is not enabled on the
> > device yet), doing a VM hibernation triggers a panic in
> > hv_pci_restore_msi_msg() -> msi_lock_descs(&pdev->dev), because
> > pdev->dev.msi.data is still NULL.
> >
> > Avoid the panic by checking if MSI-X/MSI is enabled.
> >
> > Fixes: dc2b453290c4 ("PCI: hv: Rework MSI handling")
> > Signed-off-by: Dexuan Cui <decui@microsoft.com>
> > ---
> >
> > Changes in v2:
> > Replaced the test "if (!pdev->dev.msi.data)" with
> > "if (!pdev->msi_enabled && !pdev->msix_enabled)".
> > Thanks Michael!
> > Updated the changelog accordingly.
> >
> > drivers/pci/controller/pci-hyperv.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
> > index 2d93d0c4f10d..bed3cefdaf19 100644
> > --- a/drivers/pci/controller/pci-hyperv.c
> > +++ b/drivers/pci/controller/pci-hyperv.c
> > @@ -3983,6 +3983,9 @@ static int hv_pci_restore_msi_msg(struct pci_dev *pdev, void *arg)
> > struct msi_desc *entry;
> > int ret = 0;
> >
> > + if (!pdev->msi_enabled && !pdev->msix_enabled)
> > + return 0;
> > +
> > msi_lock_descs(&pdev->dev);
> > msi_for_each_desc(entry, &pdev->dev, MSI_DESC_ASSOCIATED) {
> > irq_data = irq_get_irq_data(entry->irq);
> > --
> > 2.25.1
>
> Reviewed-by: Michael Kelley <mikelley@microsoft.com>
>
>
I expect this to go through the PCI tree. Just let me know if I should
pick this up.
Thanks,
Wei.
next prev parent reply other threads:[~2023-08-22 1:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-16 17:59 Dexuan Cui
2023-08-16 18:04 ` Dexuan Cui
2023-08-16 18:12 ` Kuppuswamy Sathyanarayanan
2023-08-16 19:30 ` Dexuan Cui
2023-08-16 19:37 ` Kuppuswamy Sathyanarayanan
2023-08-16 20:10 ` Michael Kelley (LINUX)
2023-08-22 1:22 ` Wei Liu [this message]
2023-08-22 13:06 ` Lorenzo Pieralisi
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=ZOQNyVtQ9Cilfk92@liuwe-devbox-debian-v2 \
--to=wei.liu@kernel.org \
--cc=bhelgaas@google.com \
--cc=decui@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=helgaas@kernel.org \
--cc=jgg@ziepe.ca \
--cc=kw@linux.com \
--cc=kys@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=mikelley@microsoft.com \
--cc=robh@kernel.org \
--cc=tglx@linutronix.de \
/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
all inboxes | Powered by JetHome®