public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] complain when users abuse the pm_qos API
@ 2010-05-29  4:50 mark gross
  2010-05-29 20:08 ` Rafael J. Wysocki
  0 siblings, 1 reply; 8+ messages in thread
From: mark gross @ 2010-05-29  4:50 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: linux-pm, linux-kernel

The following patch is to help clean up API abusers of pm_qos where
they call update_request before registering a request.

--mgross

--Signed-off-by: markgross <markgross@thegnar.org>


>From a0813007ddc7b72cb3da7a533fefba9889aab1d8 Mon Sep 17 00:00:00 2001
From: mgross <mgross@mgross-desktop.(none)>
Date: Fri, 28 May 2010 21:36:06 -0700
Subject: [PATCH] complain when users abuse the pm_qos API by updating a request that
 isn't registered yet.

---
 kernel/pm_qos_params.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/kernel/pm_qos_params.c b/kernel/pm_qos_params.c
index f42d3f7..8e55bf1 100644
--- a/kernel/pm_qos_params.c
+++ b/kernel/pm_qos_params.c
@@ -266,6 +266,10 @@ void pm_qos_update_request(struct pm_qos_request_list *pm_qos_req,
 		spin_unlock_irqrestore(&pm_qos_lock, flags);
 		if (pending_update)
 			update_target(pm_qos_req->pm_qos_class);
+	} else {
+		WARN(true, "pm_qos: updating an unregistered request "
+				"does nothing");
+		dump_stack();
 	}
 }
 EXPORT_SYMBOL_GPL(pm_qos_update_request);
-- 
1.7.0.4


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

* Re: [patch] complain when users abuse the pm_qos API
  2010-05-29  4:50 [patch] complain when users abuse the pm_qos API mark gross
@ 2010-05-29 20:08 ` Rafael J. Wysocki
  2010-05-29 23:03   ` [linux-pm] " Nigel Cunningham
  2010-05-30 20:08   ` mark gross
  0 siblings, 2 replies; 8+ messages in thread
From: Rafael J. Wysocki @ 2010-05-29 20:08 UTC (permalink / raw)
  To: markgross; +Cc: linux-pm, linux-kernel

On Saturday 29 May 2010, mark gross wrote:
> The following patch is to help clean up API abusers of pm_qos where
> they call update_request before registering a request.
> 
> --mgross
> 
> --Signed-off-by: markgross <markgross@thegnar.org>

Will there be a big issue if I push this during the next merge window?

Rafael


> From a0813007ddc7b72cb3da7a533fefba9889aab1d8 Mon Sep 17 00:00:00 2001
> From: mgross <mgross@mgross-desktop.(none)>
> Date: Fri, 28 May 2010 21:36:06 -0700
> Subject: [PATCH] complain when users abuse the pm_qos API by updating a request that
>  isn't registered yet.
> 
> ---
>  kernel/pm_qos_params.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/kernel/pm_qos_params.c b/kernel/pm_qos_params.c
> index f42d3f7..8e55bf1 100644
> --- a/kernel/pm_qos_params.c
> +++ b/kernel/pm_qos_params.c
> @@ -266,6 +266,10 @@ void pm_qos_update_request(struct pm_qos_request_list *pm_qos_req,
>  		spin_unlock_irqrestore(&pm_qos_lock, flags);
>  		if (pending_update)
>  			update_target(pm_qos_req->pm_qos_class);
> +	} else {
> +		WARN(true, "pm_qos: updating an unregistered request "
> +				"does nothing");
> +		dump_stack();
>  	}
>  }
>  EXPORT_SYMBOL_GPL(pm_qos_update_request);
> 


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

* Re: [linux-pm] [patch] complain when users abuse the pm_qos API
  2010-05-29 20:08 ` Rafael J. Wysocki
@ 2010-05-29 23:03   ` Nigel Cunningham
  2010-05-30 19:50     ` Rafael J. Wysocki
  2010-05-30 20:07     ` mark gross
  2010-05-30 20:08   ` mark gross
  1 sibling, 2 replies; 8+ messages in thread
From: Nigel Cunningham @ 2010-05-29 23:03 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: markgross, linux-pm, linux-kernel

Hi.

On 30/05/10 06:08, Rafael J. Wysocki wrote:
> On Saturday 29 May 2010, mark gross wrote:
>> The following patch is to help clean up API abusers of pm_qos where
>> they call update_request before registering a request.
>>
>> --mgross
>>
>> --Signed-off-by: markgross<markgross@thegnar.org>
>
> Will there be a big issue if I push this during the next merge window?

What's the point to the patch? That is: why is calling update_request 
before registering a request such a big problem that it demands a WARN() 
and dump stack?

Regards,

Nigel

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

* Re: [linux-pm] [patch] complain when users abuse the pm_qos API
  2010-05-29 23:03   ` [linux-pm] " Nigel Cunningham
@ 2010-05-30 19:50     ` Rafael J. Wysocki
  2010-05-30 20:11       ` mark gross
  2010-05-30 20:07     ` mark gross
  1 sibling, 1 reply; 8+ messages in thread
From: Rafael J. Wysocki @ 2010-05-30 19:50 UTC (permalink / raw)
  To: Nigel Cunningham; +Cc: markgross, linux-pm, linux-kernel

On Sunday 30 May 2010, Nigel Cunningham wrote:
> Hi.
> 
> On 30/05/10 06:08, Rafael J. Wysocki wrote:
> > On Saturday 29 May 2010, mark gross wrote:
> >> The following patch is to help clean up API abusers of pm_qos where
> >> they call update_request before registering a request.
> >>
> >> --mgross
> >>
> >> --Signed-off-by: markgross<markgross@thegnar.org>
> >
> > Will there be a big issue if I push this during the next merge window?
> 
> What's the point to the patch? That is: why is calling update_request 
> before registering a request such a big problem that it demands a WARN() 
> and dump stack?

It is an API violation if I understand that correctly.

Rafael

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

* Re: [linux-pm] [patch] complain when users abuse the pm_qos API
  2010-05-29 23:03   ` [linux-pm] " Nigel Cunningham
  2010-05-30 19:50     ` Rafael J. Wysocki
@ 2010-05-30 20:07     ` mark gross
  1 sibling, 0 replies; 8+ messages in thread
From: mark gross @ 2010-05-30 20:07 UTC (permalink / raw)
  To: Nigel Cunningham; +Cc: Rafael J. Wysocki, markgross, linux-pm, linux-kernel

On Sun, May 30, 2010 at 09:03:18AM +1000, Nigel Cunningham wrote:
> Hi.
> 
> On 30/05/10 06:08, Rafael J. Wysocki wrote:
> >On Saturday 29 May 2010, mark gross wrote:
> >>The following patch is to help clean up API abusers of pm_qos where
> >>they call update_request before registering a request.
> >>
> >>--mgross
> >>
> >>--Signed-off-by: markgross<markgross@thegnar.org>
> >
> >Will there be a big issue if I push this during the next merge window?
> 
> What's the point to the patch? That is: why is calling
> update_request before registering a request such a big problem that
> it demands a WARN() and dump stack?

If e1000e realy needs the latency set and makes assumptions that its
done its part, I would like to let them know that they have not
registerd the request they thought they did.

--mgross

> 
> Regards,
> 
> Nigel

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

* Re: [patch] complain when users abuse the pm_qos API
  2010-05-29 20:08 ` Rafael J. Wysocki
  2010-05-29 23:03   ` [linux-pm] " Nigel Cunningham
@ 2010-05-30 20:08   ` mark gross
  1 sibling, 0 replies; 8+ messages in thread
From: mark gross @ 2010-05-30 20:08 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: markgross, linux-pm, linux-kernel

On Sat, May 29, 2010 at 10:08:04PM +0200, Rafael J. Wysocki wrote:
> On Saturday 29 May 2010, mark gross wrote:
> > The following patch is to help clean up API abusers of pm_qos where
> > they call update_request before registering a request.
> > 
> > --mgross
> > 
> > --Signed-off-by: markgross <markgross@thegnar.org>
> 
> Will there be a big issue if I push this during the next merge window?

No big issue.  it can wait.

--mgross

> 
> Rafael
> 
> 
> > From a0813007ddc7b72cb3da7a533fefba9889aab1d8 Mon Sep 17 00:00:00 2001
> > From: mgross <mgross@mgross-desktop.(none)>
> > Date: Fri, 28 May 2010 21:36:06 -0700
> > Subject: [PATCH] complain when users abuse the pm_qos API by updating a request that
> >  isn't registered yet.
> > 
> > ---
> >  kernel/pm_qos_params.c |    4 ++++
> >  1 files changed, 4 insertions(+), 0 deletions(-)
> > 
> > diff --git a/kernel/pm_qos_params.c b/kernel/pm_qos_params.c
> > index f42d3f7..8e55bf1 100644
> > --- a/kernel/pm_qos_params.c
> > +++ b/kernel/pm_qos_params.c
> > @@ -266,6 +266,10 @@ void pm_qos_update_request(struct pm_qos_request_list *pm_qos_req,
> >  		spin_unlock_irqrestore(&pm_qos_lock, flags);
> >  		if (pending_update)
> >  			update_target(pm_qos_req->pm_qos_class);
> > +	} else {
> > +		WARN(true, "pm_qos: updating an unregistered request "
> > +				"does nothing");
> > +		dump_stack();
> >  	}
> >  }
> >  EXPORT_SYMBOL_GPL(pm_qos_update_request);
> > 
> 

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

* Re: [linux-pm] [patch] complain when users abuse the pm_qos API
  2010-05-30 19:50     ` Rafael J. Wysocki
@ 2010-05-30 20:11       ` mark gross
  2010-05-30 20:55         ` Rafael J. Wysocki
  0 siblings, 1 reply; 8+ messages in thread
From: mark gross @ 2010-05-30 20:11 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Nigel Cunningham, markgross, linux-pm, linux-kernel

On Sun, May 30, 2010 at 09:50:01PM +0200, Rafael J. Wysocki wrote:
> On Sunday 30 May 2010, Nigel Cunningham wrote:
> > Hi.
> > 
> > On 30/05/10 06:08, Rafael J. Wysocki wrote:
> > > On Saturday 29 May 2010, mark gross wrote:
> > >> The following patch is to help clean up API abusers of pm_qos where
> > >> they call update_request before registering a request.
> > >>
> > >> --mgross
> > >>
> > >> --Signed-off-by: markgross<markgross@thegnar.org>
> > >
> > > Will there be a big issue if I push this during the next merge window?
> > 
> > What's the point to the patch? That is: why is calling update_request 
> > before registering a request such a big problem that it demands a WARN() 
> > and dump stack?
> 
> It is an API violation if I understand that correctly.

Yeah, it is, but now that I'm thinking clearly perhaps a better fix
would be to change the prototype of pm_qos_update_request to return
something so callers can check for success.

Lets fix the API rather than use this patch.  Please dopt apply it.

--mgross
 

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

* Re: [linux-pm] [patch] complain when users abuse the pm_qos API
  2010-05-30 20:11       ` mark gross
@ 2010-05-30 20:55         ` Rafael J. Wysocki
  0 siblings, 0 replies; 8+ messages in thread
From: Rafael J. Wysocki @ 2010-05-30 20:55 UTC (permalink / raw)
  To: markgross; +Cc: Nigel Cunningham, linux-pm, linux-kernel

On Sunday 30 May 2010, mark gross wrote:
> On Sun, May 30, 2010 at 09:50:01PM +0200, Rafael J. Wysocki wrote:
> > On Sunday 30 May 2010, Nigel Cunningham wrote:
> > > Hi.
> > > 
> > > On 30/05/10 06:08, Rafael J. Wysocki wrote:
> > > > On Saturday 29 May 2010, mark gross wrote:
> > > >> The following patch is to help clean up API abusers of pm_qos where
> > > >> they call update_request before registering a request.
> > > >>
> > > >> --mgross
> > > >>
> > > >> --Signed-off-by: markgross<markgross@thegnar.org>
> > > >
> > > > Will there be a big issue if I push this during the next merge window?
> > > 
> > > What's the point to the patch? That is: why is calling update_request 
> > > before registering a request such a big problem that it demands a WARN() 
> > > and dump stack?
> > 
> > It is an API violation if I understand that correctly.
> 
> Yeah, it is, but now that I'm thinking clearly perhaps a better fix
> would be to change the prototype of pm_qos_update_request to return
> something so callers can check for success.
> 
> Lets fix the API rather than use this patch.  Please dopt apply it.

OK

Rafael

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

end of thread, other threads:[~2010-05-30 20:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-29  4:50 [patch] complain when users abuse the pm_qos API mark gross
2010-05-29 20:08 ` Rafael J. Wysocki
2010-05-29 23:03   ` [linux-pm] " Nigel Cunningham
2010-05-30 19:50     ` Rafael J. Wysocki
2010-05-30 20:11       ` mark gross
2010-05-30 20:55         ` Rafael J. Wysocki
2010-05-30 20:07     ` mark gross
2010-05-30 20:08   ` mark gross

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox