All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Turquette <mturquette@linaro.org>
To: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Lior Amsalem <alior@marvell.com>, Andrew Lunn <andrew@lunn.ch>,
	Jason Cooper <jason@lakedaemon.net>,
	Tawfik Bayouk <tawfik@marvell.com>,
	linux-pm@vger.kernel.org, Viresh Kumar <viresh.kumar@linaro.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Nadav Haklai <nadavh@marvell.com>,
	devicetree@vger.kernel.org,
	Ezequiel Garcia <ezequiel.garcia@free-electrons.com>,
	Gregory Clement <gregory.clement@free-electrons.com>,
	linux-arm-kernel@lists.infradead.org,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Subject: Re: [PATCHv3 3/7] clk: mvebu: extend clk-cpu for dynamic frequency scaling
Date: Thu, 24 Jul 2014 10:52:51 -0700	[thread overview]
Message-ID: <20140724175251.3823.74667@quantum> (raw)
In-Reply-To: <20140724083325.0c578091@free-electrons.com>

Quoting Thomas Petazzoni (2014-07-23 23:33:25)
> Hello,
> 
> (Not sure why this e-mail comes with me as the From:, but anyway.)
> 
> On Wed, 23 Jul 2014 16:53:58 -0700, Thomas Petazzoni wrote:
> 
> > +static int clk_cpu_set_rate(struct clk_hw *hwclk, unsigned long rate,
> > +                           unsigned long parent_rate)
> > +{
> > +       if (__clk_is_enabled(hwclk->clk))
> > +               return clk_cpu_on_set_rate(hwclk, rate, parent_rate);
> > +       else
> > +               return clk_cpu_off_set_rate(hwclk, rate, parent_rate);
> > 
> > This is racy. You don't hold the clk_enable lock so it could be enable
> > between the conditional check and executing clk_cpu_on_set_rate.
> 
> Right.
> 
> > How do you ensure that secondary CPU clocks are not enabled/disabled
> > when changing rates?
> 
> In practice, this currently cannot happen: we enable the secondary CPU
> clocks before starting the secondary CPUs, and we never ever disable or
> re-enable again those clocks. So with the present code, I believe there
> is no problem. Even when we do CPU hotplug, we don't turn off the CPU
> clocks, simply because they cannot be turned off: the enable/disable
> state is only used here as an indication so that the clock driver knows
> which frequency change strategy it should apply.
> 
> But you're anyway right, I'll send a followup patch adding the lock.
> Would that be OK for you?

Sounds good. Can you also fix up the changelog in patch #2? After that
I am happy with this series. I guess Jason will take it in and send it
for his PR?

Thanks,
Mike

> 
> Thanks,
> 
> Thomas
> -- 
> Thomas Petazzoni, CTO, Free Electrons
> Embedded Linux, Kernel and Android engineering
> http://free-electrons.com

WARNING: multiple messages have this Message-ID (diff)
From: mturquette@linaro.org (Mike Turquette)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv3 3/7] clk: mvebu: extend clk-cpu for dynamic frequency scaling
Date: Thu, 24 Jul 2014 10:52:51 -0700	[thread overview]
Message-ID: <20140724175251.3823.74667@quantum> (raw)
In-Reply-To: <20140724083325.0c578091@free-electrons.com>

Quoting Thomas Petazzoni (2014-07-23 23:33:25)
> Hello,
> 
> (Not sure why this e-mail comes with me as the From:, but anyway.)
> 
> On Wed, 23 Jul 2014 16:53:58 -0700, Thomas Petazzoni wrote:
> 
> > +static int clk_cpu_set_rate(struct clk_hw *hwclk, unsigned long rate,
> > +                           unsigned long parent_rate)
> > +{
> > +       if (__clk_is_enabled(hwclk->clk))
> > +               return clk_cpu_on_set_rate(hwclk, rate, parent_rate);
> > +       else
> > +               return clk_cpu_off_set_rate(hwclk, rate, parent_rate);
> > 
> > This is racy. You don't hold the clk_enable lock so it could be enable
> > between the conditional check and executing clk_cpu_on_set_rate.
> 
> Right.
> 
> > How do you ensure that secondary CPU clocks are not enabled/disabled
> > when changing rates?
> 
> In practice, this currently cannot happen: we enable the secondary CPU
> clocks before starting the secondary CPUs, and we never ever disable or
> re-enable again those clocks. So with the present code, I believe there
> is no problem. Even when we do CPU hotplug, we don't turn off the CPU
> clocks, simply because they cannot be turned off: the enable/disable
> state is only used here as an indication so that the clock driver knows
> which frequency change strategy it should apply.
> 
> But you're anyway right, I'll send a followup patch adding the lock.
> Would that be OK for you?

Sounds good. Can you also fix up the changelog in patch #2? After that
I am happy with this series. I guess Jason will take it in and send it
for his PR?

Thanks,
Mike

> 
> Thanks,
> 
> Thomas
> -- 
> Thomas Petazzoni, CTO, Free Electrons
> Embedded Linux, Kernel and Android engineering
> http://free-electrons.com

  reply	other threads:[~2014-07-24 17:52 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-09 15:45 [PATCHv3 0/7] cpufreq support for Marvell Armada XP Thomas Petazzoni
2014-07-09 15:45 ` Thomas Petazzoni
2014-07-09 15:45 ` [PATCHv3 1/7] ARM: mvebu: ensure CPU clocks are enabled Thomas Petazzoni
2014-07-09 15:45   ` Thomas Petazzoni
2014-07-16 13:02   ` Jason Cooper
2014-07-16 13:02     ` Jason Cooper
2014-07-09 15:45 ` [PATCHv3 2/7] ARM: mvebu: extend PMSU code to support dynamic frequency scaling Thomas Petazzoni
2014-07-09 15:45   ` Thomas Petazzoni
2014-07-23 23:50   ` Mike Turquette
2014-07-23 23:50     ` Mike Turquette
2014-07-24  6:29     ` Thomas Petazzoni
2014-07-24  6:29       ` Thomas Petazzoni
2014-07-24 11:11       ` Jason Cooper
2014-07-24 11:11         ` Jason Cooper
2014-07-09 15:45 ` [PATCHv3 3/7] clk: mvebu: extend clk-cpu for " Thomas Petazzoni
2014-07-09 15:45   ` Thomas Petazzoni
2014-07-09 15:45 ` [PATCHv3 4/7] ARM: mvebu: update Armada XP DT " Thomas Petazzoni
2014-07-09 15:45   ` Thomas Petazzoni
2014-07-16 12:55   ` Jason Cooper
2014-07-16 12:55     ` Jason Cooper
2014-07-09 15:45 ` [PATCHv3 5/7] ARM: mvebu: allow enabling of cpufreq on Armada XP Thomas Petazzoni
2014-07-09 15:45   ` Thomas Petazzoni
2014-07-09 15:45 ` [PATCHv3 6/7] ARM: mvebu: update mvebu_v7_defconfig with cpufreq support Thomas Petazzoni
2014-07-09 15:45   ` Thomas Petazzoni
2014-07-16 12:52   ` Jason Cooper
2014-07-16 12:52     ` Jason Cooper
2014-07-09 15:45 ` [PATCHv3 7/7] ARM: configs: add cpufreq-generic in multi_v7_defconfig Thomas Petazzoni
2014-07-09 15:45   ` Thomas Petazzoni
2014-07-16 12:49   ` Jason Cooper
2014-07-16 12:49     ` Jason Cooper
2014-07-13 22:33 ` [PATCHv3 0/7] cpufreq support for Marvell Armada XP Jason Cooper
2014-07-13 22:33   ` Jason Cooper
2014-07-23 11:19 ` Thomas Petazzoni
2014-07-23 11:19   ` Thomas Petazzoni
2014-07-23 11:39   ` Jason Cooper
2014-07-23 11:39     ` Jason Cooper
2014-07-23 11:53     ` Thomas Petazzoni
2014-07-23 11:53       ` Thomas Petazzoni
2014-07-23 16:52   ` Viresh Kumar
2014-07-23 16:52     ` Viresh Kumar
2014-07-23 23:53 ` [PATCHv3 3/7] clk: mvebu: extend clk-cpu for dynamic frequency scaling Thomas Petazzoni
2014-07-23 23:53   ` Thomas Petazzoni
2014-07-24  6:33   ` Thomas Petazzoni
2014-07-24  6:33     ` Thomas Petazzoni
2014-07-24 17:52     ` Mike Turquette [this message]
2014-07-24 17:52       ` Mike Turquette
2014-07-24 18:24       ` Thomas Petazzoni
2014-07-24 18:24         ` Thomas Petazzoni

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=20140724175251.3823.74667@quantum \
    --to=mturquette@linaro.org \
    --cc=alior@marvell.com \
    --cc=andrew@lunn.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=ezequiel.garcia@free-electrons.com \
    --cc=gregory.clement@free-electrons.com \
    --cc=jason@lakedaemon.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=nadavh@marvell.com \
    --cc=rjw@rjwysocki.net \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=tawfik@marvell.com \
    --cc=thomas.petazzoni@free-electrons.com \
    --cc=viresh.kumar@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.