linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Javi Merino" <javi.merino@arm.com>
To: "linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>
Cc: Zhang Rui <rui.zhang@intel.com>, Eduardo Valentin <edubezval@gmail.com>
Subject: Re: [PATCH] thermal: lock the thermal zone when switching governors
Date: Wed, 3 Dec 2014 19:11:09 +0000	[thread overview]
Message-ID: <20141203191109.GA22781@e104805> (raw)
In-Reply-To: <1416931233-14650-1-git-send-email-javi.merino@arm.com>

Ping

On Tue, Nov 25, 2014 at 04:00:33PM +0000, Javi Merino wrote:
> Currently, userspace can request a governor change while the governor
> itself is running.  Grab the thermal zone lock when changing the
> governor to prevent this race.
> 
> Cc: Zhang Rui <rui.zhang@intel.com>
> Cc: Eduardo Valentin <edubezval@gmail.com>
> Signed-off-by: Javi Merino <javi.merino@arm.com>
> ---
>  drivers/thermal/thermal_core.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
> index 43b90709585f..c1901961f8c0 100644
> --- a/drivers/thermal/thermal_core.c
> +++ b/drivers/thermal/thermal_core.c
> @@ -757,6 +757,7 @@ policy_store(struct device *dev, struct device_attribute *attr,
>  	snprintf(name, sizeof(name), "%s", buf);
>  
>  	mutex_lock(&thermal_governor_lock);
> +	mutex_lock(&tz->lock);
>  
>  	gov = __find_governor(strim(name));
>  	if (!gov)
> @@ -766,6 +767,7 @@ policy_store(struct device *dev, struct device_attribute *attr,
>  	ret = count;
>  
>  exit:
> +	mutex_unlock(&tz->lock);
>  	mutex_unlock(&thermal_governor_lock);
>  	return ret;
>  }
> -- 
> 1.9.1
> 


  reply	other threads:[~2014-12-03 19:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-25 16:00 [PATCH] thermal: lock the thermal zone when switching governors Javi Merino
2014-12-03 19:11 ` Javi Merino [this message]
2014-12-08 14:31   ` Eduardo Valentin

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=20141203191109.GA22781@e104805 \
    --to=javi.merino@arm.com \
    --cc=edubezval@gmail.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=rui.zhang@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).