From: Dave.Martin@arm.com (Dave Martin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 01/13] ARM: suspend: use hash of cpu_logical_map value to index into save array
Date: Thu, 25 Jul 2013 11:55:34 +0100 [thread overview]
Message-ID: <20130725105528.GA2546@localhost.localdomain> (raw)
In-Reply-To: <alpine.LFD.2.03.1307241437460.15022@syhkavp.arg>
On Wed, Jul 24, 2013 at 02:55:00PM -0400, Nicolas Pitre wrote:
> On Wed, 24 Jul 2013, Dave Martin wrote:
>
> > On Mon, Jul 22, 2013 at 11:31:17PM -0400, Nicolas Pitre wrote:
> > > Currently we hash the MPIDR of the CPU being suspended to determine which
> > > entry in the sleep_save_sp array to use. In some situations, such as when
> > > we want to resume on another physical CPU, the MPIDR of another CPU should
> > > be used instead.
> > >
> > > So let's use the value of cpu_logical_map(smp_processor_id()) in place
> > > of the MPIDR in the suspend path. This will result in the same index
> > > being used as with the previous code unless the caller has modified
> > > cpu_logical_map() beforehand.
> >
> > This only works because we happen to swap MPIDRs in cpu_logical_map
> > before we get here, so that cpu_logical_map(smp_processor_id())
> > described the post-resume situation for this logical CPU, not the
> > current situation.
>
> Yes, that's more or less what I said above. Maybe that should be
> clarified further?
>
> > We have to swizzle cpu_logical_map() somewhere, and the suspend path is
> > just as good as the resume path for that.
>
> Not quite. On the resume path, we have to get to the context save array
> while having no mmu active and no stack. There is no way we could take
> over another CPU's context in those conditions without making it
> extremely painful on ourselves. It is therefore way easier to swizzle
> cpu_logical_map() on the suspend path and keep the suspend/resume logic
> unmodified.
For this implementation, that's correct, and it's a perfectly good way
of doing things.
My point is that the user of cpu_resume() does not necessarily realise
the nature of this dependency.
> > But this patch commits us to requiring that on the suspend path
> > specifically -- I think that ought to be mentioned somewhere. A
> > comment in the preamble for __cpu_suspend would be enough, I think.
>
> What comment would you suggest? I want to make sure the possible
> confusion you see is properly addressed.
I think we just need to state that the value of
cpu_logical_map(smp_processor_id()) must be the MPIDR of the physical
CPU the suspending logical CPU will resume on. Consequently, if doing a
migration, cpu_logical_map() must be updated appropriately somewhere
between cpu_pm_enter() and cpu_suspend().
This also means that the choice of destination CPU can't be made
dynamically at resume time. But I'm not sure that's useful or even
makes sense, so I'm not worrying about it.
> > Looks like the patch should work though, and it does remove the need to
> > read the MPIDR, which is slightly nicer for the non-switcher case.
>
> This patch works fine here, and I'd expect rather catastrophic results
> if it didn't. ;-)
Sure, I'm not doubting that the code works.
Cheers
---Dave
next prev parent reply other threads:[~2013-07-25 10:55 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-23 3:31 [PATCH 00/13] The big.LITTLE In-Kernel Switcher (IKS), part 1 Nicolas Pitre
2013-07-23 3:31 ` [PATCH 01/13] ARM: suspend: use hash of cpu_logical_map value to index into save array Nicolas Pitre
2013-07-24 16:47 ` Dave Martin
2013-07-24 18:55 ` Nicolas Pitre
2013-07-25 10:55 ` Dave Martin [this message]
2013-07-25 16:06 ` Nicolas Pitre
2013-07-26 11:31 ` Lorenzo Pieralisi
2013-07-26 14:41 ` Nicolas Pitre
2013-07-26 15:34 ` Dave Martin
2013-07-26 15:43 ` Nicolas Pitre
2013-07-26 15:45 ` Dave Martin
2013-07-26 17:04 ` Lorenzo Pieralisi
2013-07-26 19:19 ` Nicolas Pitre
2013-07-29 11:50 ` Lorenzo Pieralisi
2013-07-30 2:08 ` Nicolas Pitre
2013-07-30 9:15 ` Dave Martin
2013-07-23 3:31 ` [PATCH 02/13] ARM: gic: add CPU migration support Nicolas Pitre
2013-07-25 11:44 ` Jonathan Austin
2013-07-25 19:11 ` Nicolas Pitre
2013-07-23 3:31 ` [PATCH 03/13] ARM: b.L: core switcher code Nicolas Pitre
2013-07-25 17:15 ` Jonathan Austin
2013-07-25 20:20 ` Nicolas Pitre
2013-07-26 10:45 ` Lorenzo Pieralisi
2013-07-26 14:29 ` Nicolas Pitre
2013-07-26 14:53 ` Russell King - ARM Linux
2013-07-26 15:10 ` Nicolas Pitre
2013-07-23 3:31 ` [PATCH 04/13] ARM: bL_switcher: add clockevent save/restore support Nicolas Pitre
2013-07-23 3:31 ` [PATCH 05/13] ARM: bL_switcher: move to dedicated threads rather than workqueues Nicolas Pitre
2013-07-26 15:18 ` Lorenzo Pieralisi
2013-07-26 15:39 ` Nicolas Pitre
2013-07-23 3:31 ` [PATCH 06/13] ARM: bL_switcher: simplify stack isolation Nicolas Pitre
2013-07-23 3:31 ` [PATCH 07/13] ARM: bL_switcher: hot-unplug half of the available CPUs Nicolas Pitre
2013-07-23 3:31 ` [PATCH 08/13] ARM: bL_switcher: do not hardcode GIC IDs in the code Nicolas Pitre
2013-07-23 3:31 ` [PATCH 09/13] ARM: bL_switcher: ability to enable and disable the switcher via sysfs Nicolas Pitre
2013-07-23 3:31 ` [PATCH 10/13] ARM: bL_switcher: add kernel cmdline param to disable the switcher on boot Nicolas Pitre
2013-07-23 3:31 ` [PATCH 11/13] ARM: bL_switcher: veto CPU hotplug requests when the switcher is active Nicolas Pitre
2013-07-31 10:30 ` Lorenzo Pieralisi
2013-08-05 4:25 ` Nicolas Pitre
2013-07-23 3:31 ` [PATCH 12/13] ARM: bL_switcher: remove assumptions between logical and physical CPUs Nicolas Pitre
2013-07-30 16:30 ` Lorenzo Pieralisi
2013-07-30 19:15 ` Nicolas Pitre
2013-07-31 9:41 ` Lorenzo Pieralisi
2013-07-23 3:31 ` [PATCH 13/13] ARM: bL_switcher: add a simple /dev user interface for debugging purposes Nicolas Pitre
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=20130725105528.GA2546@localhost.localdomain \
--to=dave.martin@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).