lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1399572454-30239-2-git-send-email-keith.busch@intel.com>
Date:	Thu,  8 May 2014 12:07:33 -0600
From:	Keith Busch <keith.busch@...el.com>
To:	linux-nvme@...ts.infradead.org, gregkh@...uxfoundation.org,
	linux-kernel@...r.kernel.org
Cc:	Keith Busch <keith.busch@...el.com>
Subject: [PATCH 1/2] driver-core: allow asynchronous device shutdown

A patch to allow .shutdown to execute asynchronously. Some devices may
take a long time to complete a shutdown, so this patch lets a driver
safely shutdown multiple devices asynchronously.

This uses an exclusive asynchronous domain so other unrelated async
tasks can't cause shutdown to hold up indefinitely.

Signed-off-by: Keith Busch <keith.busch@...el.com>
---
 drivers/base/core.c    |    4 ++++
 include/linux/device.h |    1 +
 2 files changed, 5 insertions(+)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index 20da3ad..71b83bb 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -10,6 +10,7 @@
  *
  */
 
+#include <linux/async.h>
 #include <linux/device.h>
 #include <linux/err.h>
 #include <linux/init.h>
@@ -1926,6 +1927,8 @@ out:
 }
 EXPORT_SYMBOL_GPL(device_move);
 
+ASYNC_DOMAIN_EXCLUSIVE(shutdown_domain);
+EXPORT_SYMBOL(shutdown_domain);
 /**
  * device_shutdown - call ->shutdown() on each device to shutdown.
  */
@@ -1986,6 +1989,7 @@ void device_shutdown(void)
 		spin_lock(&devices_kset->list_lock);
 	}
 	spin_unlock(&devices_kset->list_lock);
+	async_synchronize_full_domain(&shutdown_domain);
 }
 
 /*
diff --git a/include/linux/device.h b/include/linux/device.h
index d1d1c05..95ed9f1 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -997,6 +997,7 @@ static inline int devtmpfs_mount(const char *mountpoint) { return 0; }
 
 /* drivers/base/power/shutdown.c */
 extern void device_shutdown(void);
+extern struct async_domain shutdown_domain;
 
 /* debugging and troubleshooting/diagnostic helpers. */
 extern const char *dev_driver_string(const struct device *dev);
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ