sched: walt: Setup complex sibling hints at init

Currently, we are determining the L2 cache sibling of silvers at runtime
on every iteration FBT. It is better to do this setup once, and gather
this information from hardware rather than hardcoding the results.

Change-Id: I06ec2f590dc9ccc2ec9161f1a60eb47d77244153
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Signed-off-by: Shaleen Agrawal <shalagra@codeaurora.org>
This commit is contained in:
Shaleen Agrawal 2021-06-10 09:31:39 -07:00 committed by Rishabh Bhatnagar
parent d5046c9052
commit ee77eeeb73
3 changed files with 39 additions and 7 deletions

View File

@ -2517,6 +2517,41 @@ static void walt_get_possible_siblings(int cpuid, struct cpumask *cluster_cpus)
}
}
int cpu_l2_sibling[WALT_NR_CPUS] = {[0 ... WALT_NR_CPUS-1] = -1};
static void find_cache_siblings(void)
{
int cpu, cpu2;
struct device_node *cpu_dev, *cpu_dev2, *cpu_l2_cache_node, *cpu_l2_cache_node2;
for_each_possible_cpu(cpu) {
cpu_dev = of_get_cpu_node(cpu, NULL);
if (!cpu_dev)
continue;
cpu_l2_cache_node = of_parse_phandle(cpu_dev, "next-level-cache", 0);
if (!cpu_l2_cache_node)
continue;
for_each_possible_cpu(cpu2) {
if (cpu == cpu2)
continue;
cpu_dev2 = of_get_cpu_node(cpu2, NULL);
if (!cpu_dev2)
continue;
cpu_l2_cache_node2 = of_parse_phandle(cpu_dev2, "next-level-cache", 0);
if (!cpu_l2_cache_node2)
continue;
if (cpu_l2_cache_node == cpu_l2_cache_node2) {
cpu_l2_sibling[cpu] = cpu2;
break;
}
}
}
}
static void walt_update_cluster_topology(void)
{
struct cpumask cpus = *cpu_possible_mask;
@ -2584,6 +2619,7 @@ static void walt_update_cluster_topology(void)
init_cpu_array();
build_cpu_array();
find_cache_siblings();
create_util_to_cost();
walt_clusters_parsed = true;

View File

@ -147,7 +147,7 @@ extern unsigned int sched_capacity_margin_up[WALT_NR_CPUS];
extern unsigned int sched_capacity_margin_down[WALT_NR_CPUS];
extern cpumask_t asym_cap_sibling_cpus;
extern cpumask_t __read_mostly **cpu_array;
extern int cpu_l2_sibling[WALT_NR_CPUS];
extern void sched_update_nr_prod(int cpu, int enq);
extern unsigned int walt_big_tasks(int cpu);
extern void walt_rotate_work_init(void);

View File

@ -215,12 +215,8 @@ enum fastpaths {
static inline bool is_complex_sibling_idle(int cpu)
{
if (is_min_capacity_cpu(cpu)) {
if (cpu % 2)
return available_idle_cpu(cpu - 1);
return available_idle_cpu(cpu + 1);
}
if (cpu_l2_sibling[cpu] != -1)
return available_idle_cpu(cpu_l2_sibling[cpu]);
return false;
}