Re: [PATCH v2 5/6] msm: hotplug: support cpu hotplug on msm

Russell King - ARM Linux
2010-12-08T15:23:52Z

On Tue, Dec 07, 2010 at 08:28:20PM -0800, Jeff Ohlstein wrote:
> +static inline void cpu_enter_lowpower(void)
> +{
> + flush_cache_all();
> +}
> +
> +static inline void cpu_leave_lowpower(void)
> +{
> + pen_release = -1;
> + smp_wmb();
> +}
> +
> +static inline void platform_do_lowpower(unsigned int cpu)
> +{
> + /* Just enter wfe for now. */
> + for (;;) {
> + asm("wfe");
> + if (pen_release == cpu) {
> + /*
> + * OK, proper wakeup, we're done
> + */
> + break;
> + }
> + smp_rmb();
> +
> + /*
> + * getting here, means that we have come out of WFI without
> + * having been woken up - this shouldn't happen
> + *
> + * The trouble is, letting people know about this is not really
> + * possible, since we are currently running incoherently, and
> + * therefore cannot safely call printk() or anything else
> + */
> + pr_debug("CPU%u: spurious wakeup call\n", cpu);
> + }
> +}

BTW, just because Realview and Versatile Express implement their hotplug
CPU tihs way, does not mean that you have to as well. If you can put the
CPU to sleep properly without keeping it in the kernel, that would be far
more preferable, than having platform_cpu_die() return on hot-plugging.