From: Michael Ellerman <mpe@ellerman.id.au>
To: Bjorn Helgaas <helgaas@kernel.org>,
Krishna Kumar <krishnak@linux.ibm.com>
Cc: npiggin@gmail.com, linuxppc-dev@lists.ozlabs.org,
linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
brking@linux.vnet.ibm.com, gbatra@linux.ibm.com,
aneesh.kumar@kernel.org, christophe.leroy@csgroup.eu,
nathanl@linux.ibm.com, bhelgaas@google.com, oohall@gmail.com,
tpearson@raptorengineering.com, mahesh.salgaonkar@in.ibm.com
Subject: Re: [PATCH v3 1/2] pci/hotplug/pnv_php: Fix hotplug driver crash on Powernv
Date: Fri, 28 Jun 2024 15:34:37 +1000 [thread overview]
Message-ID: <87jzi9ljf6.fsf@mail.lhotse> (raw)
In-Reply-To: <20240626152154.GA1467164@bhelgaas>
Bjorn Helgaas <helgaas@kernel.org> writes:
> I expect this series would go through the powerpc tree since that's
> where most of the chance is.
Thanks, yeah I'll plan to merge v4 with your comments addressed.
cheers
> On Mon, Jun 24, 2024 at 05:39:27PM +0530, Krishna Kumar wrote:
>> Description of the problem: The hotplug driver for powerpc
>> (pci/hotplug/pnv_php.c) gives kernel crash when we try to
>> hot-unplug/disable the PCIe switch/bridge from the PHB.
>>
>> Root Cause of Crash: The crash is due to the reason that, though the msi
>> data structure has been released during disable/hot-unplug path and it
>> has been assigned with NULL, still during unregistartion the code was
>> again trying to explicitly disable the msi which causes the Null pointer
>> dereference and kernel crash.
>
> s/unregistartion/unregistration/
> s/Null/NULL/ to match previous use
> s/msi/MSI/ to match spec usage
>
>> Proposed Fix : The fix is to correct the check during unregistration path
>> so that the code should not try to invoke pci_disable_msi/msix() if its
>> data structure is already freed.
>
> s/Proposed Fix : The fix is to// ... Just say what the patch does.
>
> If/when the powerpc folks like this, add my:
>
> Acked-by: Bjorn Helgaas <bhelgaas@google.com>
>
>> Cc: Michael Ellerman <mpe@ellerman.id.au>
>> Cc: Nicholas Piggin <npiggin@gmail.com>
>> Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
>> Cc: "Aneesh Kumar K.V" <aneesh.kumar@kernel.org>
>> Cc: Bjorn Helgaas <bhelgaas@google.com>
>> Cc: Gaurav Batra <gbatra@linux.ibm.com>
>> Cc: Nathan Lynch <nathanl@linux.ibm.com>
>> Cc: Brian King <brking@linux.vnet.ibm.com>
>>
>> Signed-off-by: Krishna Kumar <krishnak@linux.ibm.com>
>> ---
>> drivers/pci/hotplug/pnv_php.c | 3 +--
>> 1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/pci/hotplug/pnv_php.c b/drivers/pci/hotplug/pnv_php.c
>> index 694349be9d0a..573a41869c15 100644
>> --- a/drivers/pci/hotplug/pnv_php.c
>> +++ b/drivers/pci/hotplug/pnv_php.c
>> @@ -40,7 +40,6 @@ static void pnv_php_disable_irq(struct pnv_php_slot *php_slot,
>> bool disable_device)
>> {
>> struct pci_dev *pdev = php_slot->pdev;
>> - int irq = php_slot->irq;
>> u16 ctrl;
>>
>> if (php_slot->irq > 0) {
>> @@ -59,7 +58,7 @@ static void pnv_php_disable_irq(struct pnv_php_slot *php_slot,
>> php_slot->wq = NULL;
>> }
>>
>> - if (disable_device || irq > 0) {
>> + if (disable_device) {
>> if (pdev->msix_enabled)
>> pci_disable_msix(pdev);
>> else if (pdev->msi_enabled)
>> --
>> 2.45.0
>>
WARNING: multiple messages have this Message-ID (diff)
From: Michael Ellerman <mpe@ellerman.id.au>
To: Bjorn Helgaas <helgaas@kernel.org>,
Krishna Kumar <krishnak@linux.ibm.com>
Cc: nathanl@linux.ibm.com, aneesh.kumar@kernel.org,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
npiggin@gmail.com, gbatra@linux.ibm.com, bhelgaas@google.com,
tpearson@raptorengineering.com, oohall@gmail.com,
christophe.leroy@csgroup.eu, brking@linux.vnet.ibm.com,
mahesh.salgaonkar@in.ibm.com, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v3 1/2] pci/hotplug/pnv_php: Fix hotplug driver crash on Powernv
Date: Fri, 28 Jun 2024 15:34:37 +1000 [thread overview]
Message-ID: <87jzi9ljf6.fsf@mail.lhotse> (raw)
In-Reply-To: <20240626152154.GA1467164@bhelgaas>
Bjorn Helgaas <helgaas@kernel.org> writes:
> I expect this series would go through the powerpc tree since that's
> where most of the chance is.
Thanks, yeah I'll plan to merge v4 with your comments addressed.
cheers
> On Mon, Jun 24, 2024 at 05:39:27PM +0530, Krishna Kumar wrote:
>> Description of the problem: The hotplug driver for powerpc
>> (pci/hotplug/pnv_php.c) gives kernel crash when we try to
>> hot-unplug/disable the PCIe switch/bridge from the PHB.
>>
>> Root Cause of Crash: The crash is due to the reason that, though the msi
>> data structure has been released during disable/hot-unplug path and it
>> has been assigned with NULL, still during unregistartion the code was
>> again trying to explicitly disable the msi which causes the Null pointer
>> dereference and kernel crash.
>
> s/unregistartion/unregistration/
> s/Null/NULL/ to match previous use
> s/msi/MSI/ to match spec usage
>
>> Proposed Fix : The fix is to correct the check during unregistration path
>> so that the code should not try to invoke pci_disable_msi/msix() if its
>> data structure is already freed.
>
> s/Proposed Fix : The fix is to// ... Just say what the patch does.
>
> If/when the powerpc folks like this, add my:
>
> Acked-by: Bjorn Helgaas <bhelgaas@google.com>
>
>> Cc: Michael Ellerman <mpe@ellerman.id.au>
>> Cc: Nicholas Piggin <npiggin@gmail.com>
>> Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
>> Cc: "Aneesh Kumar K.V" <aneesh.kumar@kernel.org>
>> Cc: Bjorn Helgaas <bhelgaas@google.com>
>> Cc: Gaurav Batra <gbatra@linux.ibm.com>
>> Cc: Nathan Lynch <nathanl@linux.ibm.com>
>> Cc: Brian King <brking@linux.vnet.ibm.com>
>>
>> Signed-off-by: Krishna Kumar <krishnak@linux.ibm.com>
>> ---
>> drivers/pci/hotplug/pnv_php.c | 3 +--
>> 1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/pci/hotplug/pnv_php.c b/drivers/pci/hotplug/pnv_php.c
>> index 694349be9d0a..573a41869c15 100644
>> --- a/drivers/pci/hotplug/pnv_php.c
>> +++ b/drivers/pci/hotplug/pnv_php.c
>> @@ -40,7 +40,6 @@ static void pnv_php_disable_irq(struct pnv_php_slot *php_slot,
>> bool disable_device)
>> {
>> struct pci_dev *pdev = php_slot->pdev;
>> - int irq = php_slot->irq;
>> u16 ctrl;
>>
>> if (php_slot->irq > 0) {
>> @@ -59,7 +58,7 @@ static void pnv_php_disable_irq(struct pnv_php_slot *php_slot,
>> php_slot->wq = NULL;
>> }
>>
>> - if (disable_device || irq > 0) {
>> + if (disable_device) {
>> if (pdev->msix_enabled)
>> pci_disable_msix(pdev);
>> else if (pdev->msi_enabled)
>> --
>> 2.45.0
>>
next prev parent reply other threads:[~2024-06-28 5:34 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-24 12:09 [PATCH v3 0/2] PCI hotplug driver fixes Krishna Kumar
2024-06-24 12:09 ` Krishna Kumar
2024-06-24 12:09 ` [PATCH v3 1/2] pci/hotplug/pnv_php: Fix hotplug driver crash on Powernv Krishna Kumar
2024-06-24 12:09 ` Krishna Kumar
2024-06-26 15:21 ` Bjorn Helgaas
2024-06-26 15:21 ` Bjorn Helgaas
2024-06-28 5:34 ` Michael Ellerman [this message]
2024-06-28 5:34 ` Michael Ellerman
2024-06-27 17:08 ` Shawn Anastasio
2024-06-27 17:08 ` Shawn Anastasio
2024-06-28 4:48 ` Michael Ellerman
2024-06-28 4:48 ` Michael Ellerman
2024-06-28 19:22 ` Shawn Anastasio
2024-06-28 19:22 ` Shawn Anastasio
2024-06-29 7:30 ` Michael Ellerman
2024-06-29 7:30 ` Michael Ellerman
2024-06-24 12:09 ` [PATCH v3 2/2] powerpc: hotplug driver bridge support Krishna Kumar
2024-06-24 12:09 ` Krishna Kumar
2024-06-27 17:11 ` Shawn Anastasio
2024-06-27 17:11 ` Shawn Anastasio
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=87jzi9ljf6.fsf@mail.lhotse \
--to=mpe@ellerman.id.au \
--cc=aneesh.kumar@kernel.org \
--cc=bhelgaas@google.com \
--cc=brking@linux.vnet.ibm.com \
--cc=christophe.leroy@csgroup.eu \
--cc=gbatra@linux.ibm.com \
--cc=helgaas@kernel.org \
--cc=krishnak@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mahesh.salgaonkar@in.ibm.com \
--cc=nathanl@linux.ibm.com \
--cc=npiggin@gmail.com \
--cc=oohall@gmail.com \
--cc=tpearson@raptorengineering.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.