These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / cpufreq / cpufreq_governor.h
index cc401d1..5621bb0 100644 (file)
@@ -109,7 +109,7 @@ store_one(_gov, file_name)
 
 /* create helper routines */
 #define define_get_cpu_dbs_routines(_dbs_info)                         \
-static struct cpu_dbs_common_info *get_cpu_cdbs(int cpu)               \
+static struct cpu_dbs_info *get_cpu_cdbs(int cpu)                      \
 {                                                                      \
        return &per_cpu(_dbs_info, cpu).cdbs;                           \
 }                                                                      \
@@ -128,9 +128,20 @@ static void *get_cpu_dbs_info_s(int cpu)                           \
  * cs_*: Conservative governor
  */
 
+/* Common to all CPUs of a policy */
+struct cpu_common_dbs_info {
+       struct cpufreq_policy *policy;
+       /*
+        * percpu mutex that serializes governor limit change with dbs_timer
+        * invocation. We do not want dbs_timer to run when user is changing
+        * the governor or limits.
+        */
+       struct mutex timer_mutex;
+       ktime_t time_stamp;
+};
+
 /* Per cpu structures */
-struct cpu_dbs_common_info {
-       int cpu;
+struct cpu_dbs_info {
        u64 prev_cpu_idle;
        u64 prev_cpu_wall;
        u64 prev_cpu_nice;
@@ -141,19 +152,12 @@ struct cpu_dbs_common_info {
         * wake-up from idle.
         */
        unsigned int prev_load;
-       struct cpufreq_policy *cur_policy;
-       struct delayed_work work;
-       /*
-        * percpu mutex that serializes governor limit change with gov_dbs_timer
-        * invocation. We do not want gov_dbs_timer to run when user is changing
-        * the governor or limits.
-        */
-       struct mutex timer_mutex;
-       ktime_t time_stamp;
+       struct delayed_work dwork;
+       struct cpu_common_dbs_info *shared;
 };
 
 struct od_cpu_dbs_info_s {
-       struct cpu_dbs_common_info cdbs;
+       struct cpu_dbs_info cdbs;
        struct cpufreq_frequency_table *freq_table;
        unsigned int freq_lo;
        unsigned int freq_lo_jiffies;
@@ -163,10 +167,9 @@ struct od_cpu_dbs_info_s {
 };
 
 struct cs_cpu_dbs_info_s {
-       struct cpu_dbs_common_info cdbs;
+       struct cpu_dbs_info cdbs;
        unsigned int down_skip;
        unsigned int requested_freq;
-       unsigned int enable:1;
 };
 
 /* Per policy Governors sysfs tunables */
@@ -204,15 +207,22 @@ struct common_dbs_data {
         */
        struct dbs_data *gdbs_data;
 
-       struct cpu_dbs_common_info *(*get_cpu_cdbs)(int cpu);
+       struct cpu_dbs_info *(*get_cpu_cdbs)(int cpu);
        void *(*get_cpu_dbs_info_s)(int cpu);
-       void (*gov_dbs_timer)(struct work_struct *work);
+       unsigned int (*gov_dbs_timer)(struct cpu_dbs_info *cdbs,
+                                     struct dbs_data *dbs_data,
+                                     bool modify_all);
        void (*gov_check_cpu)(int cpu, unsigned int load);
-       int (*init)(struct dbs_data *dbs_data);
-       void (*exit)(struct dbs_data *dbs_data);
+       int (*init)(struct dbs_data *dbs_data, bool notify);
+       void (*exit)(struct dbs_data *dbs_data, bool notify);
 
        /* Governor specific ops, see below */
        void *gov_ops;
+
+       /*
+        * Protects governor's data (struct dbs_data and struct common_dbs_data)
+        */
+       struct mutex mutex;
 };
 
 /* Governor Per policy data */
@@ -221,9 +231,6 @@ struct dbs_data {
        unsigned int min_sampling_rate;
        int usage_count;
        void *tuners;
-
-       /* dbs_mutex protects dbs_enable in governor start/stop */
-       struct mutex mutex;
 };
 
 /* Governor specific ops, will be passed to dbs_data->gov_ops */
@@ -234,10 +241,6 @@ struct od_ops {
        void (*freq_increase)(struct cpufreq_policy *policy, unsigned int freq);
 };
 
-struct cs_ops {
-       struct notifier_block *notifier_block;
-};
-
 static inline int delay_for_sampling_rate(unsigned int sampling_rate)
 {
        int delay = usecs_to_jiffies(sampling_rate);
@@ -267,8 +270,6 @@ static ssize_t show_sampling_rate_min_gov_pol                               \
 extern struct mutex cpufreq_governor_lock;
 
 void dbs_check_cpu(struct dbs_data *dbs_data, int cpu);
-bool need_load_eval(struct cpu_dbs_common_info *cdbs,
-               unsigned int sampling_rate);
 int cpufreq_governor_dbs(struct cpufreq_policy *policy,
                struct common_dbs_data *cdata, unsigned int event);
 void gov_queue_work(struct dbs_data *dbs_data, struct cpufreq_policy *policy,