public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: "Chia-Lin Kao (AceLan)" <acelan.kao@canonical.com>
Cc: Andreas Noever <andreas.noever@gmail.com>,
	Mika Westerberg <westeri@kernel.org>,
	Yehezkel Bernat <YehezkelShB@gmail.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] thunderbolt: Fix PCIe device enumeration with delayed rescan
Date: Wed, 21 Jan 2026 07:01:42 +0100	[thread overview]
Message-ID: <20260121060142.GJ2275908@black.igk.intel.com> (raw)
In-Reply-To: <20260121052744.233517-1-acelan.kao@canonical.com>

Hi,

On Wed, Jan 21, 2026 at 01:27:44PM +0800, Chia-Lin Kao (AceLan) wrote:
> PCIe devices behind Thunderbolt tunnels may fail to enumerate when
> spurious hotplug events prevent pciehp from detecting link-up.
> 
> Root cause:
> 
> Spurious unplug events occur immediately after tunnel activation:
> 
>   [  932.438] thunderbolt: acking hot unplug event on 702:2
>   [  932.852] thunderbolt: PCIe Up path activation complete
>   [  932.855] thunderbolt: hotplug event for upstream port 702:2
>             (unplug: 0)
>   [  932.855] thunderbolt: hotplug event for upstream port 702:2
>             (unplug: 1)
> 
> These events disrupt pciehp timing, causing device enumeration to fail
> ~70% of the time on affected hardware. Manual PCI rescan succeeds,
> proving devices are present and functional on the bus.

Thanks for the report!

They are likely TB3 xHCI "plug" events or so but they should not affect
anything really.

It may be that there is something in the TB3 compatibility side that we are
not doing which needs to be investigated.

From your merged.out.bad:

CM does xHCI connect here:

[  152.905840] [182] thunderbolt 0000:c7:00.6: 702: xHCI connect request
[  152.906865] [182] thunderbolt 0000:c7:00.6: hotplug event for upstream port 702:2 (unplug: 0)
[  152.906869] [182] thunderbolt 0000:c7:00.6: 2:8: got plug event for connected port, ignoring
[  152.906872] [182] thunderbolt 0000:c7:00.6: hotplug event for upstream port 702:2 (unplug: 1)
[  152.906875] [182] thunderbolt 0000:c7:00.6: 2:8: got unplug event for disconnected port, ignoring

[  192.931373] [49] thunderbolt 0000:c7:00.6: acking hot unplug event on 2:7

Can you comment out call to tb_switch_xhci_connect() and see if that
changes anything?

> Solution:
> 
> Schedule delayed work (300ms) after tunnel activation to:
> 1. Check if pciehp successfully enumerated devices (device count increased)
> 2. If not, trigger pci_rescan_bus() to discover devices manually
> 3. Log results for observability
> 
> The delayed work approach is non-blocking and only rescans when actually
> needed, avoiding overhead on systems where pciehp works correctly.

There is no way we are going to call PCI functions from the tb.c.

  parent reply	other threads:[~2026-01-21  6:01 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-21  5:27 [PATCH] thunderbolt: Fix PCIe device enumeration with delayed rescan Chia-Lin Kao (AceLan)
2026-01-21  5:35 ` AceLan Kao
2026-01-21  6:01 ` Mika Westerberg [this message]
2026-01-23  2:04   ` Chia-Lin Kao (AceLan)
2026-01-23 12:01     ` Mika Westerberg
     [not found]       ` <aXbTfLUJ-lEfNzgX@acelan-Precision-5480>
2026-01-26  5:42         ` Mika Westerberg
     [not found]           ` <aXcWNw9Qfo5L9WVi@acelan-Precision-5480>
2026-01-26 11:56             ` Mika Westerberg
     [not found]               ` <aXg1eBudRAaCZpmR@acelan-Precision-5480>
2026-01-27  8:45                 ` Mika Westerberg
2026-01-27 10:17                   ` Mika Westerberg
2026-01-29  5:45                     ` Chia-Lin Kao (AceLan)
2026-01-29  6:50                       ` Mika Westerberg
2026-02-03  9:04                         ` Jayi Li
2026-02-03  9:39                           ` Mika Westerberg
2026-02-03 10:00                             ` Jayi Li
2026-02-03 10:07                               ` Mika Westerberg
2026-02-04  2:37                                 ` Jayi Li
2026-02-04 12:37                                   ` Mika Westerberg
2026-02-06  1:17                                     ` Jayi Li
2026-02-09  1:30                                     ` Jayi Li
2026-02-12  4:16                         ` AceLan Kao
2026-02-12  7:07                           ` Mika Westerberg
2026-02-12  7:34                             ` Mika Westerberg
2026-02-13  0:34                               ` Mario Limonciello
2026-02-18 19:21                                 ` Mario Limonciello
2026-02-18 21:35                                   ` Mario Limonciello
2026-02-23  5:55                                     ` Mika Westerberg

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=20260121060142.GJ2275908@black.igk.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=YehezkelShB@gmail.com \
    --cc=acelan.kao@canonical.com \
    --cc=andreas.noever@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=westeri@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