module/hotplug: optimize online_all
Optimize online_all by offloading it to a shutils function which only
requres a single call to the target.
diff --git a/devlib/bin/scripts/shutils.in b/devlib/bin/scripts/shutils.in
index 004030d..a678a65 100755
--- a/devlib/bin/scripts/shutils.in
+++ b/devlib/bin/scripts/shutils.in
@@ -196,6 +196,19 @@
}
################################################################################
+# Hotplug
+################################################################################
+
+hotplug_online_all() {
+ PATHS=(/sys/devices/system/cpu/cpu[0-9]*)
+ for path in "${PATHS[@]}"; do
+ if [ $(cat $path/online) -eq 0 ]; then
+ echo 1 > $path/online
+ fi
+ done
+}
+
+################################################################################
# Misc
################################################################################
@@ -252,6 +265,9 @@
ftrace_get_function_stats)
ftrace_get_function_stats
;;
+hotplug_online_all)
+ hotplug_online_all
+ ;;
read_tree_values)
read_tree_values $*
;;
diff --git a/devlib/module/hotplug.py b/devlib/module/hotplug.py
index 8ae238e..cfce2e5 100644
--- a/devlib/module/hotplug.py
+++ b/devlib/module/hotplug.py
@@ -21,7 +21,8 @@
return target.path.join(cls.base_path, cpu, 'online')
def online_all(self):
- self.online(*range(self.target.number_of_cpus))
+ self.target._execute_util('hotplug_online_all',
+ as_root=self.target.is_rooted)
def online(self, *args):
for cpu in args: