Re: [PATCH RFC 2/3] PCI: Add per-device debugfs directories

From: fengchengwen

Date: Wed Nov 18 2026 - 19:31:49 EST


Acked-by: Chengwen Feng <fengchengwen@xxxxxxxxxx>

On 10/1/2026 11:55 PM, Wei Huang wrote:
> PCI features that export debug information have no common place to put it.
> The only existing user, PTM, creates a "pcie_ptm_<device>" directory in the
> debugfs root, which does not scale as more features follow and leaves each
> user to invent its own lifetime rules and leaf names.
>
> Add /sys/kernel/debug/pci/<device>/ directories owned by the PCI core.
> pci_dev_debugfs_dir() returns the directory of a device, creating it and
> the PCI root directory on first use, so devices without debug content do
> not get an empty directory. pci_destroy_dev() removes the directory
> recursively, so a feature that pins data in a debugfs file needs no removal
> hook of its own: debugfs_remove_recursive() returns only once no operation
> on those files is still running.
>
> No functional change for existing users; the next patch is the first
> consumer.
>
> Signed-off-by: Wei Huang <wei.huang2@xxxxxxx>