linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: Preeti U Murthy <preeti@linux.vnet.ibm.com>
Cc: rjw@rjwysocki.net, ego@linux.vnet.ibm.com, paulus@samba.org,
	linux-kernel@vger.kernel.org, shilpa.bhat@linux.vnet.ibm.com,
	linux-pm@vger.kernel.org
Subject: Re: [RFC PATCH] cpufreq/hotplug: Fix cpu-hotplug cpufreq race conditions
Date: Tue, 2 Jun 2015 11:41:33 +0530	[thread overview]
Message-ID: <20150602061133.GE10443@linux> (raw)
In-Reply-To: <556D4748.7040105@linux.vnet.ibm.com>

On 02-06-15, 11:33, Preeti U Murthy wrote:
> No, dbs_data is a governor wide data structure and not a policy wide

Yeah, that's the common part which I was referring to. But normally
its just read for policies in START/STOP, they just update per-cpu
data for policy->cpus.

> one, which is manipulated in START/STOP calls for drivers where the
> CPUFREQ_HAVE_GOVERNOR_PER_POLICY is not set.
> 
> So even if we assume that we hold per-policy locks, the following race
> is still present. Assume that we have just two cpus which do not have a
> governor-per-policy set.
> 
> CPU0                        CPU1
> 
>  store*                     store*
> 
> lock(policy 1)              lock(policy 2)
> cpufreq_set_policy()       cpufreq_set_policy()
> EXIT() :
> dbs-data->usage_count--
> 
> INIT()
> dbs_data exists

You missed the usage_count++ here.

> so return
>                             EXIT()
>                             dbs_data->usage_count -- = 0
>                             kfree(dbs_data)

                                And so this shouldn't happen. Else we
                                are missing locking in governor's
                                code, rather than cpufreq.c

-- 
viresh

  reply	other threads:[~2015-06-02  6:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-01  6:40 [RFC PATCH] cpufreq/hotplug: Fix cpu-hotplug cpufreq race conditions Preeti U Murthy
2015-06-01  7:19 ` Viresh Kumar
2015-06-01  7:55   ` Preeti U Murthy
2015-06-02  5:31   ` Preeti U Murthy
2015-06-02  5:39     ` Viresh Kumar
2015-06-02  6:03       ` Preeti U Murthy
2015-06-02  6:11         ` Viresh Kumar [this message]
2015-06-02  6:20           ` Preeti U Murthy
2015-06-02  6:27             ` Viresh Kumar
2015-06-02  6:56               ` Preeti U Murthy
2015-06-02  7:07                 ` Viresh Kumar

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=20150602061133.GE10443@linux \
    --to=viresh.kumar@linaro.org \
    --cc=ego@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=paulus@samba.org \
    --cc=preeti@linux.vnet.ibm.com \
    --cc=rjw@rjwysocki.net \
    --cc=shilpa.bhat@linux.vnet.ibm.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).