Add corekeeper to pine64-default (WIP)

Remove debugging messages from sun8i-default corekeeper
This commit is contained in:
zador-blood-stained 2016-05-18 13:42:24 +03:00
parent 259bacc7e0
commit dff98cae2e
2 changed files with 83 additions and 2 deletions

View file

@ -0,0 +1,81 @@
diff --git a/drivers/thermal/sunxi_budget_cooling/sunxi-budget-cooling-hotplug.c b/drivers/thermal/sunxi_budget_cooling/sunxi-budget-cooling-hotplug.c
index f5974b3..ed394c3 100755
--- a/drivers/thermal/sunxi_budget_cooling/sunxi-budget-cooling-hotplug.c
+++ b/drivers/thermal/sunxi_budget_cooling/sunxi-budget-cooling-hotplug.c
@@ -12,6 +12,7 @@
#include "sunxi-budget-cooling.h"
static int boot_cpu;
+static u32 old_cooling_state;
#ifdef CONFIG_CPU_AUTOHOTPLUG_ROOMAGE
extern int autohotplug_roomage_limit(unsigned int cluster_id, unsigned int min, unsigned int max);
#endif
@@ -31,6 +32,21 @@ static int budget_get_any_online_cpu(const cpumask_t *mask)
return lastcpu;
}
+static int budget_get_any_offline_cpu(const cpumask_t *mask)
+{
+ int cpu,lastcpu=0xffff;
+
+ for_each_cpu(cpu, mask) {
+ if (cpu_is_offline(cpu)){
+ if(lastcpu == 0xffff)
+ lastcpu = cpu;
+ else if(cpu >lastcpu)
+ lastcpu = cpu;
+ }
+ }
+ return lastcpu;
+}
+
static int budget_get_online_cpus(const cpumask_t *mask)
{
int cpu,num =0;
@@ -47,7 +63,7 @@ int sunxi_hotplug_update_state(struct sunxi_budget_cooling_device *cooling_devic
s32 ret = 0;
u32 online = 0, i = 0, cpuid;
u32 max, min;
- u32 takedown;
+ u32 takedown, bringup = 0;
u32 cooling_state = cooling_device->cooling_state;
unsigned long cpuid_l, flags;
struct sunxi_budget_hotplug *hotplug = cooling_device->hotplug;
@@ -76,6 +92,20 @@ int sunxi_hotplug_update_state(struct sunxi_budget_cooling_device *cooling_devic
takedown = (online > max)?(online - max):0;
+ if ((cooling_state < old_cooling_state) && (takedown == 0))
+ {
+ /* pr_info("CPU Budget:plugging cores, old state %d, new state %d\n",old_cooling_state,cooling_state); */
+ switch (cooling_state)
+ {
+ case 2:
+ case 1:
+ case 0:
+ bringup = (online < max)?(max - online):0;
+ break;
+ }
+ }
+ old_cooling_state = cooling_state;
+
while(takedown){
cpuid = budget_get_any_online_cpu(&cooling_device->cluster_cpus[cluster]);
if (cpuid < nr_cpu_ids){
@@ -86,6 +116,16 @@ int sunxi_hotplug_update_state(struct sunxi_budget_cooling_device *cooling_devic
takedown--;
}
+ while(bringup){
+ cpuid = budget_get_any_offline_cpu(&cooling_device->cluster_cpus[cluster]);
+ if (cpuid < nr_cpu_ids){
+ pr_info("CPU Budget:Try to up cpu %d, cluster%d online %d, max %d\n",cpuid,cluster,online,max);
+ cpuid_l = cpuid;
+ ret = work_on_cpu(boot_cpu, (long(*)(void *))cpu_up, (void *)cpuid_l);
+ }
+ bringup--;
+ }
+
return ret;
}
EXPORT_SYMBOL(sunxi_hotplug_update_state);

View file

@ -1,5 +1,5 @@
diff --git a/drivers/thermal/cpu_budget_cooling.c b/drivers/thermal/cpu_budget_cooling.c
index 2a2aad7..8d8fc4a 100755
index 2a2aad7..419a4a4 100755
--- a/drivers/thermal/cpu_budget_cooling.c
+++ b/drivers/thermal/cpu_budget_cooling.c
@@ -30,6 +30,7 @@
@ -68,7 +68,7 @@ index 2a2aad7..8d8fc4a 100755
+#ifdef CONFIG_ARCH_SUN8IW7
+ if (corekeeper_enabled && (cooling_state < old_cooling_state) && (c0_takedown + c1_takedown == 0))
+ {
+ pr_info("CPU Budget:plugging cores, old state %d, new state %d\n",old_cooling_state,cooling_state);
+ /* pr_info("CPU Budget:plugging cores, old state %d, new state %d\n",old_cooling_state,cooling_state); */
+ switch (cooling_state)
+ {
+ case 2: