All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] PCI: Convert dynamic PCI resources sysfs objects into static
@ 2021-08-25 21:22 Krzysztof Wilczyński
  2021-08-25 21:22 ` [PATCH 1/4] PCI/sysfs: Add pci_dev_resource_attr_is_visible() helper Krzysztof Wilczyński
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Krzysztof Wilczyński @ 2021-08-25 21:22 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-pci

Hello,

Currently, a lot of PCI-related sysfs objects are dynamically created
under the "/sys/bus/pci/devices/..." path when either the PCI driver is
initialised or when a new device is hot-added.

When PCI driver loads and the PCI sub-system initialises, the sysfs
attributes are then added when late_initcall() function is called:

    pci_sysfs_init
      sysfs_initialized = 1
      for_each_pci_dev
        pci_create_sysfs_dev_files
          sysfs_create_bin_file

Otherwise, for hot-added devices, the sysfs attributes are then added
when the pci_bus_add_devices() function is called:

  pci_bus_add_devices
    pci_bus_add_device
      pci_create_sysfs_dev_files
        if (!sysfs_initialized)
	  return
        sysfs_create_bin_file

When a device is removed the pci_remove_sysfs_dev_files() function is
called from pci_stop_dev() to remove all the attributes that were
previously added:

  pci_stop_bus_device
    pci_stop_dev
      if (pci_dev_is_added)
        pci_remove_sysfs_dev_files
          sysfs_remove_bin_file

The current implementation is known to cause problems:

  https://lore.kernel.org/linux-pci/1366196798-15929-1-git-send-email-artem.savkov@gmail.com/
  https://lore.kernel.org/linux-pci/20200716110423.xtfyb3n6tn5ixedh@pali/
  https://lore.kernel.org/linux-pci/m3eebg9puj.fsf@t19.piap.pl/
  https://lore.kernel.org/linux-pci/20210507102706.7658-1-danijel.slivka@amd.com/

Most of the PCI-related attributes do not need to be created and removed
dynamically and there is no need to also manage their create and remove
life cycle manually.

The aim is also to first reduce the reliance on using late_initcall() to
eventually remove the need for it completely.

This particular series focusing on PCI resources files on platforms that
provide either the HAVE_PCI_MMAP or ARCH_GENERIC_PCI_MMAP_RESOURCE
definitions (other platforms, such as the Alpha platform, will not be
affected) continues the on-going effort to convert the majority of the
dynamic sysfs objects into static ones so that the PCI driver core can
add and remove sysfs objects and related attributes automatically.

Please note that this series depends on the commits from the following
series to be added prior to applying it:

  https://lore.kernel.org/linux-pci/20210729233235.1508920-1-kw@linux.com/
  https://lore.kernel.org/linux-pci/20210812132144.791268-1-kw@linux.com/

	Krzysztof

Krzysztof Wilczyński (4):
  PCI/sysfs: Add pci_dev_resource_attr_is_visible() helper
  PCI/sysfs: Add pci_dev_resource_attr() macro
  PCI/sysfs: Add pci_dev_resource_group() macro
  PCI/sysfs: Convert PCI resource files to static attributes

 drivers/pci/pci-sysfs.c | 189 ++++++++++++++++++++++------------------
 include/linux/pci.h     |   2 +
 2 files changed, 104 insertions(+), 87 deletions(-)

-- 
2.32.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2021-09-14  5:07 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-25 21:22 [PATCH 0/4] PCI: Convert dynamic PCI resources sysfs objects into static Krzysztof Wilczyński
2021-08-25 21:22 ` [PATCH 1/4] PCI/sysfs: Add pci_dev_resource_attr_is_visible() helper Krzysztof Wilczyński
2021-08-26 23:35   ` Bjorn Helgaas
2021-08-27 12:11     ` Greg Kroah-Hartman
2021-08-27 22:23       ` Bjorn Helgaas
2021-09-10 14:08         ` Greg Kroah-Hartman
2021-09-10 17:21           ` Krzysztof Wilczyński
2021-09-11 10:13             ` Greg Kroah-Hartman
2021-09-13 19:47               ` Bjorn Helgaas
2021-09-14  5:06                 ` Greg Kroah-Hartman
2021-09-10 16:12         ` Krzysztof Wilczyński
2021-08-25 21:22 ` [PATCH 2/4] PCI/sysfs: Add pci_dev_resource_attr() macro Krzysztof Wilczyński
2021-08-26 21:12   ` Bjorn Helgaas
2021-08-25 21:22 ` [PATCH 3/4] PCI/sysfs: Add pci_dev_resource_group() macro Krzysztof Wilczyński
2021-08-25 21:22 ` [PATCH 4/4] PCI/sysfs: Convert PCI resource files to static attributes Krzysztof Wilczyński
2021-08-25 23:02 ` [PATCH 0/4] PCI: Convert dynamic PCI resources sysfs objects into static Krzysztof Wilczyński

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.