Skip to content

Commit 2efddb5

Browse files
committed
Revert "driver core: shut down devices asynchronously"
This reverts commit 8064952. The series is being reverted before -rc1 as there are still reports of lockups on shutdown, so it's not quite ready for "prime time." Reported-by: Andrey Skvortsov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: Christoph Hellwig <[email protected]> Cc: David Jeffery <[email protected]> Cc: Keith Busch <[email protected]> Cc: Laurence Oberman <[email protected]> Cc: Nathan Chancellor <[email protected]> Cc: Sagi Grimberg <[email protected]> Cc: Stuart Hayes <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent ec1fcba commit 2efddb5

File tree

3 files changed

+1
-59
lines changed

3 files changed

+1
-59
lines changed

drivers/base/base.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
* shared outside of the drivers/base/ directory.
1111
*
1212
*/
13-
#include <linux/async.h>
1413
#include <linux/notifier.h>
1514

1615
/**
@@ -98,8 +97,6 @@ struct driver_private {
9897
* the device; typically because it depends on another driver getting
9998
* probed first.
10099
* @async_driver - pointer to device driver awaiting probe via async_probe
101-
* @shutdown_after - used during device shutdown to ensure correct shutdown
102-
* ordering.
103100
* @device - pointer back to the struct device that this structure is
104101
* associated with.
105102
* @dead - This device is currently either in the process of or has been
@@ -117,7 +114,6 @@ struct device_private {
117114
struct list_head deferred_probe;
118115
const struct device_driver *async_driver;
119116
char *deferred_probe_reason;
120-
async_cookie_t shutdown_after;
121117
struct device *device;
122118
u8 dead:1;
123119
};

drivers/base/core.c

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
*/
1010

1111
#include <linux/acpi.h>
12-
#include <linux/async.h>
1312
#include <linux/blkdev.h>
1413
#include <linux/cleanup.h>
1514
#include <linux/cpufreq.h>
@@ -3525,7 +3524,6 @@ static int device_private_init(struct device *dev)
35253524
klist_init(&dev->p->klist_children, klist_children_get,
35263525
klist_children_put);
35273526
INIT_LIST_HEAD(&dev->p->deferred_probe);
3528-
dev->p->shutdown_after = 0;
35293527
return 0;
35303528
}
35313529

@@ -4781,8 +4779,6 @@ int device_change_owner(struct device *dev, kuid_t kuid, kgid_t kgid)
47814779
}
47824780
EXPORT_SYMBOL_GPL(device_change_owner);
47834781

4784-
static ASYNC_DOMAIN(sd_domain);
4785-
47864782
static void shutdown_one_device(struct device *dev)
47874783
{
47884784
/* hold lock to avoid race with probe/release */
@@ -4818,34 +4814,12 @@ static void shutdown_one_device(struct device *dev)
48184814
put_device(dev->parent);
48194815
}
48204816

4821-
/**
4822-
* shutdown_one_device_async
4823-
* @data: the pointer to the struct device to be shutdown
4824-
* @cookie: not used
4825-
*
4826-
* Shuts down one device, after waiting for shutdown_after to complete.
4827-
* shutdown_after should be set to the cookie of the last child or consumer
4828-
* of this device to be shutdown (if any), or to the cookie of the previous
4829-
* device to be shut down for devices that don't enable asynchronous shutdown.
4830-
*/
4831-
static void shutdown_one_device_async(void *data, async_cookie_t cookie)
4832-
{
4833-
struct device *dev = data;
4834-
4835-
async_synchronize_cookie_domain(dev->p->shutdown_after + 1, &sd_domain);
4836-
4837-
shutdown_one_device(dev);
4838-
}
4839-
48404817
/**
48414818
* device_shutdown - call ->shutdown() on each device to shutdown.
48424819
*/
48434820
void device_shutdown(void)
48444821
{
48454822
struct device *dev, *parent;
4846-
async_cookie_t cookie = 0;
4847-
struct device_link *link;
4848-
int idx;
48494823

48504824
wait_for_device_probe();
48514825
device_block_probing();
@@ -4876,37 +4850,11 @@ void device_shutdown(void)
48764850
list_del_init(&dev->kobj.entry);
48774851
spin_unlock(&devices_kset->list_lock);
48784852

4879-
4880-
/*
4881-
* Set cookie for devices that will be shut down synchronously
4882-
*/
4883-
if (!dev->driver || !dev->driver->async_shutdown_enable)
4884-
dev->p->shutdown_after = cookie;
4885-
4886-
get_device(dev);
4887-
get_device(parent);
4888-
4889-
cookie = async_schedule_domain(shutdown_one_device_async,
4890-
dev, &sd_domain);
4891-
/*
4892-
* Ensure parent & suppliers wait for this device to shut down
4893-
*/
4894-
if (parent) {
4895-
parent->p->shutdown_after = cookie;
4896-
put_device(parent);
4897-
}
4898-
4899-
idx = device_links_read_lock();
4900-
list_for_each_entry_rcu(link, &dev->links.suppliers, c_node,
4901-
device_links_read_lock_held())
4902-
link->supplier->p->shutdown_after = cookie;
4903-
device_links_read_unlock(idx);
4904-
put_device(dev);
4853+
shutdown_one_device(dev);
49054854

49064855
spin_lock(&devices_kset->list_lock);
49074856
}
49084857
spin_unlock(&devices_kset->list_lock);
4909-
async_synchronize_full_domain(&sd_domain);
49104858
}
49114859

49124860
/*

include/linux/device/driver.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ enum probe_type {
5656
* @mod_name: Used for built-in modules.
5757
* @suppress_bind_attrs: Disables bind/unbind via sysfs.
5858
* @probe_type: Type of the probe (synchronous or asynchronous) to use.
59-
* @async_shutdown_enable: Enables devices to be shutdown asynchronously.
6059
* @of_match_table: The open firmware table.
6160
* @acpi_match_table: The ACPI match table.
6261
* @probe: Called to query the existence of a specific device,
@@ -103,7 +102,6 @@ struct device_driver {
103102

104103
bool suppress_bind_attrs; /* disables bind/unbind via sysfs */
105104
enum probe_type probe_type;
106-
bool async_shutdown_enable;
107105

108106
const struct of_device_id *of_match_table;
109107
const struct acpi_device_id *acpi_match_table;

0 commit comments

Comments
 (0)