mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
core_ctl: Switch isolation to new hotplug state callbacks
Converting the cpu notifier events based core isolation into registered core ctl isolation hotplug state callbacks as per new state based cpu hotplug framework. Change-Id: I04fa336cc51b535d98c8de8246a643bafb60f73f Signed-off-by: Sabyasachi Singh <sssingh@codeaurora.org> Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
This commit is contained in:
parent
40a44d2b1e
commit
a0efb32ceb
@ -69,6 +69,7 @@ enum cpuhp_state {
|
||||
CPUHP_SLAB_PREPARE,
|
||||
CPUHP_MD_RAID5_PREPARE,
|
||||
CPUHP_RCUTREE_PREP,
|
||||
CPUHP_CORE_CTL_ISOLATION_DEAD,
|
||||
CPUHP_CPUIDLE_COUPLED_PREPARE,
|
||||
CPUHP_POWERPC_PMAC_PREPARE,
|
||||
CPUHP_POWERPC_MMU_CTX_PREPARE,
|
||||
|
@ -13,7 +13,6 @@
|
||||
#define pr_fmt(fmt) "core_ctl: " fmt
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/notifier.h>
|
||||
#include <linux/cpu.h>
|
||||
#include <linux/cpumask.h>
|
||||
#include <linux/cpufreq.h>
|
||||
@ -878,21 +877,18 @@ static int __ref try_core_ctl(void *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __ref cpu_callback(struct notifier_block *nfb,
|
||||
unsigned long action, void *hcpu)
|
||||
static int isolation_cpuhp_state(unsigned int cpu, bool online)
|
||||
{
|
||||
uint32_t cpu = (uintptr_t)hcpu;
|
||||
struct cpu_data *state = &per_cpu(cpu_state, cpu);
|
||||
struct cluster_data *cluster = state->cluster;
|
||||
unsigned int need;
|
||||
bool do_wakeup, unisolated = false;
|
||||
bool do_wakeup = false, unisolated = false;
|
||||
unsigned long flags;
|
||||
|
||||
if (unlikely(!cluster || !cluster->inited))
|
||||
return NOTIFY_DONE;
|
||||
return 0;
|
||||
|
||||
switch (action & ~CPU_TASKS_FROZEN) {
|
||||
case CPU_ONLINE:
|
||||
if (online) {
|
||||
cluster->active_cpus = get_active_cpu_count(cluster);
|
||||
|
||||
/*
|
||||
@ -902,9 +898,7 @@ static int __ref cpu_callback(struct notifier_block *nfb,
|
||||
* reject trying to online CPUs.
|
||||
*/
|
||||
move_cpu_lru(state);
|
||||
break;
|
||||
|
||||
case CPU_DEAD:
|
||||
} else {
|
||||
/*
|
||||
* We don't want to have a CPU both offline and isolated.
|
||||
* So unisolate a CPU that went down if it was isolated by us.
|
||||
@ -920,9 +914,6 @@ static int __ref cpu_callback(struct notifier_block *nfb,
|
||||
|
||||
state->busy = 0;
|
||||
cluster->active_cpus = get_active_cpu_count(cluster);
|
||||
break;
|
||||
default:
|
||||
return NOTIFY_DONE;
|
||||
}
|
||||
|
||||
need = apply_limits(cluster, cluster->need_cpus);
|
||||
@ -934,12 +925,18 @@ static int __ref cpu_callback(struct notifier_block *nfb,
|
||||
if (do_wakeup)
|
||||
wake_up_core_ctl_thread(cluster);
|
||||
|
||||
return NOTIFY_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct notifier_block __refdata cpu_notifier = {
|
||||
.notifier_call = cpu_callback,
|
||||
};
|
||||
static int core_ctl_isolation_online_cpu(unsigned int cpu)
|
||||
{
|
||||
return isolation_cpuhp_state(cpu, true);
|
||||
}
|
||||
|
||||
static int core_ctl_isolation_dead_cpu(unsigned int cpu)
|
||||
{
|
||||
return isolation_cpuhp_state(cpu, false);
|
||||
}
|
||||
|
||||
/* ============================ init code ============================== */
|
||||
|
||||
@ -1069,7 +1066,13 @@ static int __init core_ctl_init(void)
|
||||
if (should_skip(cpu_possible_mask))
|
||||
return 0;
|
||||
|
||||
register_cpu_notifier(&cpu_notifier);
|
||||
cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN,
|
||||
"core_ctl/isolation:online",
|
||||
core_ctl_isolation_online_cpu, NULL);
|
||||
|
||||
cpuhp_setup_state_nocalls(CPUHP_CORE_CTL_ISOLATION_DEAD,
|
||||
"core_ctl/isolation:dead",
|
||||
NULL, core_ctl_isolation_dead_cpu);
|
||||
|
||||
for_each_cpu(cpu, &cpus) {
|
||||
int ret;
|
||||
|
Loading…
x
Reference in New Issue
Block a user