linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] ARM: tegra: moving the clock gating procedure to tegra_cpu_kill
Date: Sun, 23 Dec 2012 12:12:31 +0000	[thread overview]
Message-ID: <20121223121231.GA16580@mudshark.cambridge.arm.com> (raw)
In-Reply-To: <20121223112540.GF16237@mudshark.cambridge.arm.com>

On Sun, Dec 23, 2012 at 11:25:40AM +0000, Will Deacon wrote:
> On Fri, Dec 21, 2012 at 09:23:17PM +0000, Stephen Warren wrote:
> > What exactly did you mean by "what we currently have"; did you mean that
> > cpu_kill() should work without cpu_die() having executed on the target
> > CPU itself first, so Tegra should simply implement cpu_kill()? As Joseph
> > says above, I'm not sure that will work. Any more detailed thoughts you
> > have here would be greatly appreciated. Thanks.
> 
> I guess this comes down to the different between cpu_die/cpu_kill and
> whether you actually need cpu_die if you're not planning on returning to
> the same kernel that you left. If you really need to call cpu_die, then we
> need to figure out a way to do that whilst ensuring that only one CPU is
> left standing at the time we start copying the new kernel into place.

I took a closer look at the code to try and figure out a way to solve
this...

First of all, disable_nonboot_cpus *does* actually wait for the secondaries
to get out of the way, because it calls __cpu_die and we end up waiting on a
completion. The problem is that we IPI the secondaries in smp_send_stop,
which puts then into a while(1) cpu_relax(); loop with interrupts disabled,
so that completion won't be able to finish (the cores won't pass through
idle and call cpu_die() themselves).

This means we must call disable_nonboot_cpus before sending the IPI. My
first attempt was to make a hotplug-aware smp_send_stop, using
disable_nonboot_cpus and smp_kill_cpus but this is also problematic because
it's called by panic, where the simpler IPI-based code is probably a lot
better.

The best bet is probably to call disable_nonboot_cpus in machine shutdown,
before sending the stop and subsequent kill. It's very similar to your
initial suggestion, but without the #elif.

Does that work for you?

Will

  reply	other threads:[~2012-12-23 12:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-20  2:28 [PATCH 1/2] ARM: tegra: update the cache maintenance order for CPU shutdown Joseph Lo
2012-12-20  2:28 ` [PATCH 2/2] ARM: tegra: moving the clock gating procedure to tegra_cpu_kill Joseph Lo
2012-12-20 17:01   ` Stephen Warren
2012-12-21  9:58     ` Joseph Lo
2012-12-21 21:23       ` Stephen Warren
2012-12-23 11:25         ` Will Deacon
2012-12-23 12:12           ` Will Deacon [this message]
2013-01-02 21:08             ` Stephen Warren

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=20121223121231.GA16580@mudshark.cambridge.arm.com \
    --to=will.deacon@arm.com \
    --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).