linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: lina.iyer@linaro.org (Lina Iyer)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 7/7] ARM: smp: Add runtime PM support for CPU hotplug
Date: Fri, 4 Sep 2015 11:02:11 -0600	[thread overview]
Message-ID: <20150904170211.GF876@linaro.org> (raw)
In-Reply-To: <20150904162325.GG21084@n2100.arm.linux.org.uk>

On Fri, Sep 04 2015 at 10:23 -0600, Russell King - ARM Linux wrote:
>On Fri, Sep 04, 2015 at 09:12:02AM -0600, Lina Iyer wrote:
>> On Fri, Sep 04 2015 at 03:27 -0600, Russell King - ARM Linux wrote:
>> >On Fri, Sep 04, 2015 at 10:17:35AM +0100, Russell King - ARM Linux wrote:
>> >>On Thu, Sep 03, 2015 at 01:58:34PM -0600, Lina Iyer wrote:
>> >>> @@ -401,6 +412,11 @@ asmlinkage void secondary_start_kernel(void)
>> >>>  	local_irq_enable();
>> >>>  	local_fiq_enable();
>> >>>
>> >>> +	/* We are running, enable runtime PM for the CPU. */
>> >>> +	cpu_dev = get_cpu_device(cpu);
>> >>> +	if (cpu_dev)
>> >>> +		pm_runtime_get_sync(cpu_dev);
>> >>> +
>> >>
>> >>Please no.  This is fragile.
>> >>
>> >>pm_runtime_get_sync() can sleep, and this path is used when the system
>> >>is fully up and running.  Locks may be held, which cause this to sleep.
>> >>However, we're calling it from a context where we can't sleep - which
>> >>is the general rule for any part of system initialisation where we
>> >>have not entered the idle thread yet (the idle thread is what we run
>> >>when sleeping.)
>> >>
>> More explanation below.
>>
>> Another patch (3/7) in this series defines CPU devices as IRQ safe and
>> therefore the dev->power.lock would be spinlock'd before calling the
>> rest of the PM runtime code and the domain. The CPU PM domain would also
>> be an IRQ safe domain (patch 2/7 makes the genpd framework usable in IRQ
>> safe context).
>>
>> >>NAK on this.
>> >
>> >There's another issue here.  This is obviously wrong.  If the CPU is
>> >inside the PM domain, then don't you need the PM domain powered up for
>> >the CPU to start executing instructions?
>> >
>> This would not be the case for CPU PM domains. The CPU PM domains AFAIK,
>> are triggered by the same wake up interrupt that brings the CPU out of
>> its power downs state. The domain hardware has to be awake before the
>> CPU executes its first instruction. Thefore the hw power up is a logical
>> OR of the wakeup signals to any of the cores.
>
>You're taking the behaviour of the hardware you have in front of you
>and claiming that it's true everywhere, and shoving that into generic
>code.
>
>I know, for example on OMAP, you have to power up the CPU first before
>you can "wake" it.
>
>I wouldn't be surprised if other SoCs are like that: where they require
>the CPU core to be powered and held in reset, before releasing the reset
>to then allow them to start executing the secondary core bringup.
>
It would still require that the CPU's domain be powered on in the hw,
before the CPU can run Linux.

>Relying on hardware to do this sounds really fragile and bad design to
>me.
>
>If you want to persue your current design, don't make it generic code,
>because it's got no right to be generic with assumptions like that.
>
Hmm, okay. I can look at alternatives like  hotplug notifiers.

-- Lina

  reply	other threads:[~2015-09-04 17:02 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-03 19:58 [PATCH v2 0/7] PM / Domains: Generic PM domains for CPUs/Clusters Lina Iyer
2015-09-03 19:58 ` [PATCH v2 1/7] PM / Domains: Allocate memory outside domain locks Lina Iyer
2015-09-03 19:58 ` [PATCH v2 2/7] PM / Domains: Support IRQ safe PM domains Lina Iyer
2015-09-04 10:02   ` Ulf Hansson
2015-09-04 16:05     ` Lina Iyer
2015-10-01 21:11   ` Geert Uytterhoeven
2015-09-03 19:58 ` [PATCH v2 3/7] drivers: cpu: Define CPU devices as IRQ safe Lina Iyer
2015-09-04  4:00   ` Stephen Boyd
2015-09-03 19:58 ` [PATCH v2 4/7] PM / Domains: Introduce PM domains for CPUs/clusters Lina Iyer
2015-09-04  3:54   ` Stephen Boyd
2015-09-03 19:58 ` [PATCH v2 5/7] ARM: cpuidle: Add runtime PM support for CPU idle Lina Iyer
2015-09-03 19:58 ` [PATCH v2 6/7] ARM64: smp: Add runtime PM support for CPU hotplug Lina Iyer
2015-09-30 12:36   ` Geert Uytterhoeven
2015-09-03 19:58 ` [PATCH v2 7/7] ARM: " Lina Iyer
2015-09-04  3:59   ` Stephen Boyd
2015-09-04 15:13     ` Lina Iyer
2015-09-04  7:39   ` Geert Uytterhoeven
2015-09-04  9:17   ` Russell King - ARM Linux
2015-09-04  9:27     ` Russell King - ARM Linux
2015-09-04 15:12       ` Lina Iyer
2015-09-04 16:23         ` Russell King - ARM Linux
2015-09-04 17:02           ` Lina Iyer [this message]
2015-09-04 17:46             ` Russell King - ARM Linux
2015-09-04 17:57         ` Grygorii Strashko
2015-09-04 18:45           ` Alan Stern
2015-09-04 21:46             ` Grygorii Strashko
2015-09-05 15:39               ` Alan Stern
2015-09-07 13:04                 ` Rafael J. Wysocki
2015-09-07 13:37                   ` Grygorii Strashko
2015-09-07 20:42                     ` Rafael J. Wysocki
2015-09-08  8:21                       ` Grygorii Strashko
2015-09-08 22:03                         ` Kevin Hilman
2015-09-10 11:01                           ` Grygorii Strashko
2015-09-22 17:32                             ` Lina Iyer
2015-09-22 20:53                               ` Thomas Gleixner

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=20150904170211.GF876@linaro.org \
    --to=lina.iyer@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.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).