linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yinghai Lu <yinghai@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>,
	Bjorn Helgaas <bhelgaas@google.com>,
	"Rafael J. Wysocki" <rjw@sisk.pl>
Cc: "linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [GIT PULL] PCI changes for v3.9
Date: Tue, 26 Feb 2013 10:14:29 -0800	[thread overview]
Message-ID: <CAE9FiQUkMqqSE9JJuxt7MxLheQA1j2nKC7QfOB7xLEJ9iUhs7g@mail.gmail.com> (raw)
In-Reply-To: <CA+55aFy7PvVqAN6tLFFuCUALsXsKsuf-yqWso3aZGe4-MkFvuw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1299 bytes --]

On Tue, Feb 26, 2013 at 8:13 AM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
> On Mon, Feb 25, 2013 at 10:46 PM, Yinghai Lu <yinghai@kernel.org> wrote:
>> On Mon, Feb 25, 2013 at 9:19 PM, Linus Torvalds
>> <torvalds@linux-foundation.org> wrote:
>>>
>>> Also, my *gut* feel is that the new _handle_hotplug_event_root()
>>> function should do that whole dance with
>>> acpi_scan_lock_acquire()/acpi_scan_lock_release(), but I didn't really
>>> know if it's required or appropriate, so I left it alone. Could you
>>> take a look?
>>
>> Yes, we need that for root bridge hot add path.
>>
>> for hot remove path, we already have lock acquire/release in
>> acpi_bus_hot_remove_device().
>>
>> Please check attached patch for hot add path.
>
> Quite frankly, doing this in handle_root_bridge_insertion() doesn't
> match the pattern elsewhere. Elsewhere you also protected the whole
> acpi_get_name() lookup etc. Which is why I felt that it would make
> more sense to add this to _handle_hotplug_event_root().
>
> But there may be good reasons why the root bridge case is different,
> and I don't have strong opinions, I just wanted people to look at his
> case. I'll let you and Bjorn sort it out...

ok,

Bjorn, Rafael,

Can you please check if you are ok with attached patch ?

Thanks

Yinghai

[-- Attachment #2: fix_acpi_pci_root_acquire_lock.patch --]
[-- Type: application/octet-stream, Size: 1963 bytes --]

Subject: [PATCH] PCI, ACPI: hold acpi_scan_lock during root bus hotplug

During merging pci tree with pm/acpi tree, Linus noticed that
we don't have same lock using patten about acpi pci root as
acpiphp.

Here apply same lock patten, and we need to change
acpi_bus_hot_remove_device executing via acpi_os_hotplug_execute()
as it also hold the lock in acpi_bus_hot_remove_device.

That will make acpi_bus_hot_remove_device calling the same as other
callers.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 drivers/acpi/pci_root.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Index: linux-2.6/drivers/acpi/pci_root.c
===================================================================
--- linux-2.6.orig/drivers/acpi/pci_root.c
+++ linux-2.6/drivers/acpi/pci_root.c
@@ -652,6 +652,7 @@ static void handle_root_bridge_insertion
 
 static void handle_root_bridge_removal(struct acpi_device *device)
 {
+	acpi_status status;
 	struct acpi_eject_event *ej_event;
 
 	ej_event = kmalloc(sizeof(*ej_event), GFP_KERNEL);
@@ -667,7 +668,9 @@ static void handle_root_bridge_removal(s
 	ej_event->device = device;
 	ej_event->event = ACPI_NOTIFY_EJECT_REQUEST;
 
-	acpi_bus_hot_remove_device(ej_event);
+	status = acpi_os_hotplug_execute(acpi_bus_hot_remove_device, ej_event);
+	if (ACPI_FAILURE(status))
+		kfree(ej_event);
 }
 
 static void _handle_hotplug_event_root(struct work_struct *work)
@@ -682,8 +685,9 @@ static void _handle_hotplug_event_root(s
 	handle = hp_work->handle;
 	type = hp_work->type;
 
-	root = acpi_pci_find_root(handle);
+	acpi_scan_lock_acquire();
 
+	root = acpi_pci_find_root(handle);
 	acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
 
 	switch (type) {
@@ -717,6 +721,7 @@ static void _handle_hotplug_event_root(s
 		break;
 	}
 
+	acpi_scan_lock_release();
 	kfree(hp_work); /* allocated in handle_hotplug_event_bridge */
 	kfree(buffer.pointer);
 }

  reply	other threads:[~2013-02-26 18:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-23 21:21 [GIT PULL] PCI changes for v3.9 Bjorn Helgaas
2013-02-24  2:49 ` Yinghai Lu
2013-02-24 14:23   ` Rafael J. Wysocki
2013-02-26  5:19   ` Linus Torvalds
2013-02-26  6:46     ` Yinghai Lu
2013-02-26 16:13       ` Linus Torvalds
2013-02-26 18:14         ` Yinghai Lu [this message]
2013-02-27 21:47           ` Rafael J. Wysocki
2013-03-11  5:05             ` [PATCH] PCI, ACPI: hold acpi_scan_lock during root bus hotplug Yinghai Lu
2013-03-26 13:24               ` Rafael J. Wysocki
2013-03-26 15:12                 ` Yinghai Lu
2013-03-26 22:54                   ` Rafael J. Wysocki
2013-03-26 22:48                     ` Bjorn Helgaas
2013-03-26 22:58                       ` Rafael J. Wysocki

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=CAE9FiQUkMqqSE9JJuxt7MxLheQA1j2nKC7QfOB7xLEJ9iUhs7g@mail.gmail.com \
    --to=yinghai@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=rjw@sisk.pl \
    --cc=torvalds@linux-foundation.org \
    /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;
as well as URLs for NNTP newsgroup(s).