* [PATCH for-linus] PCI: pciehp: Ignore belated Presence Detect Changed caused by DPC
@ 2025-06-18 14:38 Lukas Wunner
2025-06-18 15:13 ` Bjorn Helgaas
0 siblings, 1 reply; 2+ messages in thread
From: Lukas Wunner @ 2025-06-18 14:38 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: Keith Busch, Ilpo Jarvinen, Joel Mathew Thomas, tcm4095,
linux-pci
Commit c3be50f7547c ("PCI: pciehp: Ignore Presence Detect Changed caused
by DPC") sought to ignore Presence Detect Changed events occurring as a
side effect of Downstream Port Containment.
The commit awaits recovery from DPC and then clears events which occurred
in the meantime. However if the first event seen after DPC is Data Link
Layer State Changed, only that event is cleared and not Presence Detect
Changed. The object of the commit is thus defeated.
That's because pciehp_ist() computes the events to clear based on the
local "events" variable instead of "ctrl->pending_events". The former
contains the events that had occurred when pciehp_ist() was entered,
whereas the latter also contains events that have accumulated while
awaiting DPC recovery.
In practice, the order of PDC and DLLSC events is arbitrary and the delay
in-between can be several milliseconds.
So change the logic to always clear PDC events, even if they come after an
initial DLLSC event.
Fixes: c3be50f7547c ("PCI: pciehp: Ignore Presence Detect Changed caused by DPC")
Reported-by: Lương Việt Hoàng <tcm4095@gmail.com>
Reported-by: Joel Mathew Thomas <proxy0@tutamail.com>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219765#c165
Tested-by: Lương Việt Hoàng <tcm4095@gmail.com>
Tested-by: Joel Mathew Thomas <proxy0@tutamail.com>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
---
drivers/pci/hotplug/pciehp_hpc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index ebd342b..91d2d92 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -771,7 +771,7 @@ static irqreturn_t pciehp_ist(int irq, void *dev_id)
u16 ignored_events = PCI_EXP_SLTSTA_DLLSC;
if (!ctrl->inband_presence_disabled)
- ignored_events |= events & PCI_EXP_SLTSTA_PDC;
+ ignored_events |= PCI_EXP_SLTSTA_PDC;
events &= ~ignored_events;
pciehp_ignore_link_change(ctrl, pdev, irq, ignored_events);
--
2.47.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH for-linus] PCI: pciehp: Ignore belated Presence Detect Changed caused by DPC
2025-06-18 14:38 [PATCH for-linus] PCI: pciehp: Ignore belated Presence Detect Changed caused by DPC Lukas Wunner
@ 2025-06-18 15:13 ` Bjorn Helgaas
0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2025-06-18 15:13 UTC (permalink / raw)
To: Lukas Wunner
Cc: Keith Busch, Ilpo Jarvinen, Joel Mathew Thomas, tcm4095,
linux-pci
On Wed, Jun 18, 2025 at 04:38:25PM +0200, Lukas Wunner wrote:
> Commit c3be50f7547c ("PCI: pciehp: Ignore Presence Detect Changed caused
> by DPC") sought to ignore Presence Detect Changed events occurring as a
> side effect of Downstream Port Containment.
>
> The commit awaits recovery from DPC and then clears events which occurred
> in the meantime. However if the first event seen after DPC is Data Link
> Layer State Changed, only that event is cleared and not Presence Detect
> Changed. The object of the commit is thus defeated.
>
> That's because pciehp_ist() computes the events to clear based on the
> local "events" variable instead of "ctrl->pending_events". The former
> contains the events that had occurred when pciehp_ist() was entered,
> whereas the latter also contains events that have accumulated while
> awaiting DPC recovery.
>
> In practice, the order of PDC and DLLSC events is arbitrary and the delay
> in-between can be several milliseconds.
>
> So change the logic to always clear PDC events, even if they come after an
> initial DLLSC event.
>
> Fixes: c3be50f7547c ("PCI: pciehp: Ignore Presence Detect Changed caused by DPC")
> Reported-by: Lương Việt Hoàng <tcm4095@gmail.com>
> Reported-by: Joel Mathew Thomas <proxy0@tutamail.com>
> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219765#c165
> Tested-by: Lương Việt Hoàng <tcm4095@gmail.com>
> Tested-by: Joel Mathew Thomas <proxy0@tutamail.com>
> Signed-off-by: Lukas Wunner <lukas@wunner.de>
Applied to pci/for-linus for v6.16, thanks, Lukas!
> ---
> drivers/pci/hotplug/pciehp_hpc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
> index ebd342b..91d2d92 100644
> --- a/drivers/pci/hotplug/pciehp_hpc.c
> +++ b/drivers/pci/hotplug/pciehp_hpc.c
> @@ -771,7 +771,7 @@ static irqreturn_t pciehp_ist(int irq, void *dev_id)
> u16 ignored_events = PCI_EXP_SLTSTA_DLLSC;
>
> if (!ctrl->inband_presence_disabled)
> - ignored_events |= events & PCI_EXP_SLTSTA_PDC;
> + ignored_events |= PCI_EXP_SLTSTA_PDC;
>
> events &= ~ignored_events;
> pciehp_ignore_link_change(ctrl, pdev, irq, ignored_events);
> --
> 2.47.2
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-06-18 15:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-18 14:38 [PATCH for-linus] PCI: pciehp: Ignore belated Presence Detect Changed caused by DPC Lukas Wunner
2025-06-18 15:13 ` Bjorn Helgaas
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).