linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
To: todd.e.brandt@linux.intel.com
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Steven Rostedt <rostedt@goodmis.org>,
	linux-pm@vger.kernel.org, rafael.j.wysocki@intel.com
Subject: Re: [PATCH] PM: trace events for suspend/resume
Date: Fri, 23 May 2014 12:07:58 +0530	[thread overview]
Message-ID: <537EECC6.3070109@linux.vnet.ibm.com> (raw)
In-Reply-To: <20140522235031.GA21923@linux.intel.com>

On 05/23/2014 05:20 AM, Todd E Brandt wrote:
> On Fri, May 23, 2014 at 03:46:54AM +0530, Srivatsa S. Bhat wrote:
>> On 05/22/2014 05:31 AM, Rafael J. Wysocki wrote:
>>> On Monday, May 19, 2014 04:02:26 PM Todd E Brandt wrote:
>>>> Adds trace events that give finer resolution into suspend/resume. These
>>>> events are graphed in the timelines generated by the analyze_suspend.py
>>>> script. They represent large areas of time consumed that are typical in
>>>> suspend and resume.
>>>>
>>>> The event is triggered by calling the function "trace_suspend_resume"
>>>> with two arguments: a string (the name of the event to be displayed
>>>> in the timeline), and a boolean (where true is used to denote the start
>>>> of the timeline event, and false to denote the end).
>>>>
>>>> Signed-off-by: Todd Brandt <todd.e.brandt@intel.com>
>>>> ---
>>>>  drivers/acpi/nvs.c           |  6 ++++++
>>>>  drivers/acpi/osl.c           |  3 +++
>>>>  drivers/base/syscore.c       |  5 +++++
>>>>  include/trace/events/power.h | 19 +++++++++++++++++++
>>>>  kernel/cpu.c                 |  9 +++++++++
>>>>  kernel/power/process.c       |  3 +++
>>>>  kernel/power/suspend.c       |  4 ++++
>>>>  7 files changed, 49 insertions(+)
>>>>
>>>> For more info see:
>>>> https://01.org/suspendresume/blogs/tebrandt/2014/custom-timeline-event-support-0
>>>>
>>>> I'm also interested to know if any tools depend on the machine_suspend
>>>> tracepoints, as this patch expands on the same info. I'd be willing to
>>>> merge the existing machine_suspend calls into this patch and rename
>>>> everything to suspend_resume provided it doesn't hurt any downstream tools.
>>>>
>>>> diff --git a/drivers/acpi/nvs.c b/drivers/acpi/nvs.c
>>>> index de4fe03..b52b686 100644
>>>> --- a/drivers/acpi/nvs.c
>>>> +++ b/drivers/acpi/nvs.c
>>>> @@ -12,6 +12,7 @@
>>>>  #include <linux/mm.h>
>>>>  #include <linux/slab.h>
>>>>  #include <linux/acpi.h>
>>>> +#include <trace/events/power.h>
>>>>  
>>>>  #include "internal.h"
>>>>  
>>>> @@ -171,6 +172,7 @@ int suspend_nvs_save(void)
>>>>  {
>>>>  	struct nvs_page *entry;
>>>>  
>>>> +	trace_suspend_resume("save_nvs_memory", true);
>>>>  	printk(KERN_INFO "PM: Saving platform NVS memory\n");
>>>>  
>>>>  	list_for_each_entry(entry, &nvs_list, node)
>>>> @@ -185,11 +187,13 @@ int suspend_nvs_save(void)
>>>>  			}
>>>>  			if (!entry->kaddr) {
>>>>  				suspend_nvs_free();
>>>> +				trace_suspend_resume("save_nvs_memory", false);
>>>>  				return -ENOMEM;
>>>>  			}
>>>>  			memcpy(entry->data, entry->kaddr, entry->size);
>>>>  		}
>>>>  
>>>> +	trace_suspend_resume("save_nvs_memory", false);
>>>>  	return 0;
>>>>  }
>>>>  
>>>> @@ -203,10 +207,12 @@ void suspend_nvs_restore(void)
>>>>  {
>>>>  	struct nvs_page *entry;
>>>>  
>>>> +	trace_suspend_resume("restore_nvs_memory", true);
>>>>  	printk(KERN_INFO "PM: Restoring platform NVS memory\n");
>>>>  
>>>>  	list_for_each_entry(entry, &nvs_list, node)
>>>>  		if (entry->data)
>>>>  			memcpy(entry->kaddr, entry->data, entry->size);
>>>> +	trace_suspend_resume("restore_nvs_memory", false);
>>>>  }
>>>>  #endif
>>>> diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
>>>> index 6776c59..b65a77a 100644
>>>> --- a/drivers/acpi/osl.c
>>>> +++ b/drivers/acpi/osl.c
>>>> @@ -44,6 +44,7 @@
>>>>  #include <linux/list.h>
>>>>  #include <linux/jiffies.h>
>>>>  #include <linux/semaphore.h>
>>>> +#include <trace/events/power.h>
>>>>  
>>>>  #include <asm/io.h>
>>>>  #include <asm/uaccess.h>
>>>> @@ -835,7 +836,9 @@ acpi_status acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler)
>>>>  
>>>>  void acpi_os_sleep(u64 ms)
>>>>  {
>>>> +	trace_suspend_resume("acpi_os_sleep", true);
>>>>  	msleep(ms);
>>>> +	trace_suspend_resume("acpi_os_sleep", false);
>>>>  }
>>>
>>> This function doesn't have anything to do with system suspend/resume.
>>> It is for waiting. :-)
>>>
>>> The rest of the patch looks OK to me.
>>>
>>> Steven, what about the tracing angle?
>>>
>>
>> Hi Todd,
>>
>> This might be a silly question, but the suspend_enter() function invokes
>> ftrace_stop() before suspending the machine, and restarts ftrace after
>> resume. And your patch seems to instrument code further down (deeper)
>> in the suspend/resume path (such as disable_nonboot_cpus() for example).
>> Doesn't the ftrace stop/start pose any problem for this patch?
> 
> I put a patch in the kernel a few months back that allowed ftrace to
> function all the way through to disable/enable_nonboot_cpus. So the
> actual trace code includes everything up to the actual CPU suspend/resume.
> And also (as Steven mentioned), the tracepoint activity isn't controlled
> via ftrace_start/ftrace_stop, those are for tracer based logging.
> 

Cool, thanks!

Regards,
Srivatsa S. Bhat


      reply	other threads:[~2014-05-23  6:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-19 23:02 [PATCH] PM: trace events for suspend/resume Todd E Brandt
2014-05-22  0:01 ` Rafael J. Wysocki
2014-05-22 17:07   ` Todd E Brandt
2014-05-22 22:41     ` Steven Rostedt
2014-05-22 23:06       ` Rafael J. Wysocki
2014-05-30 14:49         ` Todd E Brandt
2014-05-22 22:16   ` Srivatsa S. Bhat
2014-05-22 22:44     ` Steven Rostedt
2014-05-23  6:36       ` Srivatsa S. Bhat
2014-05-22 23:50     ` Todd E Brandt
2014-05-23  6:37       ` Srivatsa S. Bhat [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=537EECC6.3070109@linux.vnet.ibm.com \
    --to=srivatsa.bhat@linux.vnet.ibm.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rjw@rjwysocki.net \
    --cc=rostedt@goodmis.org \
    --cc=todd.e.brandt@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).