* [PATCH v3 0/2] PCI hotplug driver fixes
@ 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 ` [PATCH v3 2/2] powerpc: hotplug driver bridge support Krishna Kumar
0 siblings, 2 replies; 10+ messages in thread
From: Krishna Kumar @ 2024-06-24 12:09 UTC (permalink / raw)
To: mpe, npiggin
Cc: nathanl, aneesh.kumar, linux-pci, Krishna Kumar, linux-kernel,
christophe.leroy, gbatra, bhelgaas, tpearson, oohall, brking,
mahesh.salgaonkar, linuxppc-dev
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=yes, Size: 1790 bytes --]
The fix of Powerpc hotplug driver (drivers/pci/hotplug/pnv_php.c)
addresses below two issues.
1. Kernel Crash during hot unplug of bridge/switch slot.
2. Bridge Support Enablement - Previously, when we do a hot-unplug
operation on a bridge slot, all the ports and devices behind the
bridge-ports would be hot-unplugged/offline, but when we do a hot-plug
operation on the same bridge slot, all the ports and devices behind the
bridge would not get hot-plugged/online. In this case, Only the first
port of the bridge gets enabled and the remaining port/devices remain
unplugged/offline. After the fix, The hot-unplug and hot-plug
operations on the slot associated with the bridge started behaving
correctly and became in sync. Now, after the hot plug operation on the
same slot, all the bridge ports and devices behind the bridge become
hot-plugged/online/restored in the same manner as it was before the
hot-unplug operation.
Krishna Kumar (2):
pci/hotplug/pnv_php: Fix hotplug driver crash on Powernv
powerpc: hotplug driver bridge support
arch/powerpc/include/asm/ppc-pci.h | 4 ++++
arch/powerpc/kernel/pci-hotplug.c | 5 ++---
arch/powerpc/kernel/pci_dn.c | 32 ++++++++++++++++++++++++++++++
drivers/pci/hotplug/pnv_php.c | 3 +--
4 files changed, 39 insertions(+), 5 deletions(-)
Changelog:
==========
v3: 24 June 2024
- Removed the DPC keyword from description in cover letter and
patch2
v2: 14 May 2024
- Used of_property_read_u32() in place of of_get_property() and
of_read_number(). [patch2]
- Removed some unnecessary variable and changed the function return
type from void* to void. [patch2]
- Removed the export declaration of
pci_traverse_sibling_nodes_and_scan_slot() as its not needed.
[patch2]
--
2.45.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v3 1/2] pci/hotplug/pnv_php: Fix hotplug driver crash on Powernv
2024-06-24 12:09 [PATCH v3 0/2] PCI hotplug driver fixes Krishna Kumar
@ 2024-06-24 12:09 ` Krishna Kumar
2024-06-26 15:21 ` Bjorn Helgaas
2024-06-27 17:08 ` Shawn Anastasio
2024-06-24 12:09 ` [PATCH v3 2/2] powerpc: hotplug driver bridge support Krishna Kumar
1 sibling, 2 replies; 10+ messages in thread
From: Krishna Kumar @ 2024-06-24 12:09 UTC (permalink / raw)
To: mpe, npiggin
Cc: nathanl, aneesh.kumar, linux-pci, Krishna Kumar, linux-kernel,
christophe.leroy, gbatra, bhelgaas, tpearson, oohall, brking,
mahesh.salgaonkar, linuxppc-dev
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.
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.
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
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v3 2/2] powerpc: hotplug driver bridge support
2024-06-24 12:09 [PATCH v3 0/2] PCI hotplug driver fixes 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-27 17:11 ` Shawn Anastasio
1 sibling, 1 reply; 10+ messages in thread
From: Krishna Kumar @ 2024-06-24 12:09 UTC (permalink / raw)
To: mpe, npiggin
Cc: nathanl, aneesh.kumar, linux-pci, Krishna Kumar, linux-kernel,
christophe.leroy, gbatra, bhelgaas, tpearson, oohall, brking,
mahesh.salgaonkar, linuxppc-dev
There is an issue with the hotplug operation when it's done on the
bridge/switch slot. The bridge-port and devices behind the bridge, which
become offline by hot-unplug operation, don't get hot-plugged/enabled by
doing hot-plug operation on that slot. Only the first port of the bridge
gets enabled and the remaining port/devices remain unplugged. The hot
plug/unplug operation is done by the hotplug driver
(drivers/pci/hotplug/pnv_php.c).
Root Cause Analysis: This behavior is due to missing code for the
switch/bridge. The existing driver depends on pci_hp_add_devices()
function for device enablement. This function calls pci_scan_slot() on
only one device-node/port of the bridge, not on all the siblings'
device-node/port.
The missing code needs to be added which will find all the sibling
device-nodes/bridge-ports and will run explicit pci_scan_slot() on
those. A new function has been added for this purpose which gets
invoked from pci_hp_add_devices(). This new function
pci_traverse_sibling_nodes_and_scan_slot() gets all the sibling
bridge-ports by traversal and explicitly invokes pci_scan_slot on them.
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>
---
arch/powerpc/include/asm/ppc-pci.h | 4 ++++
arch/powerpc/kernel/pci-hotplug.c | 5 ++---
arch/powerpc/kernel/pci_dn.c | 32 ++++++++++++++++++++++++++++++
3 files changed, 38 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/include/asm/ppc-pci.h b/arch/powerpc/include/asm/ppc-pci.h
index a8b7e8682f5b..83db8d0798ac 100644
--- a/arch/powerpc/include/asm/ppc-pci.h
+++ b/arch/powerpc/include/asm/ppc-pci.h
@@ -28,6 +28,10 @@ struct pci_dn;
void *pci_traverse_device_nodes(struct device_node *start,
void *(*fn)(struct device_node *, void *),
void *data);
+
+void pci_traverse_sibling_nodes_and_scan_slot(struct device_node *start,
+ struct pci_bus *bus);
+
extern void pci_devs_phb_init_dynamic(struct pci_controller *phb);
#if defined(CONFIG_IOMMU_API) && (defined(CONFIG_PPC_PSERIES) || \
diff --git a/arch/powerpc/kernel/pci-hotplug.c b/arch/powerpc/kernel/pci-hotplug.c
index 0fe251c6ac2c..639a3d592fe2 100644
--- a/arch/powerpc/kernel/pci-hotplug.c
+++ b/arch/powerpc/kernel/pci-hotplug.c
@@ -106,7 +106,7 @@ EXPORT_SYMBOL_GPL(pci_hp_remove_devices);
*/
void pci_hp_add_devices(struct pci_bus *bus)
{
- int slotno, mode, max;
+ int mode, max;
struct pci_dev *dev;
struct pci_controller *phb;
struct device_node *dn = pci_bus_to_OF_node(bus);
@@ -129,8 +129,7 @@ void pci_hp_add_devices(struct pci_bus *bus)
* order for fully rescan all the way down to pick them up.
* They can have been removed during partial hotplug.
*/
- slotno = PCI_SLOT(PCI_DN(dn->child)->devfn);
- pci_scan_slot(bus, PCI_DEVFN(slotno, 0));
+ pci_traverse_sibling_nodes_and_scan_slot(dn, bus);
max = bus->busn_res.start;
/*
* Scan bridges that are already configured. We don't touch
diff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c
index 38561d6a2079..bea612759832 100644
--- a/arch/powerpc/kernel/pci_dn.c
+++ b/arch/powerpc/kernel/pci_dn.c
@@ -493,4 +493,36 @@ static void pci_dev_pdn_setup(struct pci_dev *pdev)
pdn = pci_get_pdn(pdev);
pdev->dev.archdata.pci_data = pdn;
}
+
+void pci_traverse_sibling_nodes_and_scan_slot(struct device_node *start, struct pci_bus *bus)
+{
+ struct device_node *dn;
+ int slotno;
+
+ u32 class = 0;
+
+ if (!of_property_read_u32(start->child, "class-code", &class)) {
+ /* Call of pci_scan_slot for non-bridge/EP case */
+ if (!((class >> 8) == PCI_CLASS_BRIDGE_PCI)) {
+ slotno = PCI_SLOT(PCI_DN(start->child)->devfn);
+ pci_scan_slot(bus, PCI_DEVFN(slotno, 0));
+ return;
+ }
+ }
+
+ /* Iterate all siblings */
+ for_each_child_of_node(start, dn) {
+ class = 0;
+
+ if (!of_property_read_u32(start->child, "class-code", &class)) {
+ /* Call of pci_scan_slot on each sibling-nodes/bridge-ports */
+ if ((class >> 8) == PCI_CLASS_BRIDGE_PCI) {
+ slotno = PCI_SLOT(PCI_DN(dn)->devfn);
+ pci_scan_slot(bus, PCI_DEVFN(slotno, 0));
+ }
+ }
+ }
+
+}
+
DECLARE_PCI_FIXUP_EARLY(PCI_ANY_ID, PCI_ANY_ID, pci_dev_pdn_setup);
--
2.45.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v3 1/2] pci/hotplug/pnv_php: Fix hotplug driver crash on Powernv
2024-06-24 12:09 ` [PATCH v3 1/2] pci/hotplug/pnv_php: Fix hotplug driver crash on Powernv Krishna Kumar
@ 2024-06-26 15:21 ` Bjorn Helgaas
2024-06-28 5:34 ` Michael Ellerman
2024-06-27 17:08 ` Shawn Anastasio
1 sibling, 1 reply; 10+ messages in thread
From: Bjorn Helgaas @ 2024-06-26 15:21 UTC (permalink / raw)
To: Krishna Kumar
Cc: nathanl, aneesh.kumar, linux-kernel, npiggin, gbatra, bhelgaas,
tpearson, oohall, christophe.leroy, linux-pci, brking,
mahesh.salgaonkar, linuxppc-dev
I expect this series would go through the powerpc tree since that's
where most of the chance is.
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
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 1/2] pci/hotplug/pnv_php: Fix hotplug driver crash on Powernv
2024-06-24 12:09 ` [PATCH v3 1/2] pci/hotplug/pnv_php: Fix hotplug driver crash on Powernv Krishna Kumar
2024-06-26 15:21 ` Bjorn Helgaas
@ 2024-06-27 17:08 ` Shawn Anastasio
2024-06-28 4:48 ` Michael Ellerman
1 sibling, 1 reply; 10+ messages in thread
From: Shawn Anastasio @ 2024-06-27 17:08 UTC (permalink / raw)
To: Krishna Kumar, mpe, npiggin
Cc: nathanl, gbatra, linux-pci, linux-kernel, christophe.leroy,
aneesh.kumar, brking, tpearson, oohall, bhelgaas,
mahesh.salgaonkar, linuxppc-dev
Hi Krishna,
On 6/24/24 7:09 AM, 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.
>
> 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.
>
> 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>
As with v1, I can confirm that this patch solves the panic encountered
when hotplugging PCIe bridges on POWER9.
Tested-by: Shawn Anastasio <sanastasio@raptorengineering.com>
Thanks,
Shawn
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 2/2] powerpc: hotplug driver bridge support
2024-06-24 12:09 ` [PATCH v3 2/2] powerpc: hotplug driver bridge support Krishna Kumar
@ 2024-06-27 17:11 ` Shawn Anastasio
0 siblings, 0 replies; 10+ messages in thread
From: Shawn Anastasio @ 2024-06-27 17:11 UTC (permalink / raw)
To: Krishna Kumar, mpe, npiggin
Cc: nathanl, gbatra, linux-pci, linux-kernel, christophe.leroy,
aneesh.kumar, brking, tpearson, oohall, bhelgaas,
mahesh.salgaonkar, linuxppc-dev
Hi Krishna,
On 6/24/24 7:09 AM, Krishna Kumar wrote:
> There is an issue with the hotplug operation when it's done on the
> bridge/switch slot. The bridge-port and devices behind the bridge, which
> become offline by hot-unplug operation, don't get hot-plugged/enabled by
> doing hot-plug operation on that slot. Only the first port of the bridge
> gets enabled and the remaining port/devices remain unplugged. The hot
> plug/unplug operation is done by the hotplug driver
> (drivers/pci/hotplug/pnv_php.c).
>
> Root Cause Analysis: This behavior is due to missing code for the
> switch/bridge. The existing driver depends on pci_hp_add_devices()
> function for device enablement. This function calls pci_scan_slot() on
> only one device-node/port of the bridge, not on all the siblings'
> device-node/port.
>
> The missing code needs to be added which will find all the sibling
> device-nodes/bridge-ports and will run explicit pci_scan_slot() on
> those. A new function has been added for this purpose which gets
> invoked from pci_hp_add_devices(). This new function
> pci_traverse_sibling_nodes_and_scan_slot() gets all the sibling
> bridge-ports by traversal and explicitly invokes pci_scan_slot on them.
>
> 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>
Other than the case with NVMe devices failing that we discussed in v1's
thread, I can confirm that this patch resolves many of the issues we've
encountered with PCIe hotplug on POWER9.
Tested-by: Shawn Anastasio <sanastasio@raptorengineering.com>
Thanks,
Shawn
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 1/2] pci/hotplug/pnv_php: Fix hotplug driver crash on Powernv
2024-06-27 17:08 ` Shawn Anastasio
@ 2024-06-28 4:48 ` Michael Ellerman
2024-06-28 19:22 ` Shawn Anastasio
0 siblings, 1 reply; 10+ messages in thread
From: Michael Ellerman @ 2024-06-28 4:48 UTC (permalink / raw)
To: Shawn Anastasio, Krishna Kumar, npiggin
Cc: nathanl, gbatra, linux-pci, linux-kernel, christophe.leroy,
aneesh.kumar, brking, tpearson, oohall, bhelgaas,
mahesh.salgaonkar, linuxppc-dev
Shawn Anastasio <sanastasio@raptorengineering.com> writes:
> Hi Krishna,
>
> On 6/24/24 7:09 AM, 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.
>>
>> 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.
>>
>> 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>
>
> As with v1, I can confirm that this patch solves the panic encountered
> when hotplugging PCIe bridges on POWER9.
Was the panic reported anywhere? So we can link to the report in the
commit.
cheers
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 1/2] pci/hotplug/pnv_php: Fix hotplug driver crash on Powernv
2024-06-26 15:21 ` Bjorn Helgaas
@ 2024-06-28 5:34 ` Michael Ellerman
0 siblings, 0 replies; 10+ messages in thread
From: Michael Ellerman @ 2024-06-28 5:34 UTC (permalink / raw)
To: Bjorn Helgaas, Krishna Kumar
Cc: nathanl, aneesh.kumar, linux-pci, linux-kernel, npiggin, gbatra,
bhelgaas, tpearson, oohall, christophe.leroy, brking,
mahesh.salgaonkar, linuxppc-dev
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
>>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 1/2] pci/hotplug/pnv_php: Fix hotplug driver crash on Powernv
2024-06-28 4:48 ` Michael Ellerman
@ 2024-06-28 19:22 ` Shawn Anastasio
2024-06-29 7:30 ` Michael Ellerman
0 siblings, 1 reply; 10+ messages in thread
From: Shawn Anastasio @ 2024-06-28 19:22 UTC (permalink / raw)
To: Michael Ellerman, Krishna Kumar, npiggin
Cc: nathanl, gbatra, linux-pci, linux-kernel, christophe.leroy,
aneesh.kumar, brking, tpearson, oohall, bhelgaas,
mahesh.salgaonkar, linuxppc-dev
Hi Michael,
On 6/27/24 11:48 PM, Michael Ellerman wrote:
> Was the panic reported anywhere? So we can link to the report in the
> commit.
It was indeed -- here is the link to the thread from last December:
https://lists.ozlabs.org/pipermail/linuxppc-dev/2023-December/267034.html
> cheers
Thanks,
Shawn
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 1/2] pci/hotplug/pnv_php: Fix hotplug driver crash on Powernv
2024-06-28 19:22 ` Shawn Anastasio
@ 2024-06-29 7:30 ` Michael Ellerman
0 siblings, 0 replies; 10+ messages in thread
From: Michael Ellerman @ 2024-06-29 7:30 UTC (permalink / raw)
To: Shawn Anastasio, Krishna Kumar, npiggin
Cc: nathanl, gbatra, linux-pci, linux-kernel, christophe.leroy,
aneesh.kumar, brking, tpearson, oohall, bhelgaas,
mahesh.salgaonkar, linuxppc-dev
Shawn Anastasio <sanastasio@raptorengineering.com> writes:
> Hi Michael,
>
> On 6/27/24 11:48 PM, Michael Ellerman wrote:
>> Was the panic reported anywhere? So we can link to the report in the
>> commit.
>
> It was indeed -- here is the link to the thread from last December:
> https://lists.ozlabs.org/pipermail/linuxppc-dev/2023-December/267034.html
Thanks.
cheers
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2024-06-29 7:31 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-24 12:09 [PATCH v3 0/2] PCI hotplug driver fixes 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-26 15:21 ` Bjorn Helgaas
2024-06-28 5:34 ` Michael Ellerman
2024-06-27 17:08 ` Shawn Anastasio
2024-06-28 4:48 ` Michael Ellerman
2024-06-28 19:22 ` Shawn Anastasio
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-27 17:11 ` Shawn Anastasio
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).