From: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
To: Alex Chiang <achiang@hp.com>,
Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
jbarnes@virtuousgeek.org, kristen.c.accardi@intel.com,
matthew@wil.cx
Subject: Re: [PATCH v5 04/16] PCI: prevent duplicate slot names
Date: Fri, 10 Oct 2008 13:43:42 +0900 [thread overview]
Message-ID: <48EEDD7E.5090002@jp.fujitsu.com> (raw)
In-Reply-To: <20081010021034.GA13292@ldl.fc.hp.com>
Alex Chiang wrote:
> * Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>:
>> Alex Chiang wrote:
>>> * Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>:
>>>> Thank your new patches. Very quick!!!
>>> I'm trying to get into 2.6.28. ;)
>>>
>>>> Though I have not reviewed/tested your patches yet (of course), I have
>>>> one concern as I said in the e-mail soon before. Does the new one
>>>> consider the following senario?
>>>>
>>>> Scenario C:
>>>> hotplug driver(A) hotplug_driver(B)
>>>> -------------- ----------------
>>>> pci_create_slot(name=A, rename=1)
>>>> pci_create_slot(name=B, rename=1)
>>>>
>>>> The hotplug driver (A) creates the slot with name "A". The the hotplug
>>>> driver (B) tries to create the same slot, but wants the name "B" instead.
>>>> In this case, hotplug driver fails to create the slot and the slot name
>>>> should not be changed to "B" from "A".
>>> Hm... I don't think this is a common scenario but...
>>>
>> It was a common scenario until recently because acpiphp and
>> native hotplug drivers(pciehp, shpchp) had different naming
>> rules. That is, acpiphp used _SUN number, while pciehp/shpchp
>> used bus number and physical slot number pair. Although the
>> pciehp/shpchp driver has been changed not to use bus_number
>> for slot names and acpiphp and pciehp/shpchp has the same
>> names on my system now, but I think the scenario is still
>> possible because naming rule of each hotplug driver could be
>> changed in the future again.
>>
>> By the way, acpiphp was changed to handle 64bit _SUN number
>> recently for new ia64 HP servers, IIRC. Are hotplug slots
>> on that server can also be handled through PCIe controller?
>> If it is yes, I think _SUN doesn't match physical slot number
>> because physical slot number (in Slot Capabilities Register)
>> has only 13bit. In this case, the above scenario will happen.
>
> Hm, ok, I agree.
>
>>> int pci_hp_register(...)
>>> {
>>> ...
>>>
>>> pci_slot = pci_create_slot(bus, slot_nr, name, 1);
>>> if (IS_ERR(pci_slot)) return
>>> PTR_ERR(pci_slot);
>>>
>>> if (pci_slot->hotplug) {
>>> dbg("%s: already claimed\n", __func__);
>>> pci_destroy_slot(pci_slot);
>>> return -EBUSY;
>>> }
>>> ...
>>> }
>>>
>>> I could maybe move that check into pci_create_slot() instead.
>>>
>>> struct pci_slot *pci_create_slot(...)
>>> {
>>> ...
>>>
>>> /*
>>> * Get existing slot and rename if desired
>>> */
>>> slot = get_slot(parent, slot_nr);
>>> if (slot && rename) {
>>> if ((err = slot->hotplug ? -EBUSY : 0)
>>> || (err = rename_slot(slot, name))) {
>>> kobject_put(&slot->kobj);
>>> slot = NULL;
>>> goto err;
>>> } else
>>> goto out;
>>> } else if (slot)
>>> goto out;
>>> ...
>>> }
>>>
>>> Seems a little ugly to me, but maybe it's necessary?
>>>
>> I don't like this, and I think it's wrong because callers
>> might get -EBUSY even though they are not related to hotplug.
>>
>> I thought of the following alternative ideas, when I was making
>> sample patches. What do you think about those? My was concerned
>> that both need to add hotplug related code into generic pci slot
>> management code/API.
>>
>> - Add 'hotplug' arg to pci_create_slot(), instead of 'rename'
>> flag. The pci_create_slot() would be as follows:
>>
>> struct pci_slot *pci_create_slot(..., struct hotplug_slot *hotplug)
>> {
>> ...
>> /*
>> * Get existing slot and rename if desired
>> */
>> slot = get_slot(parent, slot_nr);
>> if (slot) {
>> if (hotplug) {
>> if ((err = slot->hotplug ? -EBUSY : 0)
>> || err = rename_slot(slot, name))) {
>> Some cleanups;
>> return err;
>> }
>> }
>> goto out;
>> }
>> ...
>> out:
>> if (hotplug)
>> slot->hotplug = hotplug;
>> ...
>> }
>
> I like this approach a little better, since the flow of execution
> is easier to understand (vs. pci_create_slot + pci_slot_hp_register).
>
> I prototyped it, but didn't get a chance to test it (I did
> compile it though).
>
> I'll send 2 test patches shortly that should replace the earlier
> 03/16 and 04/16 patches.
>
I'm sorry, but I forgot to tell you one important thing. Now we are
trying to change pci slot management API to setup pci_slot->hotplug.
We must consider how to implement the counterpart to clean up
pci_slot->hotplug at the same time. My current idea is adding hotplug
arg to pci_destroy_slot(), but it seems a little ugly...
Thanks,
Kenji Kaneshige
next prev parent reply other threads:[~2008-10-10 4:45 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-09 4:46 [PATCH v5 00/16] PCI: let the core manage slot names Alex Chiang
2008-10-09 4:46 ` [PATCH v5 01/16] PCI Hotplug core: add 'name' param pci_hp_register interface Alex Chiang
2008-10-09 4:46 ` [PATCH v5 02/16] PCI: rename pci_update_slot_number to pci_renumber_slot Alex Chiang
2008-10-09 4:46 ` [PATCH v5 03/16] PCI: update pci_create_slot() to take a 'rename' param Alex Chiang
2008-10-09 4:46 ` [PATCH v5 04/16] PCI: prevent duplicate slot names Alex Chiang
2008-10-09 5:31 ` Kenji Kaneshige
2008-10-09 5:56 ` Alex Chiang
2008-10-09 12:32 ` Kenji Kaneshige
2008-10-10 2:10 ` Alex Chiang
2008-10-10 2:11 ` Alex Chiang
2008-10-10 2:12 ` Alex Chiang
2008-10-10 4:43 ` Kenji Kaneshige [this message]
2008-10-10 5:27 ` Alex Chiang
2008-10-10 8:11 ` Kenji Kaneshige
2008-10-10 21:29 ` Alex Chiang
2008-10-09 4:46 ` [PATCH v5 05/16] PCI, PCI Hotplug: introduce slot_name helpers Alex Chiang
2008-10-09 4:47 ` [PATCH v5 06/16] PCI: acpiphp: remove 'name' parameter Alex Chiang
2008-10-09 4:47 ` [PATCH v5 07/16] PCI: cpci_hotplug: stop managing hotplug_slot->name Alex Chiang
2008-10-09 4:47 ` [PATCH v5 08/16] PCI: cpqphp: " Alex Chiang
2008-10-09 4:47 ` [PATCH v5 09/16] PCI: fakephp: remove 'name' parameter Alex Chiang
2008-10-09 4:47 ` [PATCH v5 10/16] PCI: ibmphp: stop managing hotplug_slot->name Alex Chiang
2008-10-09 4:47 ` [PATCH v5 11/16] PCI: pciehp: remove 'name' parameter Alex Chiang
2008-10-09 4:47 ` [PATCH v5 12/16] PCI: rpaphp: kmalloc/kfree slot->name directly Alex Chiang
2008-10-09 4:47 ` [PATCH v5 13/16] PCI: SGI Hotplug: stop managing bss_hotplug_slot->name Alex Chiang
2008-10-09 4:47 ` [PATCH v5 14/16] PCI: shcphp: remove 'name' parameter Alex Chiang
2008-10-09 4:47 ` [PATCH v5 15/16] PCI: Hotplug core: remove 'name' Alex Chiang
2008-10-09 4:47 ` [PATCH v5 16/16] PCI Hotplug: fakephp: add duplicate slot name debugging Alex Chiang
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=48EEDD7E.5090002@jp.fujitsu.com \
--to=kaneshige.kenji@jp.fujitsu.com \
--cc=achiang@hp.com \
--cc=jbarnes@virtuousgeek.org \
--cc=kristen.c.accardi@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=matthew@wil.cx \
/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