sched: fix flags in sched_power
authorLukasz Luba <l.luba@partner.samsung.com>
Fri, 9 Nov 2018 13:11:04 +0000 (14:11 +0100)
committerLukasz Luba <l.luba@partner.samsung.com>
Fri, 17 May 2019 07:15:52 +0000 (09:15 +0200)
Fix values of the flag.

Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com>
kernel/sched/power.c
kernel/sched/sched.h

index 5639e6c2825d2ce4f2e9ca9ea0da77eced191e8f..fded1ba78b5e2fb86978ac9aee31a3fd0c7301c2 100644 (file)
@@ -131,15 +131,15 @@ EXPORT_SYMBOL_GPL(sched_power_cpu_reinit_weight);
 //////////////////////////////////////////////////////////////
 
 
-static bool should_update_next_weight(u64 time, int flags)
+static bool should_process_next_request(u64 time, int flags)
 {
        if (flags & SCHED_POWER_FORCE_UPDATE_RT)
                return 1;
 
-       if (time >= sched_clock() + MINIMUM_UPDATE_TIME)
-               return 1;
+       /* if (time >= sched_clock() + MINIMUM_UPDATE_TIME) */
+       /*      return 1; */
 
-       return 0;
+       return 1;
 }
 
 static int play_idle_setup;
@@ -240,12 +240,14 @@ static int sched_power_reweight_cluster(int cpu, struct cpumask *cpus,
        mutex_unlock(&tz_list_lock);
 
        if (system_zone) {
+               pr_info("zone found\n");
                mutex_lock(&system_zone->lock);
                cluster_inst->weight = weight;
                mutex_unlock(&system_zone->lock);
                thermal_notify_framework(system_zone->tz,
                                         system_zone->trip_ctrl_alg.desired_id);
        } else {
+               pr_info("no such zone\n");
                return -ENODEV;
        }
 
@@ -277,6 +279,7 @@ static int sched_power_handle_request(struct power_request *req)
 
        cpower = (&per_cpu(cpu_power, req->cpu));
 
+       pr_info("req->flags=%d\n", req->flags);
        switch (req->flags) {
        case SCHED_POWER_CPU_WEIGHT:
                break;
@@ -338,7 +341,7 @@ static void sched_power_irq_work(struct irq_work *irq_work)
 }
 
 static void
-sched_power_update_cpu_weight(struct cpu_power *cpower, int cpu, int weight,
+sched_power_update_weight(struct cpu_power *cpower, int cpu, int weight,
                              int flags, int time)
 {
        raw_spin_lock(&cpower->update_lock);
@@ -361,15 +364,17 @@ static void sched_power_update(struct update_sched_power *update, int cpu,
                return;
 
        /* Filter to frequent changes or not needed*/
-       if (!should_update_next_weight(time, flags))
+       if (!should_process_next_request(time, flags))
                return;
 
+       flags &= 0x3;
+
        switch (flags) {
        case SCHED_POWER_CPU_WEIGHT:
-               sched_power_update_cpu_weight(cpower, cpu, weight, flags, time);
+               sched_power_update_weight(cpower, cpu, weight, flags, time);
                break;
        case SCHED_POWER_CLUSTER_WEIGHT:
-
+               sched_power_update_weight(cpower, cpu, weight, flags, time);
                break;
        default:
                return;
@@ -382,7 +387,8 @@ static void sched_power_update(struct update_sched_power *update, int cpu,
                irq_work_queue(&sp->irq_work);
        }
 
-       if (!play_idle_setup && cpu == 4) {
+       if (!play_idle_setup) {
+               pr_info("play idle demo\n");
                play_idle_setup = 1;
                idle_inject_set_duration(cpower->ii_dev, 10, 4);
                idle_inject_start(cpower->ii_dev);
@@ -670,8 +676,8 @@ static int set_power(struct _cooling_instance *inst, struct _thermal_zone *zone,
        cdev = inst->cooling->cdev;
        ret = cdev->ops->power2state(cdev, tz, power, &state);
 
-       pr_info("set_power=%u, state=%lu, temp=%d\n", power, state,
-               tz->temperature);
+       pr_info("inst_weight=%u, set_power=%u, state=%lu, temp=%d\n",
+               inst->weight, power, state, tz->temperature);
        if (!ret) {
                ret = cooling_dev_set_state(zone, inst->cooling, state);
        }
index 0b8f8505d3bcdba998c83bb83110f01806950c6e..838bb7d318be4a95e1c9fd243b011ac4e9b35235 100644 (file)
@@ -2245,9 +2245,9 @@ unsigned long scale_irq_capacity(unsigned long util, unsigned long irq, unsigned
 }
 #endif
 
-#define SCHED_POWER_FORCE_UPDATE_RT 0x01
-#define SCHED_POWER_CPU_WEIGHT 0x2
-#define SCHED_POWER_CLUSTER_WEIGHT 0x4
+#define SCHED_POWER_CPU_WEIGHT 0x1
+#define SCHED_POWER_CLUSTER_WEIGHT 0x2
+#define SCHED_POWER_FORCE_UPDATE_RT 0x04
 
 #ifdef CONFIG_THERMAL
 struct update_sched_power {