Re: [PATCH 3/4] Introduce pci_slot

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Alex Chiang
Date: Monday, March 3, 2008 - 1:56 pm

Hi Greg,

* Greg KH <gregkh@suse.de>:

How about this:

Currently, /sys/bus/pci/slots/ only exposes hotplug attributes
when a hotplug driver is loaded, but PCI slots have attributes
such as address, speed, width, etc. that are not related to
hotplug at all.

Introduce pci_slot as the primary data structure and kobject
model. Hotplug attributes described in hotplug_slot become a
secondary structure associated with the pci_slot.

This patch only creates the infrastructure that allows the
separation of PCI slot attributes and hotplug attributes.
In this patch, the PCI hotplug core remains the only user of this
infrastructure, and thus, /sys/bus/pci/slots/ will still only
become populated when a hotplug driver is loaded.

A later patch in this series will add a second user of this new
infrastructure and demonstrate splitting the task of exposing
pci_slot attributes from hotplug_slot attributes.

  - Make pci_slot the primary sysfs entity. hotplug_slot becomes a
    subsidiary structure.
    o pci_create_slot() creates and registers a slot with the PCI core
    o pci_slot_add_hotplug() gives it hotplug capability

  - Change the prototype of pci_hp_register() to take the bus and
    slot number (on parent bus) as parameters.

  - Remove all the ->get_address methods since this functionality is
    now handled by pci_slot directly.


With this patch, there is no change from existing behavior that
users see; only infrastructure is changed. The existing hotplug
drivers will continue to expose whatever they were exposing
before (when they are loaded).


Fixed in next version.


I *think* I might actually have a "good" reason, but welcome your
feedback.

In this patch, pci_create_slot() is responsible for
kobject_init_and_add, and it adds the 'address' attribute in
sysfs.

The caller of pci_create_slot() is pci_hp_register, and it is
calling kobject_uevent after pci_create_slot, because it still
has to expose the hotplug attributes in sysfs, which can only
happen *after* the pci_slot is created.

I don't think I want to emit the uevent until those hotplug
attributes are exposed, right?

This kinda seems like a stupid design, but the next patch in the
series adds another callsite for pci_create_slot. The next patch
is detecting physical slots described by ACPI, but doesn't know
(or care) about their hotplug capabilities.

I don't think it makes sense to be emitting uevents simply upon
detecting a physical slot.

[over time, I hope to add more functionality to pci_slot, such as
displaying speed, width, etc., but right now, we only get the
address]

One alternative I can think of -- which would further complicate
this model that I'm introducing -- would be to make hotplug_slot
a kobject too, and then let pci_slot emit a uevent upon physical
slot detection, and then let pci_hp_register emit another uevent
when the hotplug_slot is created / added to sysfs. But I must
admit, I don't really like that alternative.

Your thoughts?

Thanks.

/ac

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/4, v7] PCI, ACPI: Physical PCI slot objects, Alex Chiang, (Thu Feb 28, 5:23 pm)
[PATCH 1/4] Remove path attribute from sgi_hotplug, Alex Chiang, (Thu Feb 28, 5:26 pm)
[PATCH 2/4] Construct one fakephp slot per pci slot, Alex Chiang, (Thu Feb 28, 5:27 pm)
[PATCH 3/4] Introduce pci_slot, Alex Chiang, (Thu Feb 28, 5:28 pm)
[PATCH 4/4] ACPI PCI slot detection driver, Alex Chiang, (Thu Feb 28, 5:29 pm)
Re: [PATCH 3/4] Introduce pci_slot, Greg KH, (Fri Feb 29, 10:24 pm)
Re: [PATCH 4/4] ACPI PCI slot detection driver, Greg KH, (Fri Feb 29, 10:25 pm)
Re: [PATCH 4/4] ACPI PCI slot detection driver, Matthew Wilcox, (Sat Mar 1, 7:43 am)
Re: [PATCH 1/4] Remove path attribute from sgi_hotplug, Jesse Barnes, (Mon Mar 3, 11:48 am)
Re: [PATCH 1/4] Remove path attribute from sgi_hotplug, Prarit Bhargava, (Mon Mar 3, 11:54 am)
Re: [PATCH 3/4] Introduce pci_slot, Alex Chiang, (Mon Mar 3, 1:56 pm)
Re: [PATCH 4/4] ACPI PCI slot detection driver, Greg KH, (Mon Mar 3, 10:49 pm)
Re: [PATCH 3/4] Introduce pci_slot, Greg KH, (Mon Mar 3, 10:58 pm)
Re: [PATCH 4/4] ACPI PCI slot detection driver, Jesse Barnes, (Tue Mar 4, 11:18 am)
Re: [PATCH 4/4] ACPI PCI slot detection driver, Greg KH, (Tue Mar 4, 12:30 pm)
Re: [PATCH 4/4] ACPI PCI slot detection driver, Jesse Barnes, (Tue Mar 4, 1:02 pm)
Re: [PATCH 4/4] ACPI PCI slot detection driver, Kristen Carlson Accardi, (Tue Mar 4, 1:12 pm)
Re: [PATCH 4/4] ACPI PCI slot detection driver, Alex Chiang, (Tue Mar 4, 3:58 pm)
Re: [PATCH 4/4] ACPI PCI slot detection driver, Alex Chiang, (Tue Mar 4, 4:09 pm)
Re: [PATCH 4/4] ACPI PCI slot detection driver, Greg KH, (Tue Mar 4, 4:15 pm)
[PATCH 3/4, v8] Introduce pci_slot, Alex Chiang, (Tue Mar 4, 4:30 pm)
Re: [PATCH 4/4] ACPI PCI slot detection driver, Alex Chiang, (Tue Mar 4, 4:46 pm)
Re: [PATCH 4/4] ACPI PCI slot detection driver, Kenji Kaneshige, (Tue Mar 4, 6:11 pm)
Re: [PATCH 4/4] ACPI PCI slot detection driver, Alex Chiang, (Wed Mar 5, 1:20 pm)
Re: [PATCH 4/4] ACPI PCI slot detection driver, Matthew Wilcox, (Wed Mar 5, 1:34 pm)
Re: [PATCH 4/4] ACPI PCI slot detection driver, Kenji Kaneshige, (Wed Mar 5, 7:07 pm)
Re: [PATCH 4/4] ACPI PCI slot detection driver, Kenji Kaneshige, (Tue Mar 11, 6:10 am)
[PATCH 3/(3+1)] ACPI PCI slot detection driver, Kenji Kaneshige, (Tue Mar 11, 6:13 am)
Re: [PATCH 3/(3+1)] ACPI PCI slot detection driver, Kenji Kaneshige, (Tue Mar 11, 6:17 am)
Re: [PATCH 4/4] ACPI PCI slot detection driver, Matthew Wilcox, (Tue Mar 11, 6:28 am)
Re: [PATCH 4/4] ACPI PCI slot detection driver, Jesse Barnes, (Tue Mar 11, 9:56 am)
Re: [PATCH 4/4] ACPI PCI slot detection driver, Kristen Carlson Accardi, (Tue Mar 11, 11:04 am)
Re: [PATCH 4/4] ACPI PCI slot detection driver, Alex Chiang, (Tue Mar 11, 12:14 pm)
Re: [PATCH 4/4] ACPI PCI slot detection driver, Kristen Carlson Accardi, (Tue Mar 11, 4:34 pm)
Re: [PATCH 4/4] ACPI PCI slot detection driver, Kenji Kaneshige, (Tue Mar 11, 9:08 pm)
Re: [PATCH 4/4] ACPI PCI slot detection driver, Kenji Kaneshige, (Tue Mar 11, 10:51 pm)
Re: [PATCH 4/4] ACPI PCI slot detection driver, Kenji Kaneshige, (Wed Mar 12, 3:50 am)
Re: [PATCH 4/4] ACPI PCI slot detection driver, Kenji Kaneshige, (Wed Mar 12, 4:33 am)
Re: [PATCH 4/4] ACPI PCI slot detection driver, Kenji Kaneshige, (Wed Mar 12, 5:59 am)
Re: [PATCH 4/4] ACPI PCI slot detection driver, Alex Chiang, (Wed Mar 12, 8:24 pm)
Re: [PATCH 4/4] ACPI PCI slot detection driver, Gary Hade, (Thu Mar 13, 7:16 pm)
Re: [PATCH 4/4] ACPI PCI slot detection driver, Kenji Kaneshige, (Thu Mar 13, 10:34 pm)
Re: [PATCH 4/4] ACPI PCI slot detection driver, Alex Chiang, (Tue Mar 18, 1:49 pm)