linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PM / tick: Add tracepoints for suspend-to-idle diagnostics
@ 2015-05-09 23:09 Rafael J. Wysocki
  2015-05-09 23:23 ` [Resend][PATCH] " Rafael J. Wysocki
  0 siblings, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki @ 2015-05-09 23:09 UTC (permalink / raw)
  To: Peter Zijlstra, Thomas Gleixner; +Cc: Linux Kernel Mailing List, Linux PM list

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Add suspend/resume tracepoints to tick_freeze() and tick_unfreeze()
to catch when timekeeping is suspended and resumed during suspend-to-idle
so as to be able to check whether or not we enter the "frozen" state
and to measure the time spent in it.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 kernel/time/tick-common.c |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

Index: linux-pm/kernel/time/tick-common.c
===================================================================
--- linux-pm.orig/kernel/time/tick-common.c
+++ linux-pm/kernel/time/tick-common.c
@@ -19,6 +19,7 @@
 #include <linux/profile.h>
 #include <linux/sched.h>
 #include <linux/module.h>
+#include <trace/events/power.h>
 
 #include <asm/irq_regs.h>
 
@@ -457,10 +458,13 @@ void tick_freeze(void)
 	raw_spin_lock(&tick_freeze_lock);
 
 	tick_freeze_depth++;
-	if (tick_freeze_depth == num_online_cpus())
+	if (tick_freeze_depth == num_online_cpus()) {
+		trace_suspend_resume(TPS("timekeeping_freeze"),
+				     smp_processor_id(), true);
 		timekeeping_suspend();
-	else
+	} else {
 		tick_suspend_local();
+	}
 
 	raw_spin_unlock(&tick_freeze_lock);
 }
@@ -478,10 +482,13 @@ void tick_unfreeze(void)
 {
 	raw_spin_lock(&tick_freeze_lock);
 
-	if (tick_freeze_depth == num_online_cpus())
+	if (tick_freeze_depth == num_online_cpus()) {
 		timekeeping_resume();
-	else
+		trace_suspend_resume(TPS("timekeeping_freeze"),
+				     smp_processor_id(), false);
+	} else {
 		tick_resume_local();
+	}
 
 	tick_freeze_depth--;
 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Resend][PATCH] PM / tick: Add tracepoints for suspend-to-idle diagnostics
  2015-05-09 23:09 [PATCH] PM / tick: Add tracepoints for suspend-to-idle diagnostics Rafael J. Wysocki
@ 2015-05-09 23:23 ` Rafael J. Wysocki
  2015-05-14 22:04   ` Rafael J. Wysocki
  0 siblings, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki @ 2015-05-09 23:23 UTC (permalink / raw)
  To: Peter Zijlstra, Thomas Gleixner; +Cc: Linux Kernel Mailing List, Linux PM list

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Add suspend/resume tracepoints to tick_freeze() and tick_unfreeze()
to catch when timekeeping is suspended and resumed during suspend-to-idle
so as to be able to check whether or not we enter the "frozen" state
and to measure the time spent in it.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---

Sorry for the duplication, but I messed up the Thomas' address in the previous one.

---
 kernel/time/tick-common.c |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

Index: linux-pm/kernel/time/tick-common.c
===================================================================
--- linux-pm.orig/kernel/time/tick-common.c
+++ linux-pm/kernel/time/tick-common.c
@@ -19,6 +19,7 @@
 #include <linux/profile.h>
 #include <linux/sched.h>
 #include <linux/module.h>
+#include <trace/events/power.h>
 
 #include <asm/irq_regs.h>
 
@@ -457,10 +458,13 @@ void tick_freeze(void)
 	raw_spin_lock(&tick_freeze_lock);
 
 	tick_freeze_depth++;
-	if (tick_freeze_depth == num_online_cpus())
+	if (tick_freeze_depth == num_online_cpus()) {
+		trace_suspend_resume(TPS("timekeeping_freeze"),
+				     smp_processor_id(), true);
 		timekeeping_suspend();
-	else
+	} else {
 		tick_suspend_local();
+	}
 
 	raw_spin_unlock(&tick_freeze_lock);
 }
@@ -478,10 +482,13 @@ void tick_unfreeze(void)
 {
 	raw_spin_lock(&tick_freeze_lock);
 
-	if (tick_freeze_depth == num_online_cpus())
+	if (tick_freeze_depth == num_online_cpus()) {
 		timekeeping_resume();
-	else
+		trace_suspend_resume(TPS("timekeeping_freeze"),
+				     smp_processor_id(), false);
+	} else {
 		tick_resume_local();
+	}
 
 	tick_freeze_depth--;
 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Resend][PATCH] PM / tick: Add tracepoints for suspend-to-idle diagnostics
  2015-05-14 22:04   ` Rafael J. Wysocki
@ 2015-05-14 21:43     ` Thomas Gleixner
  2015-05-14 23:42       ` Rafael J. Wysocki
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Gleixner @ 2015-05-14 21:43 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Peter Zijlstra, Linux Kernel Mailing List, Linux PM list

On Fri, 15 May 2015, Rafael J. Wysocki wrote:

> On Sunday, May 10, 2015 01:23:35 AM Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > 
> > Add suspend/resume tracepoints to tick_freeze() and tick_unfreeze()
> > to catch when timekeeping is suspended and resumed during suspend-to-idle
> > so as to be able to check whether or not we enter the "frozen" state
> > and to measure the time spent in it.
> > 
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Thomas, Peter, any objections here?

No.

Acked-by: Thomas Gleixner <tglx@linutronix.de>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Resend][PATCH] PM / tick: Add tracepoints for suspend-to-idle diagnostics
  2015-05-09 23:23 ` [Resend][PATCH] " Rafael J. Wysocki
@ 2015-05-14 22:04   ` Rafael J. Wysocki
  2015-05-14 21:43     ` Thomas Gleixner
  0 siblings, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki @ 2015-05-14 22:04 UTC (permalink / raw)
  To: Peter Zijlstra, Thomas Gleixner; +Cc: Linux Kernel Mailing List, Linux PM list

On Sunday, May 10, 2015 01:23:35 AM Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Add suspend/resume tracepoints to tick_freeze() and tick_unfreeze()
> to catch when timekeeping is suspended and resumed during suspend-to-idle
> so as to be able to check whether or not we enter the "frozen" state
> and to measure the time spent in it.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Thomas, Peter, any objections here?

> ---
> 
> Sorry for the duplication, but I messed up the Thomas' address in the previous one.
> 
> ---
>  kernel/time/tick-common.c |   15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> Index: linux-pm/kernel/time/tick-common.c
> ===================================================================
> --- linux-pm.orig/kernel/time/tick-common.c
> +++ linux-pm/kernel/time/tick-common.c
> @@ -19,6 +19,7 @@
>  #include <linux/profile.h>
>  #include <linux/sched.h>
>  #include <linux/module.h>
> +#include <trace/events/power.h>
>  
>  #include <asm/irq_regs.h>
>  
> @@ -457,10 +458,13 @@ void tick_freeze(void)
>  	raw_spin_lock(&tick_freeze_lock);
>  
>  	tick_freeze_depth++;
> -	if (tick_freeze_depth == num_online_cpus())
> +	if (tick_freeze_depth == num_online_cpus()) {
> +		trace_suspend_resume(TPS("timekeeping_freeze"),
> +				     smp_processor_id(), true);
>  		timekeeping_suspend();
> -	else
> +	} else {
>  		tick_suspend_local();
> +	}
>  
>  	raw_spin_unlock(&tick_freeze_lock);
>  }
> @@ -478,10 +482,13 @@ void tick_unfreeze(void)
>  {
>  	raw_spin_lock(&tick_freeze_lock);
>  
> -	if (tick_freeze_depth == num_online_cpus())
> +	if (tick_freeze_depth == num_online_cpus()) {
>  		timekeeping_resume();
> -	else
> +		trace_suspend_resume(TPS("timekeeping_freeze"),
> +				     smp_processor_id(), false);
> +	} else {
>  		tick_resume_local();
> +	}
>  
>  	tick_freeze_depth--;
>  
> 
> --
> 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

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Resend][PATCH] PM / tick: Add tracepoints for suspend-to-idle diagnostics
  2015-05-14 21:43     ` Thomas Gleixner
@ 2015-05-14 23:42       ` Rafael J. Wysocki
  0 siblings, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2015-05-14 23:42 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: Peter Zijlstra, Linux Kernel Mailing List, Linux PM list

On Thursday, May 14, 2015 11:43:11 PM Thomas Gleixner wrote:
> On Fri, 15 May 2015, Rafael J. Wysocki wrote:
> 
> > On Sunday, May 10, 2015 01:23:35 AM Rafael J. Wysocki wrote:
> > > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > > 
> > > Add suspend/resume tracepoints to tick_freeze() and tick_unfreeze()
> > > to catch when timekeeping is suspended and resumed during suspend-to-idle
> > > so as to be able to check whether or not we enter the "frozen" state
> > > and to measure the time spent in it.
> > > 
> > > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > 
> > Thomas, Peter, any objections here?
> 
> No.
> 
> Acked-by: Thomas Gleixner <tglx@linutronix.de>

Thanks!


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-05-14 23:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-09 23:09 [PATCH] PM / tick: Add tracepoints for suspend-to-idle diagnostics Rafael J. Wysocki
2015-05-09 23:23 ` [Resend][PATCH] " Rafael J. Wysocki
2015-05-14 22:04   ` Rafael J. Wysocki
2015-05-14 21:43     ` Thomas Gleixner
2015-05-14 23:42       ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).