public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
To: Alex Chiang <achiang@hp.com>
Cc: 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: Thu, 09 Oct 2008 14:31:02 +0900	[thread overview]
Message-ID: <48ED9716.3040301@jp.fujitsu.com> (raw)
In-Reply-To: <20081009044649.8678.30990.stgit@bob.kio>

Alex Chiang wrote:
> Prevent callers of pci_create_slot() from registering slots with
> duplicate names. This condition occurs most often when PCI hotplug
> drivers are loaded on platforms with broken firmware that assigns
> identical names to multiple slots.
> 
> We now rename these duplicate slots on behalf of the user.
> 
> If firmware assigns the name N to multiple slots, then:
> 
> 	The first registered slot is assigned N
> 	The second registered slot is assigned N-1
> 	The third registered slot is assigned N-2
> 	etc.
> 
> A side effect of this patch is that the error condition for when
> multiple drivers attempt to claim the same slot becomes much more
> prominent. The -EBUSY was getting masked previously by -EEXIST in
> the event of duplicate slot names; this is no longer so.
> 
> This is the permanent fix mentioned in earlier commits d6a9e9b4 and
> 167e782e (shpchp/pciehp: Rename duplicate slot name...).
> 
> Finally, we take advantage of the new 'rename' parameter in
> pci_create_slot() to prevent a slot create/rename race between hotplug
> drivers and detection drivers.
> 
> 	Scenario A:
> 	hotplug driver                  detection_driver
> 	--------------                  ----------------
> 	pci_create_slot(rename=1)
> 					pci_create_slot(rename=0)
> 
> The hotplug driver creates the slot with its desired name, and then
> releases the semaphore. Now, the detection driver tries to create
> the same slot, but it already exists. We don't care about renaming,
> so return the existing slot.
> 
> 	Scenario B:
> 	hotplug driver                  detection_driver
> 	--------------                  ----------------
> 					pci_create_slot(rename=0)
> 	pci_create_slot(rename=1)
> 
> The detection driver creates the slot with name "X". Then the hotplug
> driver tries to create the same slot, but wants the name "Y" instead.
> We detect that we're trying to create the same slot and that we also
> want a rename, so rename the slot to "Y" and return.
> 

Thank your new patches. Very quick!!!

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".

Thanks,
Kenji Kaneshige


  reply	other threads:[~2008-10-09  5:32 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 [this message]
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=48ED9716.3040301@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