linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: ACPI Devel Maling List <linux-acpi@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Linux PCI <linux-pci@vger.kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Toshi Kani <toshi.kani@hp.com>, Yinghai Lu <yinghai@kernel.org>
Subject: [Update][PATCH 1/3] ACPI / hotplug: Carry out PCI root eject directly
Date: Wed, 06 Nov 2013 02:42:15 +0100	[thread overview]
Message-ID: <1621020.2qB4Krltq7@vostro.rjw.lan> (raw)
In-Reply-To: <2420016.uapGc1R1go@vostro.rjw.lan>

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Subject: ACPI / hotplug: Carry out PCI root eject directly

Since _handle_hotplug_event_root() is run from the ACPI hotplug
workqueue, it doesn't need to queue up a work item to eject a PCI
host bridge on the same workqueue.  Instead, it can just carry out
the eject by calling acpi_bus_device_eject() directly, so make that
happen.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---

It looks like I sent this too early. :-/

Obviously, acpi_bus_device_eject() cannot be called under acpi_scan_lock,
so that lock has to be dropped before calling that function.

Patch [3/3] doesn't apply any more after this modification, so I'll send
an update of it too.

Thanks,
Rafael

---
 drivers/acpi/internal.h |    2 +-
 drivers/acpi/pci_root.c |   24 ++++++++++--------------
 drivers/acpi/scan.c     |    4 ++--
 3 files changed, 13 insertions(+), 17 deletions(-)

Index: linux-pm/drivers/acpi/internal.h
===================================================================
--- linux-pm.orig/drivers/acpi/internal.h
+++ linux-pm/drivers/acpi/internal.h
@@ -92,7 +92,7 @@ void acpi_device_add_finalize(struct acp
 void acpi_free_pnp_ids(struct acpi_device_pnp *pnp);
 int acpi_bind_one(struct device *dev, acpi_handle handle);
 int acpi_unbind_one(struct device *dev);
-void acpi_bus_hot_remove_device(void *context);
+void acpi_bus_device_eject(struct acpi_device *device, u32 ost_src);
 
 /* --------------------------------------------------------------------------
                                   Power Resource
Index: linux-pm/drivers/acpi/pci_root.c
===================================================================
--- linux-pm.orig/drivers/acpi/pci_root.c
+++ linux-pm/drivers/acpi/pci_root.c
@@ -592,16 +592,6 @@ static void handle_root_bridge_insertion
 		acpi_handle_err(handle, "cannot add bridge to acpi list\n");
 }
 
-static void handle_root_bridge_removal(struct acpi_device *device)
-{
-	acpi_status status;
-
-	get_device(&device->dev);
-	status = acpi_os_hotplug_execute(acpi_bus_hot_remove_device, device);
-	if (ACPI_FAILURE(status))
-		put_device(&device->dev);
-}
-
 static void _handle_hotplug_event_root(struct work_struct *work)
 {
 	struct acpi_pci_root *root;
@@ -612,6 +602,7 @@ static void _handle_hotplug_event_root(s
 	hp_work = container_of(work, struct acpi_hp_work, work);
 	handle = hp_work->handle;
 	type = hp_work->type;
+	kfree(hp_work); /* allocated in handle_hotplug_event_bridge */
 
 	acpi_scan_lock_acquire();
 
@@ -641,9 +632,15 @@ static void _handle_hotplug_event_root(s
 		/* request device eject */
 		acpi_handle_printk(KERN_DEBUG, handle,
 				   "Device eject notify on %s\n", __func__);
-		if (root)
-			handle_root_bridge_removal(root->device);
-		break;
+		if (!root)
+			break;
+
+		get_device(&root->device->dev);
+
+		acpi_scan_lock_release();
+
+		acpi_bus_device_eject(root->device, ACPI_NOTIFY_EJECT_REQUEST);
+		return;
 	default:
 		acpi_handle_warn(handle,
 				 "notify_handler: unknown event type 0x%x\n",
@@ -652,7 +649,6 @@ static void _handle_hotplug_event_root(s
 	}
 
 	acpi_scan_lock_release();
-	kfree(hp_work); /* allocated in handle_hotplug_event_bridge */
 }
 
 static void handle_hotplug_event_root(acpi_handle handle, u32 type,
Index: linux-pm/drivers/acpi/scan.c
===================================================================
--- linux-pm.orig/drivers/acpi/scan.c
+++ linux-pm/drivers/acpi/scan.c
@@ -285,7 +285,7 @@ static int acpi_scan_hot_remove(struct a
 	return 0;
 }
 
-static void acpi_bus_device_eject(struct acpi_device *device, u32 ost_src)
+void acpi_bus_device_eject(struct acpi_device *device, u32 ost_src)
 {
 	acpi_handle handle = device->handle;
 	struct acpi_scan_handler *handler;
@@ -409,7 +409,7 @@ static void acpi_hotplug_unsupported(acp
  * acpi_bus_hot_remove_device: Hot-remove a device and its children.
  * @context: Address of the ACPI device object to hot-remove.
  */
-void acpi_bus_hot_remove_device(void *context)
+static void acpi_bus_hot_remove_device(void *context)
 {
 	acpi_bus_device_eject(context, ACPI_NOTIFY_EJECT_REQUEST);
 }


  reply	other threads:[~2013-11-06  1:30 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-04  0:17 [PATCH 0/3] ACPI scan and hotplug fixes for 3.14 Rafael J. Wysocki
2013-11-04  0:18 ` [PATCH 1/3] ACPI / scan: Start matching drivers after trying scan handlers Rafael J. Wysocki
2013-11-04  0:21 ` [PATCH 2/3] ACPI / hotplug: Refuse to hot-remove all objects with disabled hotplug Rafael J. Wysocki
2013-11-04  0:21 ` [PATCH 3/3] ACPI / hotplug: Merge device hot-removal routines Rafael J. Wysocki
2013-11-04  0:41   ` [PATCH on top of 3/3] ACPI / hotplug: Remove unnecessary get_device() and put_device() Rafael J. Wysocki
2013-11-04 13:26   ` [PATCH 3/3] ACPI / hotplug: Merge device hot-removal routines Rafael J. Wysocki
2013-11-04 13:29 ` [Update][PATCH 0/6] ACPI scan and hotplug fixes Rafael J. Wysocki
2013-11-04 13:30   ` [Update][PATCH 1/6] ACPI / scan: Start matching drivers after trying scan handlers Rafael J. Wysocki
2013-11-05 23:27     ` Toshi Kani
2013-11-04 13:32   ` [Update][PATCH 2/6] ACPI / hotplug: Refuse to hot-remove all objects with disabled hotplug Rafael J. Wysocki
2013-11-05 23:27     ` [fixup][PATCH " Rafael J. Wysocki
2013-11-06  0:39       ` Toshi Kani
2013-11-06  1:35         ` Rafael J. Wysocki
2013-11-06  1:32           ` Toshi Kani
2013-11-04 13:33   ` [Update][PATCH 3/6] ACPI / hotplug: Fix handle_root_bridge_removal() Rafael J. Wysocki
2013-11-06 23:21     ` Toshi Kani
2013-11-04 13:36   ` [Update][PATCH 4/6] ACPI / hotplug: Simplify device ejection routines Rafael J. Wysocki
2013-11-06 23:27     ` Toshi Kani
2013-11-07  0:14       ` Rafael J. Wysocki
2013-11-07  0:17         ` Toshi Kani
2013-11-07  0:35           ` Rafael J. Wysocki
2013-11-04 13:36   ` [Update][PATCH 5/6] ACPI / hotplug: Make acpi_bus_hot_remove_device() internal Rafael J. Wysocki
2013-11-04 13:36   ` [Update][PATCH 6/6] ACPI / hotplug: Merge device hot-removal routines Rafael J. Wysocki
2013-11-05 23:32   ` [PATCH 0/3] More ACPI hotplug updates (was: [Update][PATCH 0/6] ACPI scan and hotplug fixes) Rafael J. Wysocki
2013-11-05 23:34     ` [PATCH 1/3] ACPI / hotplug: Carry out PCI root eject directly Rafael J. Wysocki
2013-11-06  1:42       ` Rafael J. Wysocki [this message]
2013-11-05 23:36     ` [PATCH 2/3] ACPI / hotplug: Do not execute "insert in progress" _OST Rafael J. Wysocki
2013-11-05 23:48     ` [PATCH 3/3] ACPI / hotplug: Consolidate deferred execution of ACPI hotplug routines Rafael J. Wysocki
2013-11-06  1:44       ` [Update][PATCH " 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=1621020.2qB4Krltq7@vostro.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=bhelgaas@google.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=toshi.kani@hp.com \
    --cc=yinghai@kernel.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).