From: Alex Chiang <achiang@hp.com>
To: jbarnes@virtuousgeek.org, kristen.c.accardi@intel.com,
matthew@wil.cx, kaneshige.kenji@jp.fujitsu.com,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v5 00/16] PCI: let the core manage slot names
Date: Wed, 08 Oct 2008 22:46:29 -0600 [thread overview]
Message-ID: <20081009043140.8678.44164.stgit@bob.kio> (raw)
Hi all,
This is v5 of the series that implements a series of changes
that allows the PCI core to manage slot names, rather than
individual hotplug drivers.
Thanks again to Kenji-san for continuing to point out that my
previous attempts were racy and had horrible, complicated code. :)
And thanks to Willy for reviewing my poor attempt at introducing
locking.
I've decided to do them both a favor and take a new approach that
does not change any locking semantics in any of the existing interfaces
today (pci_hp_register, pci_hp_deregister, pci_create_slot).
Keep in mind that the problems we're trying to solve are:
- possible duplicate slot names from firmware
- allow hotplug drivers to override detection driver slot names
The race that Kenji-san points out occurs during slot creation, where
both a detection driver and hotplug driver try to create a slot at
the same time, with different names.
The solution is to combine slot creation _and_ slot rename into one
atomic operation via an updated pci_create_slot() API. pci_create_slot
is already serialized, so that's a good start.
We add a 'rename' parameter to pci_create_slot. The hotplug drivers set
it to 1. The detection drivers set it to 0. Now, when trying to create
a new slot:
- check to see if it's already been created
- if yes, and we want a rename, then go ahead and rename it
- if yes, and we don't care about the name, then just return
- if no, then create the slot normally
This logic is fully described in the changelog in patch 04/16. I believe
it is a much simpler approach than the earlier crap I was producing.
I tested this series with the pci_slot driver and fakephp dup_slots=1
with multiple loads and unloads in different order, and it all seemed
to work.
I _hope_ this is the last round. ;)
Thanks!
/ac
v4 -> v5:
- add 'rename' param to pci_create_slot
- make use of 'rename' param in pci_create_slot
- remove v4 serialization
- remove crap false name collsion code from v2 and v3
- rpaphp uses kstrdup (Thanks to Pekka Enberg for suggestion)
v3 -> v4:
- Do not access hotplug_slot_name() before name initialization
- Serialize pci_hp_register/deregister
v2 -> v3:
- incorporate Willy's code review comments
- fix possible memory leak, pointed out by Rolf Eike Beer
- make false name collision detection work for empty slots
- add 'dup_slots' module_param to fakephp to help debug all this ;)
v1 -> v2:
- fix possible false name collisions
---
Alex Chiang (16):
PCI Hotplug: fakephp: add duplicate slot name debugging
PCI: Hotplug core: remove 'name'
PCI: shcphp: remove 'name' parameter
PCI: SGI Hotplug: stop managing bss_hotplug_slot->name
PCI: rpaphp: kmalloc/kfree slot->name directly
PCI: pciehp: remove 'name' parameter
PCI: ibmphp: stop managing hotplug_slot->name
PCI: fakephp: remove 'name' parameter
PCI: cpqphp: stop managing hotplug_slot->name
PCI: cpci_hotplug: stop managing hotplug_slot->name
PCI: acpiphp: remove 'name' parameter
PCI, PCI Hotplug: introduce slot_name helpers
PCI: prevent duplicate slot names
PCI: update pci_create_slot() to take a 'rename' param
PCI: rename pci_update_slot_number to pci_renumber_slot
PCI Hotplug core: add 'name' param pci_hp_register interface
drivers/acpi/pci_slot.c | 2
drivers/pci/hotplug/acpiphp.h | 9 +-
drivers/pci/hotplug/acpiphp_core.c | 32 ++++---
drivers/pci/hotplug/cpci_hotplug.h | 6 +
drivers/pci/hotplug/cpci_hotplug_core.c | 75 ++++++----------
drivers/pci/hotplug/cpci_hotplug_pci.c | 4 -
drivers/pci/hotplug/cpqphp.h | 13 +--
drivers/pci/hotplug/cpqphp_core.c | 43 ++++-----
drivers/pci/hotplug/fakephp.c | 26 ++++-
drivers/pci/hotplug/ibmphp.h | 5 -
drivers/pci/hotplug/ibmphp_ebda.c | 19 +---
drivers/pci/hotplug/pci_hotplug_core.c | 30 ++----
drivers/pci/hotplug/pciehp.h | 9 +-
drivers/pci/hotplug/pciehp_core.c | 49 ++++------
drivers/pci/hotplug/pciehp_ctrl.c | 53 ++++++-----
drivers/pci/hotplug/pciehp_hpc.c | 1
drivers/pci/hotplug/rpaphp_slot.c | 10 +-
drivers/pci/hotplug/sgi_hotplug.c | 18 +---
drivers/pci/hotplug/shpchp.h | 9 +-
drivers/pci/hotplug/shpchp_core.c | 52 ++++-------
drivers/pci/hotplug/shpchp_ctrl.c | 48 +++++-----
drivers/pci/slot.c | 150 ++++++++++++++++++++++++-------
include/linux/pci.h | 9 +-
include/linux/pci_hotplug.h | 11 +-
24 files changed, 359 insertions(+), 324 deletions(-)
next reply other threads:[~2008-10-09 4:46 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-09 4:46 Alex Chiang [this message]
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
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=20081009043140.8678.44164.stgit@bob.kio \
--to=achiang@hp.com \
--cc=jbarnes@virtuousgeek.org \
--cc=kaneshige.kenji@jp.fujitsu.com \
--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 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.