Re: [PATCH v19 11/14] PCI: Cache PCI DSN into pci_dev->dsn during probe
Alison Schofield <[email protected]> Mon, 3 Aug 2026 19:26:04 -0700
| Newsgroups | org.kernel.vger.linux-pci,org.kernel.vger.linux-acpi,org.kernel.vger.linux-cxl,org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Aug 03, 2026 at 05:18:07PM -0500, Terry Bowman wrote: > Subsequent CXL error-reporting code paths need to log the PCI Device > Serial Number (DSN) as part of trace events emitted from interrupt or > panic context. Computing the DSN there via pci_get_dsn() requires PCI > configuration space reads, which are slow, can fail when the link is > down or frozen, and may not be safe in some contexts. > > Add a u64 dsn field to struct pci_dev and populate it from pci_get_dsn() > during pci_init_capabilities() at probe time via pci_dsn_init(). Only > write dev->dsn when the read succeeds. The zero initial value from > pci_dev allocation already represents 'no DSN available.' > > Remove the now-redundant dsn member from the pciehp struct controller > along with its kernel-doc. Drop the pci_get_slot()/pci_dev_put() pairs > in pciehp_configure_device() and pcie_init() that existed solely to > read the DSN into ctrl->dsn. Use pdev->dsn in pciehp_device_replaced() > for the device-replacement comparison. > > pci_get_dsn() is not modified because it remains a pure config-space read > with no side effects on pci_dev. The cache is written exclusively by > pci_dsn_init() at probe time. > Reviewed-by: Alison Schofield <[email protected]>