Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2d295abd authored by Puja Gupta's avatar Puja Gupta
Browse files

sched: Call init_sched_energy_costs() before sched_energy_probe()



There is no guarantee that init_sched_energy_costs() is completed before
sched_energy_probe() gets called. Make sure this happens.

While at it, do some code cleanup of unused code.

Change-Id: I4bd49f7c98dfafb9b794372259f19461900df857
Signed-off-by: default avatarPuja Gupta <pujag@codeaurora.org>
parent 4875db87
Loading
Loading
Loading
Loading
+0 −3
Original line number Original line Diff line number Diff line
@@ -44,9 +44,6 @@ int pcibus_to_node(struct pci_bus *bus);
/* Enable topology flag updates */
/* Enable topology flag updates */
#define arch_update_cpu_topology topology_update_cpu_topology
#define arch_update_cpu_topology topology_update_cpu_topology


#define arch_update_cpu_capacity update_cpu_power_capacity
extern void update_cpu_power_capacity(int cpu);

#include <asm-generic/topology.h>
#include <asm-generic/topology.h>


#endif /* _ASM_ARM_TOPOLOGY_H */
#endif /* _ASM_ARM_TOPOLOGY_H */
+0 −21
Original line number Original line Diff line number Diff line
@@ -317,27 +317,6 @@ const struct sched_group_energy * const cpu_system_energy(int cpu)
	return sge_array[cpu][SD_LEVEL2];
	return sge_array[cpu][SD_LEVEL2];
}
}


static void update_cpu_capacity(unsigned int cpu)
{
	unsigned long capacity = SCHED_CAPACITY_SCALE;

	if (cpu_core_energy(cpu)) {
		int max_cap_idx = cpu_core_energy(cpu)->nr_cap_states - 1;

		capacity = cpu_core_energy(cpu)->cap_states[max_cap_idx].cap;
	}

	topology_set_cpu_scale(cpu, capacity);

	pr_info("CPU%d: update cpu_capacity %lu\n",
		cpu, arch_scale_cpu_capacity(NULL, cpu));
}

void update_cpu_power_capacity(int cpu)
{
	update_cpu_capacity(cpu);
}

static struct sched_domain_topology_level arm64_topology[] = {
static struct sched_domain_topology_level arm64_topology[] = {
#ifdef CONFIG_SCHED_SMT
#ifdef CONFIG_SCHED_SMT
	{ cpu_smt_mask, smt_flags, SD_INIT_NAME(SMT) },
	{ cpu_smt_mask, smt_flags, SD_INIT_NAME(SMT) },
+4 −0
Original line number Original line Diff line number Diff line
@@ -48,6 +48,7 @@ static void free_resources(void)
		}
		}
	}
	}
}
}
static bool sge_ready;


void init_sched_energy_costs(void)
void init_sched_energy_costs(void)
{
{
@@ -136,6 +137,7 @@ void init_sched_energy_costs(void)
		}
		}
	}
	}


	sge_ready = true;
	pr_info("Sched-energy-costs installed from DT\n");
	pr_info("Sched-energy-costs installed from DT\n");
	return;
	return;


@@ -153,6 +155,8 @@ static int sched_energy_probe(struct platform_device *pdev)


	if (!sched_is_energy_aware())
	if (!sched_is_energy_aware())
		return 0;
		return 0;
	if (!sge_ready)
		return -EPROBE_DEFER;


	max_frequencies = kmalloc_array(nr_cpu_ids, sizeof(unsigned long),
	max_frequencies = kmalloc_array(nr_cpu_ids, sizeof(unsigned long),
					GFP_KERNEL);
					GFP_KERNEL);
+0 −7
Original line number Original line Diff line number Diff line
@@ -1844,13 +1844,6 @@ unsigned long arch_scale_cpu_capacity(struct sched_domain *sd, int cpu)
}
}
#endif
#endif


#ifndef arch_update_cpu_capacity
static __always_inline
void arch_update_cpu_capacity(int cpu)
{
}
#endif

#ifdef CONFIG_SMP
#ifdef CONFIG_SMP
static inline unsigned long capacity_of(int cpu)
static inline unsigned long capacity_of(int cpu)
{
{