diff mbox

[4/4] thermal/intel_powerclamp: stop sched tick in forced idle

Message ID 1480369492-23901-5-git-send-email-jacob.jun.pan@linux.intel.com (mailing list archive)
State Accepted, archived
Delegated to: Rafael Wysocki
Headers show

Commit Message

Jacob Pan Nov. 28, 2016, 9:44 p.m. UTC
With the introduction of play_idle(), idle injection kthread can
go through the normal idle task processing to get correct accounting
and turn off scheduler tick when possible.

Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
---
 drivers/thermal/intel_powerclamp.c | 35 +----------------------------------
 1 file changed, 1 insertion(+), 34 deletions(-)

Comments

kernel test robot Nov. 28, 2016, 11:21 p.m. UTC | #1
Hi Jacob,

[auto build test ERROR on soc-thermal/next]
[also build test ERROR on v4.9-rc7 next-20161128]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Jacob-Pan/Misc-enhancements-to-intel_powerclamp/20161129-065523
base:   https://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal.git next
config: x86_64-randconfig-x015-201648 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/thermal/intel_powerclamp.c: In function 'clamp_idle_injection_func':
>> drivers/thermal/intel_powerclamp.c:448:2: error: implicit declaration of function 'play_idle' [-Werror=implicit-function-declaration]
     play_idle(jiffies_to_msecs(w_data->duration_jiffies));
     ^~~~~~~~~
   cc1: some warnings being treated as errors

vim +/play_idle +448 drivers/thermal/intel_powerclamp.c

   442			smp_mb();
   443		}
   444	
   445		if (should_skip)
   446			goto balance;
   447	
 > 448		play_idle(jiffies_to_msecs(w_data->duration_jiffies));
   449	
   450	balance:
   451		if (clamping && w_data->clamping && cpu_online(w_data->cpu))

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Jacob Pan Nov. 29, 2016, 7:11 a.m. UTC | #2
On Tue, 29 Nov 2016 07:21:14 +0800
kbuild test robot <lkp@intel.com> wrote:

> Hi Jacob,
> 
> [auto build test ERROR on soc-thermal/next]
> [also build test ERROR on v4.9-rc7 next-20161128]
> [if your patch is applied to the wrong git tree, please drop us a
> note to help improve the system]
> 
This patchset is applicable on top of another patch indicated in the
cover letter.
(https://lkml.org/lkml/2016/11/28/683)

Thanks,

Jacob

> url:
> https://github.com/0day-ci/linux/commits/Jacob-Pan/Misc-enhancements-to-intel_powerclamp/20161129-065523
> base:
> https://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal.git
> next config: x86_64-randconfig-x015-201648 (attached as .config)
> compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the
> attached .config to linux build tree make ARCH=x86_64 
> 
> All errors (new ones prefixed by >>):
> 
>    drivers/thermal/intel_powerclamp.c: In function
> 'clamp_idle_injection_func':
> >> drivers/thermal/intel_powerclamp.c:448:2: error: implicit
> >> declaration of function
> >> 'play_idle' [-Werror=implicit-function-declaration]
>      play_idle(jiffies_to_msecs(w_data->duration_jiffies));
>      ^~~~~~~~~
>    cc1: some warnings being treated as errors
> 
> vim +/play_idle +448 drivers/thermal/intel_powerclamp.c
> 
>    442			smp_mb();
>    443		}
>    444	
>    445		if (should_skip)
>    446			goto balance;
>    447	
>  > 448
>  > play_idle(jiffies_to_msecs(w_data->duration_jiffies));
>    449	
>    450	balance:
>    451		if (clamping && w_data->clamping &&
> cpu_online(w_data->cpu))
> 
> ---
> 0-DAY kernel test infrastructure                Open Source
> Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel
> Corporation

[Jacob Pan]
--
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
Ye Xiaolong Nov. 29, 2016, 9:50 p.m. UTC | #3
On 11/28, Jacob Pan wrote:
>On Tue, 29 Nov 2016 07:21:14 +0800
>kbuild test robot <lkp@intel.com> wrote:
>
>> Hi Jacob,
>> 
>> [auto build test ERROR on soc-thermal/next]
>> [also build test ERROR on v4.9-rc7 next-20161128]
>> [if your patch is applied to the wrong git tree, please drop us a
>> note to help improve the system]
>> 
>This patchset is applicable on top of another patch indicated in the
>cover letter.
>(https://lkml.org/lkml/2016/11/28/683)
>

Thanks for the info, you could try use git(>=2.9.0) format-patch --base=<commit> (or
--base=auto for convenience) to record what (public, well-known) commit
your patch series was built on, then 0day would be able to know the
exact base and prerequisite patches.

Thanks,
Xiaolong

>Thanks,
>
>Jacob
>
>> url:
>> https://github.com/0day-ci/linux/commits/Jacob-Pan/Misc-enhancements-to-intel_powerclamp/20161129-065523
>> base:
>> https://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal.git
>> next config: x86_64-randconfig-x015-201648 (attached as .config)
>> compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the
>> attached .config to linux build tree make ARCH=x86_64 
>> 
>> All errors (new ones prefixed by >>):
>> 
>>    drivers/thermal/intel_powerclamp.c: In function
>> 'clamp_idle_injection_func':
>> >> drivers/thermal/intel_powerclamp.c:448:2: error: implicit
>> >> declaration of function
>> >> 'play_idle' [-Werror=implicit-function-declaration]
>>      play_idle(jiffies_to_msecs(w_data->duration_jiffies));
>>      ^~~~~~~~~
>>    cc1: some warnings being treated as errors
>> 
>> vim +/play_idle +448 drivers/thermal/intel_powerclamp.c
>> 
>>    442			smp_mb();
>>    443		}
>>    444	
>>    445		if (should_skip)
>>    446			goto balance;
>>    447	
>>  > 448
>>  > play_idle(jiffies_to_msecs(w_data->duration_jiffies));
>>    449	
>>    450	balance:
>>    451		if (clamping && w_data->clamping &&
>> cpu_online(w_data->cpu))
>> 
>> ---
>> 0-DAY kernel test infrastructure                Open Source
>> Technology Center
>> https://lists.01.org/pipermail/kbuild-all                   Intel
>> Corporation
>
>[Jacob Pan]
>_______________________________________________
>kbuild-all mailing list
>kbuild-all@lists.01.org
>https://lists.01.org/mailman/listinfo/kbuild-all
--
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 mbox

Patch

diff --git a/drivers/thermal/intel_powerclamp.c b/drivers/thermal/intel_powerclamp.c
index 1310283..83e6971 100644
--- a/drivers/thermal/intel_powerclamp.c
+++ b/drivers/thermal/intel_powerclamp.c
@@ -92,7 +92,6 @@  struct powerclamp_worker_data {
 	struct kthread_worker *worker;
 	struct kthread_work balancing_work;
 	struct kthread_delayed_work idle_injection_work;
-	struct timer_list wakeup_timer;
 	unsigned int cpu;
 	unsigned int count;
 	unsigned int guard;
@@ -277,11 +276,6 @@  static u64 pkg_state_counter(void)
 	return count;
 }
 
-static void noop_timer(unsigned long foo)
-{
-	/* empty... just the fact that we get the interrupt wakes us up */
-}
-
 static unsigned int get_compensation(int ratio)
 {
 	unsigned int comp = 0;
@@ -431,7 +425,6 @@  static void clamp_balancing_func(struct kthread_work *work)
 static void clamp_idle_injection_func(struct kthread_work *work)
 {
 	struct powerclamp_worker_data *w_data;
-	unsigned long target_jiffies;
 
 	w_data = container_of(work, struct powerclamp_worker_data,
 			      idle_injection_work.work);
@@ -452,31 +445,7 @@  static void clamp_idle_injection_func(struct kthread_work *work)
 	if (should_skip)
 		goto balance;
 
-	target_jiffies = jiffies + w_data->duration_jiffies;
-	mod_timer(&w_data->wakeup_timer, target_jiffies);
-	if (unlikely(local_softirq_pending()))
-		goto balance;
-	/*
-	 * stop tick sched during idle time, interrupts are still
-	 * allowed. thus jiffies are updated properly.
-	 */
-	preempt_disable();
-	/* mwait until target jiffies is reached */
-	while (time_before(jiffies, target_jiffies)) {
-		unsigned long ecx = 1;
-		unsigned long eax = target_mwait;
-
-		/*
-		 * REVISIT: may call enter_idle() to notify drivers who
-		 * can save power during cpu idle. same for exit_idle()
-		 */
-		local_touch_nmi();
-		stop_critical_timings();
-		mwait_idle_with_hints(eax, ecx);
-		start_critical_timings();
-		atomic_inc(&idle_wakeup_counter);
-	}
-	preempt_enable();
+	play_idle(jiffies_to_msecs(w_data->duration_jiffies));
 
 balance:
 	if (clamping && w_data->clamping && cpu_online(w_data->cpu))
@@ -538,7 +507,6 @@  static void start_power_clamp_worker(unsigned long cpu)
 	w_data->cpu = cpu;
 	w_data->clamping = true;
 	set_bit(cpu, cpu_clamping_mask);
-	setup_timer(&w_data->wakeup_timer, noop_timer, 0);
 	sched_setscheduler(worker->task, SCHED_FIFO, &sparam);
 	kthread_init_work(&w_data->balancing_work, clamp_balancing_func);
 	kthread_init_delayed_work(&w_data->idle_injection_work,
@@ -570,7 +538,6 @@  static void stop_power_clamp_worker(unsigned long cpu)
 	 * a big deal. The balancing work is fast and destroy kthread
 	 * will wait for it.
 	 */
-	del_timer_sync(&w_data->wakeup_timer);
 	clear_bit(w_data->cpu, cpu_clamping_mask);
 	kthread_destroy_worker(w_data->worker);