All of lore.kernel.org
 help / color / mirror / Atom feed
From: Prarit Bhargava <prarit@redhat.com>
To: linux-acpi@vger.kernel.org
Cc: Prarit Bhargava <prarit@redhat.com>, mjg@redhat.com
Subject: [PATCH] acpica events: Call acpi_os_hotplug_execute on Ejection Requests
Date: Thu, 22 Sep 2011 19:16:57 -0400	[thread overview]
Message-ID: <1316733417-22528-1-git-send-email-prarit@redhat.com> (raw)

This patch resolves a process hang in which a PCI card with a PCI-to-PCI
bridge is removed via the acpiphp driver.

The issue is that during the remove of the card an ACPI event occurs
which is erroneously added the kacpi_notify_wq queue.  This add is done in
acpi_ev_queue_notify_request() via a call to acpi_os_execute().

Eventually, the event runs on the kacpi_notify_wq and the code attempts to
remove the card.  During the hotplug remove of the device, the following
call sequence happens

cleanup_p2p_bridge()
	-> cleanup_bridge()
		-> acpi_remove_notify_handler()
			-> acpi_os_wait_events_complete()
				-> flush_workqueue(kacpi_notify_wq)

which is the queue we are currently executing on and the process will hang.

The problem is that the event is placed on the wrong queue.  The code already
contains a kacpi_hotplug_wq queue for hotplug events to be added to in order
to prevent hangs like this.

In acpi_ev_queue_notify_request() the code should check to see if this is a
Ejection Request and if it is, add it the kacpi_hotplug_wq via a call to
acpi_os_hotplug_execute().

Cc: mjg@redhat.com
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
---
 drivers/acpi/acpica/evmisc.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/acpica/evmisc.c b/drivers/acpi/acpica/evmisc.c
index d0b3318..a78aecc 100644
--- a/drivers/acpi/acpica/evmisc.c
+++ b/drivers/acpi/acpica/evmisc.c
@@ -181,9 +181,16 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
 		notify_info->notify.value = (u16) notify_value;
 		notify_info->notify.handler_obj = handler_obj;
 
-		status =
-		    acpi_os_execute(OSL_NOTIFY_HANDLER, acpi_ev_notify_dispatch,
-				    notify_info);
+		/* Is this an Ejection Request? */
+		if (notify_value == 0x03)
+			status =
+				acpi_os_hotplug_execute(acpi_ev_notify_dispatch,
+							notify_info);
+		else
+			status = acpi_os_execute(OSL_NOTIFY_HANDLER,
+						 acpi_ev_notify_dispatch,
+						 notify_info);
+
 		if (ACPI_FAILURE(status)) {
 			acpi_ut_delete_generic_state(notify_info);
 		}
-- 
1.6.5.2


             reply	other threads:[~2011-09-22 23:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-22 23:16 Prarit Bhargava [this message]
2011-09-23  1:08 ` [PATCH] acpica events: Call acpi_os_hotplug_execute on Ejection Requests Bjorn Helgaas
2011-09-23  1:13   ` Matthew Garrett
2011-09-23 15:29     ` Bjorn Helgaas
2011-09-23 15:37       ` Matthew Garrett
2011-09-23 10:48   ` Prarit Bhargava

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=1316733417-22528-1-git-send-email-prarit@redhat.com \
    --to=prarit@redhat.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=mjg@redhat.com \
    /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.