Message ID | 20161111173410.GA15785@pathway.suse.cz (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
On Fri, 11 Nov 2016 18:34:10 +0100 Petr Mladek <pmladek@suse.com> wrote: > Please, let me known if I should do this as a separate patch > and/or resend the patchset. Rui/Eduardo, There are four independent posted changes made to powerclamp driver: Should I roll them into one set such that you can easily apply them? 1. add back module device table https://lkml.org/lkml/2016/11/14/760 2. kworker, this patchset 3. cpu hotplug state, this patch. 4. PF_IDLE https://lkml.org/lkml/2016/11/14/747 Thanks, Jacob -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, 2016-11-14 at 11:12 -0800, Jacob Pan wrote: > On Fri, 11 Nov 2016 18:34:10 +0100 > Petr Mladek <pmladek@suse.com> wrote: > > > > > Please, let me known if I should do this as a separate patch > > and/or resend the patchset. > Rui/Eduardo, > There are four independent posted changes made to powerclamp driver: > Should I roll them into one set such that you can easily apply them? > 1. add back module device table https://lkml.org/lkml/2016/11/14/760 > 2. kworker, this patchset > 3. cpu hotplug state, this patch. > 4. PF_IDLE https://lkml.org/lkml/2016/11/14/747 > hmm, I will apply patch 1 and queue up for next -rc and 4.8 stable. please resend the others that are targeted for 4.10 and later in one patch set. thanks, rui -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, 15 Nov 2016 19:36:26 +0800 Zhang Rui <rui.zhang@intel.com> wrote: > On Mon, 2016-11-14 at 11:12 -0800, Jacob Pan wrote: > > On Fri, 11 Nov 2016 18:34:10 +0100 > > Petr Mladek <pmladek@suse.com> wrote: > > > > > > > > Please, let me known if I should do this as a separate patch > > > and/or resend the patchset. > > Rui/Eduardo, > > There are four independent posted changes made to powerclamp driver: > > Should I roll them into one set such that you can easily apply them? > > 1. add back module device table https://lkml.org/lkml/2016/11/14/760 > > 2. kworker, this patchset > > 3. cpu hotplug state, this patch. > > 4. PF_IDLE https://lkml.org/lkml/2016/11/14/747 > > > hmm, I will apply patch 1 and queue up for next -rc and 4.8 stable. > > please resend the others that are targeted for 4.10 and later in one > patch set. OK, will do. I guess Petr and Sebastian are OK with me putting your powerclamp changes in one patchset too? -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue 2016-11-15 08:40:57, Jacob Pan wrote: > On Tue, 15 Nov 2016 19:36:26 +0800 > Zhang Rui <rui.zhang@intel.com> wrote: > > > On Mon, 2016-11-14 at 11:12 -0800, Jacob Pan wrote: > > > On Fri, 11 Nov 2016 18:34:10 +0100 > > > Petr Mladek <pmladek@suse.com> wrote: > > > > > > > > > > > Please, let me known if I should do this as a separate patch > > > > and/or resend the patchset. > > > Rui/Eduardo, > > > There are four independent posted changes made to powerclamp driver: > > > Should I roll them into one set such that you can easily apply them? > > > 1. add back module device table https://lkml.org/lkml/2016/11/14/760 > > > 2. kworker, this patchset > > > 3. cpu hotplug state, this patch. > > > 4. PF_IDLE https://lkml.org/lkml/2016/11/14/747 > > > > > hmm, I will apply patch 1 and queue up for next -rc and 4.8 stable. > > > > please resend the others that are targeted for 4.10 and later in one > > patch set. > OK, will do. I guess Petr and Sebastian are OK with me putting your > powerclamp changes in one patchset too? Sure. I am fine with it. Best Regards, Petr -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/thermal/intel_powerclamp.c b/drivers/thermal/intel_powerclamp.c index 2b99c0627043..d9b9e0fb4e48 100644 --- a/drivers/thermal/intel_powerclamp.c +++ b/drivers/thermal/intel_powerclamp.c @@ -43,7 +43,6 @@ #include <linux/kernel.h> #include <linux/delay.h> #include <linux/kthread.h> -#include <linux/freezer.h> #include <linux/cpu.h> #include <linux/thermal.h> #include <linux/slab.h> @@ -530,8 +529,7 @@ static void start_power_clamp_worker(unsigned long cpu) struct powerclamp_worker_data *w_data = per_cpu_ptr(worker_data, cpu); struct kthread_worker *worker; - worker = kthread_create_worker_on_cpu(cpu, KTW_FREEZABLE, - "kidle_inject/%ld", cpu); + worker = kthread_create_worker_on_cpu(cpu, 0, "kidle_inject/%ld", cpu); if (IS_ERR(worker)) return; @@ -622,43 +620,35 @@ static void end_power_clamp(void) } } -static int powerclamp_cpu_callback(struct notifier_block *nfb, - unsigned long action, void *hcpu) +static int powerclamp_cpu_online(unsigned int cpu) { - unsigned long cpu = (unsigned long)hcpu; + if (clamping == false) + return 0; + start_power_clamp_worker(cpu); + /* prefer BSP as controlling CPU */ + if (cpu == 0) { + control_cpu = 0; + smp_mb(); + } + return 0; +} - if (false == clamping) - goto exit_ok; +static int powerclamp_cpu_predown(unsigned int cpu) +{ + if (clamping == false) + return 0; - switch (action) { - case CPU_ONLINE: - start_power_clamp_worker(cpu); - /* prefer BSP as controlling CPU */ - if (cpu == 0) { - control_cpu = 0; - smp_mb(); - } - break; - case CPU_DEAD: - if (test_bit(cpu, cpu_clamping_mask)) { - pr_err("cpu %lu dead but powerclamping thread is not\n", - cpu); - stop_power_clamp_worker(cpu); - } - if (cpu == control_cpu) { - control_cpu = smp_processor_id(); - smp_mb(); - } - } + stop_power_clamp_worker(cpu); + if (cpu != control_cpu) + return 0; -exit_ok: - return NOTIFY_OK; + control_cpu = cpumask_first(cpu_online_mask); + if (control_cpu == cpu) + control_cpu = cpumask_next(cpu, cpu_online_mask); + smp_mb(); + return 0; } -static struct notifier_block powerclamp_cpu_notifier = { - .notifier_call = powerclamp_cpu_callback, -}; - static int powerclamp_get_max_state(struct thermal_cooling_device *cdev, unsigned long *state) { @@ -778,6 +768,8 @@ static inline void powerclamp_create_debug_files(void) debugfs_remove_recursive(debug_dir); } +static enum cpuhp_state hp_state; + static int __init powerclamp_init(void) { int retval; @@ -795,7 +787,14 @@ static int __init powerclamp_init(void) /* set default limit, maybe adjusted during runtime based on feedback */ window_size = 2; - register_hotcpu_notifier(&powerclamp_cpu_notifier); + retval = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, + "thermal/intel_powerclamp:online", + powerclamp_cpu_online, + powerclamp_cpu_predown); + if (retval < 0) + goto exit_free; + + hp_state = retval; worker_data = alloc_percpu(struct powerclamp_worker_data); if (!worker_data) { @@ -820,7 +819,7 @@ static int __init powerclamp_init(void) exit_free_thread: free_percpu(worker_data); exit_unregister: - unregister_hotcpu_notifier(&powerclamp_cpu_notifier); + cpuhp_remove_state_nocalls(hp_state); exit_free: kfree(cpu_clamping_mask); return retval; @@ -829,8 +828,8 @@ static int __init powerclamp_init(void) static void __exit powerclamp_exit(void) { - unregister_hotcpu_notifier(&powerclamp_cpu_notifier); end_power_clamp(); + cpuhp_remove_state_nocalls(hp_state); free_percpu(worker_data); thermal_cooling_device_unregister(cooling_dev); kfree(cpu_clamping_mask);