linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Pandruvada, Srinivas" <srinivas.pandruvada@intel.com>
To: "Zhang, Rui" <rui.zhang@intel.com>,
	"thara.gopinath@linaro.org" <thara.gopinath@linaro.org>,
	"mka@chromium.org" <mka@chromium.org>,
	"quic_manafm@quicinc.com" <quic_manafm@quicinc.com>,
	"daniel.lezcano@linaro.org" <daniel.lezcano@linaro.org>,
	"rafael@kernel.org" <rafael@kernel.org>,
	"amitk@kernel.org" <amitk@kernel.org>
Cc: "linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3] thermal/core: Clear all mitigation when thermal zone is disabled
Date: Mon, 24 Jan 2022 01:05:35 +0000	[thread overview]
Message-ID: <ab6134bd1ca7f7fd8cedad90c1bbb81f642ac647.camel@intel.com> (raw)
In-Reply-To: <927aca29-fca7-bdf9-9ad6-2599125ca1b4@linaro.org>

On Sun, 2022-01-23 at 21:51 +0100, Daniel Lezcano wrote:
> 
> Hi Manaf,
> 
> semantically speaking disabling a thermal zone would be to detach the
> thermal zone from its governor and stop the monitoring.
> 
> May be add the functions
> 
>  - thermal_governor_attach(struct thermal_zone_device *tzd)
>    {
>         ...
>         if (tz->governor && tz->governor->bind_to_tz) {
>                 if (tz->governor->bind_to_tz(tz)) {
>         }
>         ...
>    }
> 
>  - thermal_governor_detach(struct thermal_zone_device *tzd)
>    {
>         ...
>         if (tz->governor && tz->governor->unbind_from_tz)
>                 tz->governor->unbind_from_tz(tz);
>         ...
>    }
> 
> And add in the step_wise and power_allocator the reset of the
> governor's
> data as well as the cooling device instances in the unbind_from_tz()
> callback
> 
> Then, thermal_zone_device_enable() attaches and
> thermal_zone_device_disable() detaches the governor.
> 
> Does it make sense ?
This is better.

Thanks,
Srinivas

> 
> 
> On 07/01/2022 19:56, Manaf Meethalavalappu Pallikunhi wrote:
> > Whenever a thermal zone is in trip violated state, there is a
> > chance
> > that the same thermal zone mode can be disabled either via thermal
> > core API or via thermal zone sysfs. Once it is disabled, the
> > framework
> > bails out any re-evaluation of thermal zone. It leads to a case
> > where
> > if it is already in mitigation state, it will stay the same state
> > until it is re-enabled.
> > 
> > To avoid above mentioned issue, on thermal zone disable request
> > reset thermal zone and clear mitigation for each trip explicitly.
> > 
> > Signed-off-by: Manaf Meethalavalappu Pallikunhi
> > <quic_manafm@quicinc.com>
> > ---
> >  drivers/thermal/thermal_core.c | 12 ++++++++++--
> >  1 file changed, 10 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/thermal/thermal_core.c
> > b/drivers/thermal/thermal_core.c
> > index 51374f4..e288c82 100644
> > --- a/drivers/thermal/thermal_core.c
> > +++ b/drivers/thermal/thermal_core.c
> > @@ -447,10 +447,18 @@ static int
> > thermal_zone_device_set_mode(struct thermal_zone_device *tz,
> >  
> >         thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED);
> >  
> > -       if (mode == THERMAL_DEVICE_ENABLED)
> > +       if (mode == THERMAL_DEVICE_ENABLED) {
> >                 thermal_notify_tz_enable(tz->id);
> > -       else
> > +       } else {
> > +               int trip;
> > +
> > +               /* make sure all previous throttlings are cleared
> > */
> > +               thermal_zone_device_init(tz);
> > +               for (trip = 0; trip < tz->trips; trip++)
> > +                       handle_thermal_trip(tz, trip);
> > +
> >                 thermal_notify_tz_disable(tz->id);
> > +       }
> >  
> >         return ret;
> >  }
> > 
> 
> 


  reply	other threads:[~2022-01-24  1:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-07 18:56 [PATCH v3] thermal/core: Clear all mitigation when thermal zone is disabled Manaf Meethalavalappu Pallikunhi
2022-01-10 17:55 ` Thara Gopinath
2022-01-10 20:45   ` Manaf Meethalavalappu Pallikunhi
2022-01-19 19:05     ` Manaf Meethalavalappu Pallikunhi
2022-01-19 19:12       ` Daniel Lezcano
2022-01-19 20:03 ` Rafael J. Wysocki
2022-01-23 20:51 ` Daniel Lezcano
2022-01-24  1:05   ` Pandruvada, Srinivas [this message]
2022-01-25 15:48     ` Manaf Meethalavalappu Pallikunhi

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=ab6134bd1ca7f7fd8cedad90c1bbb81f642ac647.camel@intel.com \
    --to=srinivas.pandruvada@intel.com \
    --cc=amitk@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mka@chromium.org \
    --cc=quic_manafm@quicinc.com \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=thara.gopinath@linaro.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;
as well as URLs for NNTP newsgroup(s).