mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zhang Rui <rui.zhang@intel.com>
To: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: linux-kernel@vger.kernel.org, amit.kucheria@verdurent.com,
	"open list:THERMAL" <linux-pm@vger.kernel.org>
Subject: Re: [PATCH 1/2] thermal: core: Move thermal_cdev_update next to updated=false
Date: Sat, 11 Apr 2020 10:55:42 +0800	[thread overview]
Message-ID: <a91cf79e0ee7da4e0ac108168eceb5c63c78f8e1.camel@intel.com> (raw)
In-Reply-To: <0c9796c5-95fe-0349-d128-393da9b344d6@linaro.org>

On Fri, 2020-04-10 at 13:26 +0200, Daniel Lezcano wrote:
> On 10/04/2020 12:14, Zhang Rui wrote:
> > Hi, Daniel,
> > 
> > On Thu, 2020-04-09 at 17:15 +0200, Daniel Lezcano wrote:
> > > The call to the thermal_cdev_update() function is done after
> > > browsing
> > > the thermal instances which sets the updated flag by browsing
> > > them
> > > again.
> > > 
> > > Instead of doing this, let's move the call right after setting
> > > the
> > > cooling device 'updated' flag as it is done in the other
> > > governors.
> > 
> > The reason we do this in two steps is that we want to avoid
> > redundant
> > cooling device state changes.
> > 
> > Further more, I think it is better to move the thermal_cdev_update
> > out
> > of .throllte() callback, to thermal_zone_device_update(). So that
> > we do
> > not need to update the cooling device for each trip point.
> > 
> > is there any specific reason we need to do thermal_cdev_update()
> > for
> > every potential change?
> 
> I agree we can go further and move the cooling device update in the
> thermal_zone_device_update() by letting the throttle callback let us
> know an update is needed with the return value.
> 
> Makes sense to provide more changes on top of those two patches ?

Hmmm, without the update flag, we can only updating all the cooling
devices blindly. And this is time consuming for some cooling devices.

thanks,
rui

> 
> > > Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> > > ---
> > >  drivers/thermal/gov_bang_bang.c | 10 +---------
> > >  drivers/thermal/step_wise.c     | 10 +---------
> > >  2 files changed, 2 insertions(+), 18 deletions(-)
> > > 
> > > diff --git a/drivers/thermal/gov_bang_bang.c
> > > b/drivers/thermal/gov_bang_bang.c
> > > index 991a1c54296d..c292a69845bb 100644
> > > --- a/drivers/thermal/gov_bang_bang.c
> > > +++ b/drivers/thermal/gov_bang_bang.c
> > > @@ -64,6 +64,7 @@ static void thermal_zone_trip_update(struct
> > > thermal_zone_device *tz, int trip)
> > >  		mutex_lock(&instance->cdev->lock);
> > >  		instance->cdev->updated = false; /* cdev needs update
> > > */
> > >  		mutex_unlock(&instance->cdev->lock);
> > > +		thermal_cdev_update(instance->cdev);
> > >  	}
> > >  
> > >  	mutex_unlock(&tz->lock);
> > > @@ -98,17 +99,8 @@ static void thermal_zone_trip_update(struct
> > > thermal_zone_device *tz, int trip)
> > >   */
> > >  static int bang_bang_control(struct thermal_zone_device *tz, int
> > > trip)
> > >  {
> > > -	struct thermal_instance *instance;
> > > -
> > >  	thermal_zone_trip_update(tz, trip);
> > >  
> > > -	mutex_lock(&tz->lock);
> > > -
> > > -	list_for_each_entry(instance, &tz->thermal_instances, tz_node)
> > > -		thermal_cdev_update(instance->cdev);
> > > -
> > > -	mutex_unlock(&tz->lock);
> > > -
> > >  	return 0;
> > >  }
> > >  
> > > diff --git a/drivers/thermal/step_wise.c
> > > b/drivers/thermal/step_wise.c
> > > index 2ae7198d3067..298eedac0293 100644
> > > --- a/drivers/thermal/step_wise.c
> > > +++ b/drivers/thermal/step_wise.c
> > > @@ -167,6 +167,7 @@ static void thermal_zone_trip_update(struct
> > > thermal_zone_device *tz, int trip)
> > >  		mutex_lock(&instance->cdev->lock);
> > >  		instance->cdev->updated = false; /* cdev needs update
> > > */
> > >  		mutex_unlock(&instance->cdev->lock);
> > > +		thermal_cdev_update(instance->cdev);
> > >  	}
> > >  
> > >  	mutex_unlock(&tz->lock);
> > > @@ -185,20 +186,11 @@ static void thermal_zone_trip_update(struct
> > > thermal_zone_device *tz, int trip)
> > >   */
> > >  static int step_wise_throttle(struct thermal_zone_device *tz,
> > > int
> > > trip)
> > >  {
> > > -	struct thermal_instance *instance;
> > > -
> > >  	thermal_zone_trip_update(tz, trip);
> > >  
> > >  	if (tz->forced_passive)
> > >  		thermal_zone_trip_update(tz, THERMAL_TRIPS_NONE);
> > >  
> > > -	mutex_lock(&tz->lock);
> > > -
> > > -	list_for_each_entry(instance, &tz->thermal_instances, tz_node)
> > > -		thermal_cdev_update(instance->cdev);
> > > -
> > > -	mutex_unlock(&tz->lock);
> > > -
> > >  	return 0;
> > >  }
> > >  
> 
> 


      reply	other threads:[~2020-04-11  2:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-09 15:15 Daniel Lezcano
2020-04-09 15:15 ` [PATCH 2/2] thermal: core: Remove pointless 'updated' boolean Daniel Lezcano
2020-04-10 10:14 ` [PATCH 1/2] thermal: core: Move thermal_cdev_update next to updated=false Zhang Rui
2020-04-10 11:26   ` Daniel Lezcano
2020-04-11  2:55     ` Zhang Rui [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=a91cf79e0ee7da4e0ac108168eceb5c63c78f8e1.camel@intel.com \
    --to=rui.zhang@intel.com \
    --cc=amit.kucheria@verdurent.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®