Loading include/trace/events/power.h +0 −43 Original line number Diff line number Diff line Loading @@ -619,49 +619,6 @@ DEFINE_EVENT(dev_pm_qos_request, dev_pm_qos_remove_request, TP_ARGS(name, type, new_value) ); TRACE_EVENT(core_ctl_eval_need, TP_PROTO(unsigned int cpu, unsigned int old_need, unsigned int new_need, unsigned int updated), TP_ARGS(cpu, old_need, new_need, updated), TP_STRUCT__entry( __field(u32, cpu) __field(u32, old_need) __field(u32, new_need) __field(u32, updated) ), TP_fast_assign( __entry->cpu = cpu; __entry->old_need = old_need; __entry->new_need = new_need; __entry->updated = updated; ), TP_printk("cpu=%u, old_need=%u, new_need=%u, updated=%u", __entry->cpu, __entry->old_need, __entry->new_need, __entry->updated) ); TRACE_EVENT(core_ctl_set_busy, TP_PROTO(unsigned int cpu, unsigned int busy, unsigned int old_is_busy, unsigned int is_busy), TP_ARGS(cpu, busy, old_is_busy, is_busy), TP_STRUCT__entry( __field(u32, cpu) __field(u32, busy) __field(u32, old_is_busy) __field(u32, is_busy) ), TP_fast_assign( __entry->cpu = cpu; __entry->busy = busy; __entry->old_is_busy = old_is_busy; __entry->is_busy = is_busy; ), TP_printk("cpu=%u, busy=%u, old_is_busy=%u, new_is_busy=%u", __entry->cpu, __entry->busy, __entry->old_is_busy, __entry->is_busy) ); DECLARE_EVENT_CLASS(kpm_module, TP_PROTO(unsigned int managed_cpus, unsigned int max_cpus), Loading include/trace/events/qhmp_sched.h +44 −0 Original line number Diff line number Diff line Loading @@ -1045,6 +1045,50 @@ TRACE_EVENT(sched_get_nr_running_avg, TP_printk("avg=%d big_avg=%d iowait_avg=%d", __entry->avg, __entry->big_avg, __entry->iowait_avg) ); TRACE_EVENT(core_ctl_eval_need, TP_PROTO(unsigned int cpu, unsigned int old_need, unsigned int new_need, unsigned int updated), TP_ARGS(cpu, old_need, new_need, updated), TP_STRUCT__entry( __field(u32, cpu) __field(u32, old_need) __field(u32, new_need) __field(u32, updated) ), TP_fast_assign( __entry->cpu = cpu; __entry->old_need = old_need; __entry->new_need = new_need; __entry->updated = updated; ), TP_printk("cpu=%u, old_need=%u, new_need=%u, updated=%u", __entry->cpu, __entry->old_need, __entry->new_need, __entry->updated) ); TRACE_EVENT(core_ctl_set_busy, TP_PROTO(unsigned int cpu, unsigned int busy, unsigned int old_is_busy, unsigned int is_busy), TP_ARGS(cpu, busy, old_is_busy, is_busy), TP_STRUCT__entry( __field(u32, cpu) __field(u32, busy) __field(u32, old_is_busy) __field(u32, is_busy) ), TP_fast_assign( __entry->cpu = cpu; __entry->busy = busy; __entry->old_is_busy = old_is_busy; __entry->is_busy = is_busy; ), TP_printk("cpu=%u, busy=%u, old_is_busy=%u, new_is_busy=%u", __entry->cpu, __entry->busy, __entry->old_is_busy, __entry->is_busy) ); #endif /* _TRACE_SCHED_H */ /* This part must be outside protection */ Loading include/trace/events/sched.h +43 −0 Original line number Diff line number Diff line Loading @@ -1269,6 +1269,49 @@ TRACE_EVENT(sched_get_nr_running_avg, __entry->avg, __entry->big_avg, __entry->iowait_avg) ); TRACE_EVENT(core_ctl_eval_need, TP_PROTO(unsigned int cpu, unsigned int old_need, unsigned int new_need, unsigned int updated), TP_ARGS(cpu, old_need, new_need, updated), TP_STRUCT__entry( __field(u32, cpu) __field(u32, old_need) __field(u32, new_need) __field(u32, updated) ), TP_fast_assign( __entry->cpu = cpu; __entry->old_need = old_need; __entry->new_need = new_need; __entry->updated = updated; ), TP_printk("cpu=%u, old_need=%u, new_need=%u, updated=%u", __entry->cpu, __entry->old_need, __entry->new_need, __entry->updated) ); TRACE_EVENT(core_ctl_set_busy, TP_PROTO(unsigned int cpu, unsigned int busy, unsigned int old_is_busy, unsigned int is_busy), TP_ARGS(cpu, busy, old_is_busy, is_busy), TP_STRUCT__entry( __field(u32, cpu) __field(u32, busy) __field(u32, old_is_busy) __field(u32, is_busy) ), TP_fast_assign( __entry->cpu = cpu; __entry->busy = busy; __entry->old_is_busy = old_is_busy; __entry->is_busy = is_busy; ), TP_printk("cpu=%u, busy=%u, old_is_busy=%u, new_is_busy=%u", __entry->cpu, __entry->busy, __entry->old_is_busy, __entry->is_busy) ); #endif /* _TRACE_SCHED_H */ /* This part must be outside protection */ Loading kernel/sched/core_ctl.c +40 −3 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ #include <linux/sched/rt.h> #include <linux/mutex.h> #include <trace/events/power.h> #include <trace/events/sched.h> #define MAX_CPUS_PER_GROUP 4 Loading Loading @@ -60,6 +60,7 @@ struct cpu_data { struct task_struct *hotplug_thread; struct kobject kobj; struct list_head pending_lru; bool disabled; }; static DEFINE_PER_CPU(struct cpu_data, cpu_state); Loading Loading @@ -294,6 +295,9 @@ static ssize_t show_global_state(struct cpu_data *state, char *buf) "\tAvail CPUs: %u\n", c->avail_cpus); count += snprintf(buf + count, PAGE_SIZE - count, "\tNeed CPUs: %u\n", c->need_cpus); count += snprintf(buf + count, PAGE_SIZE - count, "\tStatus: %s\n", c->disabled ? "disabled" : "enabled"); } return count; Loading Loading @@ -340,6 +344,33 @@ static ssize_t show_not_preferred(struct cpu_data *state, char *buf) return count; } static ssize_t store_disable(struct cpu_data *state, const char *buf, size_t count) { unsigned int val; if (sscanf(buf, "%u\n", &val) != 1) return -EINVAL; val = !!val; if (state->disabled == val) return count; state->disabled = val; if (!state->disabled) wake_up_hotplug_thread(state); return count; } static ssize_t show_disable(struct cpu_data *state, char *buf) { return snprintf(buf, PAGE_SIZE, "%u\n", state->disabled); } struct core_ctl_attr { struct attribute attr; ssize_t (*show)(struct cpu_data *, char *); Loading @@ -366,6 +397,7 @@ core_ctl_attr_ro(need_cpus); core_ctl_attr_ro(online_cpus); core_ctl_attr_ro(global_state); core_ctl_attr_rw(not_preferred); core_ctl_attr_rw(disable); static struct attribute *default_attrs[] = { &min_cpus.attr, Loading @@ -380,6 +412,7 @@ static struct attribute *default_attrs[] = { &online_cpus.attr, &global_state.attr, ¬_preferred.attr, &disable.attr, NULL }; Loading Loading @@ -624,6 +657,9 @@ static void wake_up_hotplug_thread(struct cpu_data *state) struct cpu_data *pcpu; bool no_wakeup = false; if (unlikely(state->disabled)) return; for_each_possible_cpu(cpu) { pcpu = &per_cpu(cpu_state, cpu); if (cpu != pcpu->first_cpu) Loading Loading @@ -652,7 +688,7 @@ static void core_ctl_timer_func(unsigned long cpu) struct cpu_data *state = &per_cpu(cpu_state, cpu); unsigned long flags; if (eval_need(state)) { if (eval_need(state) && !state->disabled) { spin_lock_irqsave(&state->pending_lock, flags); state->pending = true; spin_unlock_irqrestore(&state->pending_lock, flags); Loading Loading @@ -866,7 +902,8 @@ static int __ref cpu_callback(struct notifier_block *nfb, * so that there's no race with hotplug thread bringing up more * CPUs than necessary. */ if (apply_limits(f, f->need_cpus) <= f->online_cpus) { if (!f->disabled && apply_limits(f, f->need_cpus) <= f->online_cpus) { pr_debug("Prevent CPU%d onlining\n", cpu); ret = NOTIFY_BAD; } else { Loading kernel/trace/power-traces.c +0 −2 Original line number Diff line number Diff line Loading @@ -14,5 +14,3 @@ #include <trace/events/power.h> EXPORT_TRACEPOINT_SYMBOL_GPL(cpu_idle); EXPORT_TRACEPOINT_SYMBOL(core_ctl_set_busy); EXPORT_TRACEPOINT_SYMBOL(core_ctl_eval_need); Loading
include/trace/events/power.h +0 −43 Original line number Diff line number Diff line Loading @@ -619,49 +619,6 @@ DEFINE_EVENT(dev_pm_qos_request, dev_pm_qos_remove_request, TP_ARGS(name, type, new_value) ); TRACE_EVENT(core_ctl_eval_need, TP_PROTO(unsigned int cpu, unsigned int old_need, unsigned int new_need, unsigned int updated), TP_ARGS(cpu, old_need, new_need, updated), TP_STRUCT__entry( __field(u32, cpu) __field(u32, old_need) __field(u32, new_need) __field(u32, updated) ), TP_fast_assign( __entry->cpu = cpu; __entry->old_need = old_need; __entry->new_need = new_need; __entry->updated = updated; ), TP_printk("cpu=%u, old_need=%u, new_need=%u, updated=%u", __entry->cpu, __entry->old_need, __entry->new_need, __entry->updated) ); TRACE_EVENT(core_ctl_set_busy, TP_PROTO(unsigned int cpu, unsigned int busy, unsigned int old_is_busy, unsigned int is_busy), TP_ARGS(cpu, busy, old_is_busy, is_busy), TP_STRUCT__entry( __field(u32, cpu) __field(u32, busy) __field(u32, old_is_busy) __field(u32, is_busy) ), TP_fast_assign( __entry->cpu = cpu; __entry->busy = busy; __entry->old_is_busy = old_is_busy; __entry->is_busy = is_busy; ), TP_printk("cpu=%u, busy=%u, old_is_busy=%u, new_is_busy=%u", __entry->cpu, __entry->busy, __entry->old_is_busy, __entry->is_busy) ); DECLARE_EVENT_CLASS(kpm_module, TP_PROTO(unsigned int managed_cpus, unsigned int max_cpus), Loading
include/trace/events/qhmp_sched.h +44 −0 Original line number Diff line number Diff line Loading @@ -1045,6 +1045,50 @@ TRACE_EVENT(sched_get_nr_running_avg, TP_printk("avg=%d big_avg=%d iowait_avg=%d", __entry->avg, __entry->big_avg, __entry->iowait_avg) ); TRACE_EVENT(core_ctl_eval_need, TP_PROTO(unsigned int cpu, unsigned int old_need, unsigned int new_need, unsigned int updated), TP_ARGS(cpu, old_need, new_need, updated), TP_STRUCT__entry( __field(u32, cpu) __field(u32, old_need) __field(u32, new_need) __field(u32, updated) ), TP_fast_assign( __entry->cpu = cpu; __entry->old_need = old_need; __entry->new_need = new_need; __entry->updated = updated; ), TP_printk("cpu=%u, old_need=%u, new_need=%u, updated=%u", __entry->cpu, __entry->old_need, __entry->new_need, __entry->updated) ); TRACE_EVENT(core_ctl_set_busy, TP_PROTO(unsigned int cpu, unsigned int busy, unsigned int old_is_busy, unsigned int is_busy), TP_ARGS(cpu, busy, old_is_busy, is_busy), TP_STRUCT__entry( __field(u32, cpu) __field(u32, busy) __field(u32, old_is_busy) __field(u32, is_busy) ), TP_fast_assign( __entry->cpu = cpu; __entry->busy = busy; __entry->old_is_busy = old_is_busy; __entry->is_busy = is_busy; ), TP_printk("cpu=%u, busy=%u, old_is_busy=%u, new_is_busy=%u", __entry->cpu, __entry->busy, __entry->old_is_busy, __entry->is_busy) ); #endif /* _TRACE_SCHED_H */ /* This part must be outside protection */ Loading
include/trace/events/sched.h +43 −0 Original line number Diff line number Diff line Loading @@ -1269,6 +1269,49 @@ TRACE_EVENT(sched_get_nr_running_avg, __entry->avg, __entry->big_avg, __entry->iowait_avg) ); TRACE_EVENT(core_ctl_eval_need, TP_PROTO(unsigned int cpu, unsigned int old_need, unsigned int new_need, unsigned int updated), TP_ARGS(cpu, old_need, new_need, updated), TP_STRUCT__entry( __field(u32, cpu) __field(u32, old_need) __field(u32, new_need) __field(u32, updated) ), TP_fast_assign( __entry->cpu = cpu; __entry->old_need = old_need; __entry->new_need = new_need; __entry->updated = updated; ), TP_printk("cpu=%u, old_need=%u, new_need=%u, updated=%u", __entry->cpu, __entry->old_need, __entry->new_need, __entry->updated) ); TRACE_EVENT(core_ctl_set_busy, TP_PROTO(unsigned int cpu, unsigned int busy, unsigned int old_is_busy, unsigned int is_busy), TP_ARGS(cpu, busy, old_is_busy, is_busy), TP_STRUCT__entry( __field(u32, cpu) __field(u32, busy) __field(u32, old_is_busy) __field(u32, is_busy) ), TP_fast_assign( __entry->cpu = cpu; __entry->busy = busy; __entry->old_is_busy = old_is_busy; __entry->is_busy = is_busy; ), TP_printk("cpu=%u, busy=%u, old_is_busy=%u, new_is_busy=%u", __entry->cpu, __entry->busy, __entry->old_is_busy, __entry->is_busy) ); #endif /* _TRACE_SCHED_H */ /* This part must be outside protection */ Loading
kernel/sched/core_ctl.c +40 −3 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ #include <linux/sched/rt.h> #include <linux/mutex.h> #include <trace/events/power.h> #include <trace/events/sched.h> #define MAX_CPUS_PER_GROUP 4 Loading Loading @@ -60,6 +60,7 @@ struct cpu_data { struct task_struct *hotplug_thread; struct kobject kobj; struct list_head pending_lru; bool disabled; }; static DEFINE_PER_CPU(struct cpu_data, cpu_state); Loading Loading @@ -294,6 +295,9 @@ static ssize_t show_global_state(struct cpu_data *state, char *buf) "\tAvail CPUs: %u\n", c->avail_cpus); count += snprintf(buf + count, PAGE_SIZE - count, "\tNeed CPUs: %u\n", c->need_cpus); count += snprintf(buf + count, PAGE_SIZE - count, "\tStatus: %s\n", c->disabled ? "disabled" : "enabled"); } return count; Loading Loading @@ -340,6 +344,33 @@ static ssize_t show_not_preferred(struct cpu_data *state, char *buf) return count; } static ssize_t store_disable(struct cpu_data *state, const char *buf, size_t count) { unsigned int val; if (sscanf(buf, "%u\n", &val) != 1) return -EINVAL; val = !!val; if (state->disabled == val) return count; state->disabled = val; if (!state->disabled) wake_up_hotplug_thread(state); return count; } static ssize_t show_disable(struct cpu_data *state, char *buf) { return snprintf(buf, PAGE_SIZE, "%u\n", state->disabled); } struct core_ctl_attr { struct attribute attr; ssize_t (*show)(struct cpu_data *, char *); Loading @@ -366,6 +397,7 @@ core_ctl_attr_ro(need_cpus); core_ctl_attr_ro(online_cpus); core_ctl_attr_ro(global_state); core_ctl_attr_rw(not_preferred); core_ctl_attr_rw(disable); static struct attribute *default_attrs[] = { &min_cpus.attr, Loading @@ -380,6 +412,7 @@ static struct attribute *default_attrs[] = { &online_cpus.attr, &global_state.attr, ¬_preferred.attr, &disable.attr, NULL }; Loading Loading @@ -624,6 +657,9 @@ static void wake_up_hotplug_thread(struct cpu_data *state) struct cpu_data *pcpu; bool no_wakeup = false; if (unlikely(state->disabled)) return; for_each_possible_cpu(cpu) { pcpu = &per_cpu(cpu_state, cpu); if (cpu != pcpu->first_cpu) Loading Loading @@ -652,7 +688,7 @@ static void core_ctl_timer_func(unsigned long cpu) struct cpu_data *state = &per_cpu(cpu_state, cpu); unsigned long flags; if (eval_need(state)) { if (eval_need(state) && !state->disabled) { spin_lock_irqsave(&state->pending_lock, flags); state->pending = true; spin_unlock_irqrestore(&state->pending_lock, flags); Loading Loading @@ -866,7 +902,8 @@ static int __ref cpu_callback(struct notifier_block *nfb, * so that there's no race with hotplug thread bringing up more * CPUs than necessary. */ if (apply_limits(f, f->need_cpus) <= f->online_cpus) { if (!f->disabled && apply_limits(f, f->need_cpus) <= f->online_cpus) { pr_debug("Prevent CPU%d onlining\n", cpu); ret = NOTIFY_BAD; } else { Loading
kernel/trace/power-traces.c +0 −2 Original line number Diff line number Diff line Loading @@ -14,5 +14,3 @@ #include <trace/events/power.h> EXPORT_TRACEPOINT_SYMBOL_GPL(cpu_idle); EXPORT_TRACEPOINT_SYMBOL(core_ctl_set_busy); EXPORT_TRACEPOINT_SYMBOL(core_ctl_eval_need);