From: Lukas Wunner <lukas@wunner.de>
To: AceLan Kao <acelan.kao@canonical.com>
Cc: "Bjorn Helgaas" <bhelgaas@google.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI: pciehp: Fix system hang on resume after hot-unplug during suspend
Date: Tue, 1 Oct 2024 13:02:46 +0200 [thread overview]
Message-ID: <ZvvW1ua2UjwHIOEN@wunner.de> (raw)
In-Reply-To: <CAFv23QkwxmT7qrnbfEpJNN+mnevNAor6Dk7efvYNOdjR9tGyrw@mail.gmail.com>
On Mon, Sep 30, 2024 at 09:31:53AM +0800, AceLan Kao wrote:
> Lukas Wunner <lukas@wunner.de> 2024 9 28 8:51:
> > - if (pci_get_dsn(pdev) != ctrl->dsn)
> > + dsn = pci_get_dsn(pdev);
> > + if (!PCI_POSSIBLE_ERROR(dsn) &&
> > + dsn != ctrl->dsn)
> > return true;
>
> In my case, the pciehp_device_replaced() returns true from this final check.
> And these are the values I got
> dsn = 0x00000000, ctrl->dsn = 0x7800AA00
> dsn = 0x00000000, ctrl->dsn = 0x21B7D000
Ah because pci_get_dsn() returns 0 if the device is gone.
Below is a modified patch which returns false in that case.
I've only changed:
- dsn = pci_get_dsn(pdev);
- if (!PCI_POSSIBLE_ERROR(dsn) &&
+ if ((dsn = pci_get_dsn(pdev)) &&
+ !PCI_POSSIBLE_ERROR(dsn) &&
> Did some other test
> TBT HDD -> TBT dock -> laptop
> suspend
> TBT HDD -> laptop(replace TBT dock with the TBT HDD)
> resume
> Got the same result as above, looks like it didn't detect the TBT dock
> has been replaced by TBT HDD.
>
> In the origin call trace, unplug TBT dock or replace it with TBT HDD,
> it returns true by the below check
> if (pci_read_config_dword(pdev, PCI_VENDOR_ID, ®) ||
> reg != (pdev->vendor | (pdev->device << 16)) ||
> pci_read_config_dword(pdev, PCI_CLASS_REVISION, ®) ||
> reg != (pdev->revision | (pdev->class << 8)))
> return true;
Hm, that's odd. Why is that? Is reg == 0xffffffff in one of those cases?
I guess that could happen if the Thunderbolt tunnels are not yet
established at that point (i.e. in the ->resume_noirq phase),
but normally they should be. Does this system use ICM-controlled
tunnel management or kernel-native (software-controlled) tunnel
management?
Thanks,
Lukas
next prev parent reply other threads:[~2024-10-01 11:02 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-26 12:59 [PATCH] PCI: pciehp: Fix system hang on resume after hot-unplug during suspend Chia-Lin Kao (AceLan)
2024-09-26 13:23 ` Lukas Wunner
2024-09-27 7:33 ` AceLan Kao
2024-09-27 9:28 ` Lukas Wunner
2024-09-28 12:51 ` Lukas Wunner
2024-09-30 1:31 ` AceLan Kao
2024-10-01 11:02 ` Lukas Wunner [this message]
2024-10-01 11:03 ` Lukas Wunner
2024-10-07 4:34 ` AceLan Kao
2024-10-17 2:40 ` AceLan Kao
2024-10-22 13:05 ` AceLan Kao
2024-10-23 4:23 ` Ethan Zhao
2024-09-30 3:27 ` AceLan Kao
2024-10-01 11:07 ` Lukas Wunner
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=ZvvW1ua2UjwHIOEN@wunner.de \
--to=lukas@wunner.de \
--cc=acelan.kao@canonical.com \
--cc=bhelgaas@google.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
/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).