forked from Minki/linux
4f3549d72d
In some cases, graceful hot-removal of devices is not possible, although in principle the devices in question support hotplug. For example, that may happen for the last CPU in the system or for memory modules holding kernel memory. In those cases it is nice to be able to check if the given device can be gracefully hot-removed before triggering a removal procedure that cannot be aborted or reversed. Unfortunately, however, the kernel currently doesn't provide any support for that. To address that deficiency, introduce support for offline and online operations that can be performed on devices, respectively, before a hot-removal and in case when it is necessary (or convenient) to put a device back online after a successful offline (that has not been followed by removal). The idea is that the offline will fail whenever the given device cannot be gracefully removed from the system and it will not be allowed to use the device after a successful offline (until a subsequent online) in analogy with the existing CPU offline/online mechanism. For now, the offline and online operations are introduced at the bus type level, as that should be sufficient for the most urgent use cases (CPUs and memory modules). In the future, however, the approach may be extended to cover some more complicated device offline/online scenarios involving device drivers etc. The lock_device_hotplug() and unlock_device_hotplug() functions are introduced because subsequent patches need to put larger pieces of code under device_hotplug_lock to prevent race conditions between device offline and removal from happening. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Toshi Kani <toshi.kani@hp.com>
21 lines
1008 B
Plaintext
21 lines
1008 B
Plaintext
What: /sys/devices/.../online
|
|
Date: April 2013
|
|
Contact: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
|
|
Description:
|
|
The /sys/devices/.../online attribute is only present for
|
|
devices whose bus types provide .online() and .offline()
|
|
callbacks. The number read from it (0 or 1) reflects the value
|
|
of the device's 'offline' field. If that number is 1 and '0'
|
|
(or 'n', or 'N') is written to this file, the device bus type's
|
|
.offline() callback is executed for the device and (if
|
|
successful) its 'offline' field is updated accordingly. In
|
|
turn, if that number is 0 and '1' (or 'y', or 'Y') is written to
|
|
this file, the device bus type's .online() callback is executed
|
|
for the device and (if successful) its 'offline' field is
|
|
updated as appropriate.
|
|
|
|
After a successful execution of the bus type's .offline()
|
|
callback the device cannot be used for any purpose until either
|
|
it is removed (i.e. device_del() is called for it), or its bus
|
|
type's .online() is exeucted successfully.
|