All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] trace_device_pm_callback coverage in dpm_prepare/dpm_complete
@ 2015-05-28 19:55 Todd Brandt
  2015-06-15 23:38 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Todd Brandt @ 2015-05-28 19:55 UTC (permalink / raw)
  To: linux-pm, rjw, rafael.j.wysocki; +Cc: todd.e.brandt, todd.e.brandt

Moved the trace_device_pm_callback locations for dpm_prepare and dpm_complete
to encompass the attempt to capture the device mutex prior to callback. This
is needed by analyze_suspend to identify gaps in the trace output caused by
the delay in locking the mutex for a device.

Signed-off-by: Todd Brandt <todd.e.brandt@linux.intel.com>
---
 drivers/base/power/main.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 3d874ec..5528e59 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -920,9 +920,7 @@ static void device_complete(struct device *dev, pm_message_t state)
 
 	if (callback) {
 		pm_dev_dbg(dev, state, info);
-		trace_device_pm_callback_start(dev, info, state.event);
 		callback(dev);
-		trace_device_pm_callback_end(dev, 0);
 	}
 
 	device_unlock(dev);
@@ -954,7 +952,9 @@ void dpm_complete(pm_message_t state)
 		list_move(&dev->power.entry, &list);
 		mutex_unlock(&dpm_list_mtx);
 
+		trace_device_pm_callback_start(dev, "", state.event);
 		device_complete(dev, state);
+		trace_device_pm_callback_end(dev, 0);
 
 		mutex_lock(&dpm_list_mtx);
 		put_device(dev);
@@ -1585,11 +1585,8 @@ static int device_prepare(struct device *dev, pm_message_t state)
 		callback = dev->driver->pm->prepare;
 	}
 
-	if (callback) {
-		trace_device_pm_callback_start(dev, info, state.event);
+	if (callback)
 		ret = callback(dev);
-		trace_device_pm_callback_end(dev, ret);
-	}
 
 	device_unlock(dev);
 
@@ -1631,7 +1628,9 @@ int dpm_prepare(pm_message_t state)
 		get_device(dev);
 		mutex_unlock(&dpm_list_mtx);
 
+		trace_device_pm_callback_start(dev, "", state.event);
 		error = device_prepare(dev, state);
+		trace_device_pm_callback_end(dev, error);
 
 		mutex_lock(&dpm_list_mtx);
 		if (error) {
-- 
2.1.0


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

* Re: [PATCH] trace_device_pm_callback coverage in dpm_prepare/dpm_complete
  2015-05-28 19:55 [PATCH] trace_device_pm_callback coverage in dpm_prepare/dpm_complete Todd Brandt
@ 2015-06-15 23:38 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2015-06-15 23:38 UTC (permalink / raw)
  To: Todd Brandt; +Cc: linux-pm, rafael.j.wysocki, todd.e.brandt

On Thursday, May 28, 2015 12:55:53 PM Todd Brandt wrote:
> Moved the trace_device_pm_callback locations for dpm_prepare and dpm_complete
> to encompass the attempt to capture the device mutex prior to callback. This
> is needed by analyze_suspend to identify gaps in the trace output caused by
> the delay in locking the mutex for a device.
> 
> Signed-off-by: Todd Brandt <todd.e.brandt@linux.intel.com>

Queued up for 4.2, thanks!


> ---
>  drivers/base/power/main.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
> index 3d874ec..5528e59 100644
> --- a/drivers/base/power/main.c
> +++ b/drivers/base/power/main.c
> @@ -920,9 +920,7 @@ static void device_complete(struct device *dev, pm_message_t state)
>  
>  	if (callback) {
>  		pm_dev_dbg(dev, state, info);
> -		trace_device_pm_callback_start(dev, info, state.event);
>  		callback(dev);
> -		trace_device_pm_callback_end(dev, 0);
>  	}
>  
>  	device_unlock(dev);
> @@ -954,7 +952,9 @@ void dpm_complete(pm_message_t state)
>  		list_move(&dev->power.entry, &list);
>  		mutex_unlock(&dpm_list_mtx);
>  
> +		trace_device_pm_callback_start(dev, "", state.event);
>  		device_complete(dev, state);
> +		trace_device_pm_callback_end(dev, 0);
>  
>  		mutex_lock(&dpm_list_mtx);
>  		put_device(dev);
> @@ -1585,11 +1585,8 @@ static int device_prepare(struct device *dev, pm_message_t state)
>  		callback = dev->driver->pm->prepare;
>  	}
>  
> -	if (callback) {
> -		trace_device_pm_callback_start(dev, info, state.event);
> +	if (callback)
>  		ret = callback(dev);
> -		trace_device_pm_callback_end(dev, ret);
> -	}
>  
>  	device_unlock(dev);
>  
> @@ -1631,7 +1628,9 @@ int dpm_prepare(pm_message_t state)
>  		get_device(dev);
>  		mutex_unlock(&dpm_list_mtx);
>  
> +		trace_device_pm_callback_start(dev, "", state.event);
>  		error = device_prepare(dev, state);
> +		trace_device_pm_callback_end(dev, error);
>  
>  		mutex_lock(&dpm_list_mtx);
>  		if (error) {
> 

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

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

end of thread, other threads:[~2015-06-15 23:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-28 19:55 [PATCH] trace_device_pm_callback coverage in dpm_prepare/dpm_complete Todd Brandt
2015-06-15 23:38 ` Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.