static int exynos_dm_hotplug_notifier(struct notifier_block *notifier, unsigned long pm_event, void *v) { switch (pm_event) { case PM_SUSPEND_PREPARE: in_suspend_prepared = true; if (dynamic_hotplug(CMD_LOW_POWER)) prev_cmd = CMD_LOW_POWER; exynos_dm_hotplug_disable(); kthread_stop(dm_hotplug_task); break; case PM_POST_SUSPEND: in_suspend_prepared = false; exynos_dm_hotplug_enable(); dm_hotplug_task = kthread_create(on_run, NULL, "thread_hotplug"); if (IS_ERR(dm_hotplug_task)) { pr_err("Failed in creation of thread.\n"); return -EINVAL; } wake_up_process(dm_hotplug_task); break; } return NOTIFY_OK; }
static void event_hotplug_in_work(struct work_struct *work) { if(!dynamic_hotplug(CMD_NORMAL)) prev_cmd = CMD_NORMAL; else pr_err("%s: failed hotplug in\n", __func__); }
void argos_dm_hotplug_enable(void) { exynos_dm_hotplug_enable(); #if defined(CONFIG_SCHED_HMP) if (big_hotpluged) dynamic_hotplug(CMD_BIG_OUT); #endif }
static int exynos_dm_hotplug_notifier(struct notifier_block *notifier, unsigned long pm_event, void *v) { switch (pm_event) { case PM_SUSPEND_PREPARE: mutex_lock(&thread_lock); in_suspend_prepared = true; if(nr_sleep_prepare_cpus > 1) { pr_info("%s, %d : dynamic_hotplug CMD_SLEEP_PREPARE\n", __func__, __LINE__); if (!dynamic_hotplug(CMD_SLEEP_PREPARE)) prev_cmd = CMD_LOW_POWER; } else { if (!dynamic_hotplug(CMD_LOW_POWER)) prev_cmd = CMD_LOW_POWER; } exynos_dm_hotplug_disable(); if (dm_hotplug_task) { kthread_stop(dm_hotplug_task); dm_hotplug_task = NULL; } mutex_unlock(&thread_lock); break; case PM_POST_SUSPEND: mutex_lock(&thread_lock); exynos_dm_hotplug_enable(); dm_hotplug_task = kthread_create(on_run, NULL, "thread_hotplug"); if (IS_ERR(dm_hotplug_task)) { mutex_unlock(&thread_lock); pr_err("Failed in creation of thread.\n"); return -EINVAL; } in_suspend_prepared = false; wake_up_process(dm_hotplug_task); mutex_unlock(&thread_lock); break; } return NOTIFY_OK; }
static ssize_t store_enable_dm_hotplug(struct kobject *kobj, struct attribute *attr, const char *buf, size_t count) { int enable_input; if (!sscanf(buf, "%1d", &enable_input)) return -EINVAL; if (enable_input > 1 || enable_input < 0) { pr_err("%s: invalid value (%d)\n", __func__, enable_input); return -EINVAL; } if (enable_input) { do_enable_hotplug = true; if (exynos_dm_hotplug_disabled()) exynos_dm_hotplug_enable(); else pr_info("%s: dynamic hotplug already enabled\n", __func__); #if defined(CONFIG_SCHED_HMP) if (cluster1_hotplugged) { if (dynamic_hotplug(CMD_CLUST1_OUT)) { pr_err("%s: Cluster1 core hotplug_out is failed\n", __func__); do_enable_hotplug = false; return -EINVAL; } } #endif do_enable_hotplug = false; } else { do_disable_hotplug = true; if (!dynamic_hotplug(CMD_NORMAL)) prev_cmd = CMD_NORMAL; if (!exynos_dm_hotplug_disabled()) exynos_dm_hotplug_disable(); else pr_info("%s: dynamic hotplug already disabled\n", __func__); do_disable_hotplug = false; } return count; }
int cluster1_cores_hotplug(bool out_flag) { int ret = 0; mutex_lock(&cluster1_hotplug_lock); if (out_flag) { do_hotplug_out = true; if (cluster1_hotplugged) { cluster1_hotplugged++; do_hotplug_out = false; goto out; } ret = dynamic_hotplug(CMD_CLUST1_OUT); if (!ret) { cluster1_hotplugged++; do_hotplug_out = false; } } else { if (WARN_ON(cluster1_hotplugged == 0)) { pr_err("%s: cluster1 cores already hotplug in\n", __func__); ret = -EINVAL; goto out; } if (cluster1_hotplugged > 1) { cluster1_hotplugged--; goto out; } ret = dynamic_hotplug(CMD_CLUST1_IN); if (!ret) cluster1_hotplugged--; } out: mutex_unlock(&cluster1_hotplug_lock); return ret; }
int big_cores_hotplug(bool out_flag) { int ret = 0; mutex_lock(&big_hotplug_lock); if (out_flag) { do_hotplug_out = true; if (big_hotpluged) { big_hotpluged++; do_hotplug_out = false; goto out; } ret = dynamic_hotplug(CMD_BIG_OUT); if (!ret) { big_hotpluged++; do_hotplug_out = false; } } else { if (WARN_ON(big_hotpluged == 0)) { pr_err("%s: big cores already hotplug in\n", __func__); ret = -EINVAL; goto out; } if (big_hotpluged > 1) { big_hotpluged--; goto out; } ret = dynamic_hotplug(CMD_BIG_IN); if (!ret) big_hotpluged--; } out: mutex_unlock(&big_hotplug_lock); return ret; }
static void force_dynamic_hotplug_work(struct work_struct *work) { enum hotplug_cmd cmd; forced_hotplug = force_out_flag; calc_load(); cmd = diagnose_condition(); if (!dynamic_hotplug(cmd)) prev_cmd = cmd; }
static int __ref exynos_dm_hotplug_notifier(struct notifier_block *notifier, unsigned long pm_event, void *v) { int i, j; switch (pm_event) { case PM_SUSPEND_PREPARE: mutex_lock(&thread_lock); in_suspend_prepared = true; if (!dynamic_hotplug(CMD_NORMAL)) prev_cmd = CMD_NORMAL; exynos_dm_hotplug_disable(); if (dm_hotplug_task) { kthread_stop(dm_hotplug_task); dm_hotplug_task = NULL; } for (i = 4; i < 11; i++) { j = i; if (j >= 8) j = 11 - j; if (!cpu_online(j)) { cpu_up(j); } } mutex_unlock(&thread_lock); break; case PM_POST_SUSPEND: mutex_lock(&thread_lock); exynos_dm_hotplug_enable(); dm_hotplug_task = kthread_create(on_run, NULL, "thread_hotplug"); if (IS_ERR(dm_hotplug_task)) { mutex_unlock(&thread_lock); pr_err("Failed in creation of thread.\n"); return -EINVAL; } in_suspend_prepared = false; wake_up_process(dm_hotplug_task); mutex_unlock(&thread_lock); break; } return NOTIFY_OK; }
int cluster0_core1_hotplug_in(bool in_flag) { int ret = 0; mutex_lock(&cluster0_hotplug_in_lock); if (in_flag) { if (cluster0_hotplug_in) { cluster0_hotplug_in++; goto out; } ret = dynamic_hotplug(CMD_CLUST0_ONE_IN); if (!ret) cluster0_hotplug_in++; } else { if (WARN_ON(cluster0_hotplug_in == 0)) { pr_err("%s: little core1 already hotplug out\n", __func__); ret = -EINVAL; goto out; } if (cluster0_hotplug_in > 1) { cluster0_hotplug_in--; goto out; } ret = dynamic_hotplug(CMD_CLUST0_ONE_OUT); if (!ret) cluster0_hotplug_in--; } out: mutex_unlock(&cluster0_hotplug_in_lock); return ret; }
static void thread_manage_work(struct work_struct *work) { mutex_lock(&thread_manage_lock); if (thread_start) { dm_hotplug_task = kthread_create(on_run, NULL, "thread_hotplug"); if (IS_ERR(dm_hotplug_task)) { pr_err("Failed in creation of thread.\n"); return; } wake_up_process(dm_hotplug_task); } else { if (dm_hotplug_task) { kthread_stop(dm_hotplug_task); dm_hotplug_task = NULL; if (!dynamic_hotplug(CMD_NORMAL)) prev_cmd = CMD_NORMAL; } } mutex_unlock(&thread_manage_lock); }
void argos_dm_hotplug_disable(void) { if (!dynamic_hotplug(CMD_NORMAL)) prev_cmd = CMD_NORMAL; exynos_dm_hotplug_disable(); }