linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/5] msm: timer: SMP timer support for msm
Date: Mon, 20 Dec 2010 12:21:28 +0000	[thread overview]
Message-ID: <20101220122128.GD28157@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <20101207081701.GA18336@n2100.arm.linux.org.uk>

On Tue, Dec 07, 2010 at 08:17:01AM +0000, Russell King - ARM Linux wrote:
> On Mon, Dec 06, 2010 at 10:56:14AM +0100, Thomas Gleixner wrote:
> > On Sun, 5 Dec 2010, Jeff Ohlstein wrote:
> > > +#ifdef CONFIG_HOTPLUG_CPU
> > > +void __cpuexit local_timer_stop(void)
> > > +{
> > > +	local_clock_event->set_mode(CLOCK_EVT_MODE_SHUTDOWN, local_clock_event);
> > 
> > Aarg. No. The generic code already handles cpu hotplug. 
> 
> Can you show where this is handled by the generic code?  I can't find
> where this is handled.

Having checked this on Versatile Express with a printk in the ->set_mode
callback, the generic code does not handle shutting down clock event
devices on CPU hot-unplug.

I've analyzed why this is:

The hrtimer() code hooks into the hotplug notifier list, and when it
receives a CPU_DEAD or CPU_DEAD_FROZEN message, it calls 
clockevents_notify(CLOCK_EVT_NOTIFY_CPU_DEAD).

The clockevents code calls its own notifier list, which ultimately calls
tick_notify().  This eventually calls tick_shutdown().

tick_shutdown() looks up the per-cpu tick device, uncouples the clock
event device from the tick device, and sets the clock event device mode
to CLOCK_EVT_MODE_UNUSED.  Note this comment:

                /*
                 * Prevent that the clock events layer tries to call
                 * the set mode function!
                 */
                dev->mode = CLOCK_EVT_MODE_UNUSED;

translating that into English:

	"Prevent the clock events layer calling the set_mode function"

That might be it - to confirm:

It then calls clockevents_exchange_device(dev, NULL).

clockevents_exchange_device(old,new) calls
clockevents_set_mode(old, CLOCK_EVT_MODE_UNUSED), which then does:

        if (dev->mode != mode) {

However, as dev->mode was set to CLOCK_EVT_MODE_UNUSED, and mode is
CLOCK_EVT_MODE_UNUSED, we don't call into the code which supplies the
clock event device at all, leaving it with no way to fully shutdown
its hardware.  It seems this is done on purpose, though it's not clear
why.

This is why arch code, such as ARM, has to implement its own solution
to shutdown clock event devices external to the generic clockevents code.
Until we have a generic solution, I think I'm going to take the above
code extract into the ARM generic local timer code and kill off the
local_timer_stop() function.

  reply	other threads:[~2010-12-20 12:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-06  7:16 [PATCH 0/5] SMP support for msm Jeff Ohlstein
2010-12-06  7:16 ` [PATCH 1/5] msm: Secure Channel Manager (SCM) support Jeff Ohlstein
2010-12-06 20:00   ` Valdis.Kletnieks at vt.edu
2010-12-06 20:52     ` Russell King - ARM Linux
2010-12-15  7:48   ` Pavel Machek
2010-12-15 14:05     ` David Brown
2010-12-15 16:07       ` Russell King - ARM Linux
2010-12-06  7:16 ` [PATCH 2/5] msm: scm-boot: Support for setting cold/warm boot addresses Jeff Ohlstein
2010-12-06  7:16 ` [PATCH 3/5] msm: timer: SMP timer support for msm Jeff Ohlstein
2010-12-06  9:56   ` Thomas Gleixner
2010-12-06 10:20     ` Russell King - ARM Linux
2010-12-06 11:11       ` Thomas Gleixner
2010-12-07  4:49     ` Jeff Ohlstein
2010-12-07  8:17     ` Russell King - ARM Linux
2010-12-20 12:21       ` Russell King - ARM Linux [this message]
2010-12-06  7:16 ` [PATCH 4/5] msm: hotplug: support cpu hotplug on msm Jeff Ohlstein
2010-12-06  7:16 ` [PATCH 5/5] msm: add SMP support for msm Jeff Ohlstein

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=20101220122128.GD28157@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --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).