All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: mingo@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org,
	rusty@rustcorp.com.au, peterz@infradead.org,
	srivatsa.bhat@linux.vnet.ibm.com, paulmck@linux.vnet.ibm.com,
	tglx@linutronix.de
Cc: linux-tip-commits@vger.kernel.org
Subject: Re: [tip:smp/hotplug] powerpc: Use generic idle thread allocation
Date: Sun, 29 Apr 2012 08:51:46 +1000	[thread overview]
Message-ID: <1335653506.20866.16.camel@pasglop> (raw)
In-Reply-To: <tip-17e32eacc3543c25a4377bb7ce54026e38db7d20@git.kernel.org>

On Sat, 2012-04-28 at 02:07 -0700, tip-bot for Thomas Gleixner wrote:
> Commit-ID:  17e32eacc3543c25a4377bb7ce54026e38db7d20
> Gitweb:     http://git.kernel.org/tip/17e32eacc3543c25a4377bb7ce54026e38db7d20
> Author:     Thomas Gleixner <tglx@linutronix.de>
> AuthorDate: Fri, 20 Apr 2012 13:05:48 +0000
> Committer:  Thomas Gleixner <tglx@linutronix.de>
> CommitDate: Thu, 26 Apr 2012 12:06:10 +0200
> 
> powerpc: Use generic idle thread allocation

Ah good, sorry I missed the previous batch. This is the logical
next step after I changed us to do the same as x86 :)

I'll give it a spin tomorrow (monday my time).

Cheers,
Ben.

> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Rusty Russell <rusty@rustcorp.com.au>
> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> Cc: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Link: http://lkml.kernel.org/r/20120420124557.311212868@linutronix.de
> ---
>  arch/powerpc/Kconfig      |    1 +
>  arch/powerpc/kernel/smp.c |   74 +++-----------------------------------------
>  2 files changed, 6 insertions(+), 69 deletions(-)
> 
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index feab3ba..c815535 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -144,6 +144,7 @@ config PPC
>  	select HAVE_BPF_JIT if (PPC64 && NET)
>  	select HAVE_ARCH_JUMP_LABEL
>  	select ARCH_HAVE_NMI_SAFE_CMPXCHG
> +	select GENERIC_SMP_IDLE_THREAD
>  
>  config EARLY_PRINTK
>  	bool
> diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
> index d38030f..e4cb343 100644
> --- a/arch/powerpc/kernel/smp.c
> +++ b/arch/powerpc/kernel/smp.c
> @@ -57,27 +57,9 @@
>  #define DBG(fmt...)
>  #endif
>  
> -
> -/* Store all idle threads, this can be reused instead of creating
> -* a new thread. Also avoids complicated thread destroy functionality
> -* for idle threads.
> -*/
>  #ifdef CONFIG_HOTPLUG_CPU
> -/*
> - * Needed only for CONFIG_HOTPLUG_CPU because __cpuinitdata is
> - * removed after init for !CONFIG_HOTPLUG_CPU.
> - */
> -static DEFINE_PER_CPU(struct task_struct *, idle_thread_array);
> -#define get_idle_for_cpu(x)      (per_cpu(idle_thread_array, x))
> -#define set_idle_for_cpu(x, p)   (per_cpu(idle_thread_array, x) = (p))
> -
>  /* State of each CPU during hotplug phases */
>  static DEFINE_PER_CPU(int, cpu_state) = { 0 };
> -
> -#else
> -static struct task_struct *idle_thread_array[NR_CPUS] __cpuinitdata ;
> -#define get_idle_for_cpu(x)      (idle_thread_array[(x)])
> -#define set_idle_for_cpu(x, p)   (idle_thread_array[(x)] = (p))
>  #endif
>  
>  struct thread_info *secondary_ti;
> @@ -429,57 +411,16 @@ int generic_check_cpu_restart(unsigned int cpu)
>  }
>  #endif
>  
> -struct create_idle {
> -	struct work_struct work;
> -	struct task_struct *idle;
> -	struct completion done;
> -	int cpu;
> -};
> -
> -static void __cpuinit do_fork_idle(struct work_struct *work)
> +static void cpu_idle_thread_init(unsigned int cpu, struct task_struct *idle)
>  {
> -	struct create_idle *c_idle =
> -		container_of(work, struct create_idle, work);
> -
> -	c_idle->idle = fork_idle(c_idle->cpu);
> -	complete(&c_idle->done);
> -}
> -
> -static int __cpuinit create_idle(unsigned int cpu)
> -{
> -	struct thread_info *ti;
> -	struct create_idle c_idle = {
> -		.cpu	= cpu,
> -		.done	= COMPLETION_INITIALIZER_ONSTACK(c_idle.done),
> -	};
> -	INIT_WORK_ONSTACK(&c_idle.work, do_fork_idle);
> -
> -	c_idle.idle = get_idle_for_cpu(cpu);
> -
> -	/* We can't use kernel_thread since we must avoid to
> -	 * reschedule the child. We use a workqueue because
> -	 * we want to fork from a kernel thread, not whatever
> -	 * userspace process happens to be trying to online us.
> -	 */
> -	if (!c_idle.idle) {
> -		schedule_work(&c_idle.work);
> -		wait_for_completion(&c_idle.done);
> -	} else
> -		init_idle(c_idle.idle, cpu);
> -	if (IS_ERR(c_idle.idle)) {		
> -		pr_err("Failed fork for CPU %u: %li", cpu, PTR_ERR(c_idle.idle));
> -		return PTR_ERR(c_idle.idle);
> -	}
> -	ti = task_thread_info(c_idle.idle);
> +	struct thread_info *ti = task_thread_info(idle);
>  
>  #ifdef CONFIG_PPC64
> -	paca[cpu].__current = c_idle.idle;
> +	paca[cpu].__current = idle;
>  	paca[cpu].kstack = (unsigned long)ti + THREAD_SIZE - STACK_FRAME_OVERHEAD;
>  #endif
>  	ti->cpu = cpu;
> -	current_set[cpu] = ti;
> -
> -	return 0;
> +	secondary_ti = current_set[cpu] = ti;
>  }
>  
>  int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle)
> @@ -490,12 +431,7 @@ int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle)
>  	    (smp_ops->cpu_bootable && !smp_ops->cpu_bootable(cpu)))
>  		return -EINVAL;
>  
> -	/* Make sure we have an idle thread */
> -	rc = create_idle(cpu);
> -	if (rc)
> -		return rc;
> -
> -	secondary_ti = current_set[cpu];
> +	cpu_idle_thread_init(cpu, tidle);
>  
>  	/* Make sure callin-map entry is 0 (can be leftover a CPU
>  	 * hotplug
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/



  reply	other threads:[~2012-04-28 22:52 UTC|newest]

Thread overview: 87+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-20 13:05 [patch 00/18] SMP: Boot and CPU hotplug refactoring - Part 1 Thomas Gleixner
2012-04-20 13:05 ` [patch 01/18] m32r: Remove pointless function prototypes Thomas Gleixner
2012-04-28  9:01   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-04-20 13:05 ` [patch 02/18] smp: Add task_struct argument to __cpu_up() Thomas Gleixner
2012-04-20 13:05   ` Thomas Gleixner
2012-04-23  7:58   ` Jesper Nilsson
2012-04-23  7:58     ` Jesper Nilsson
2012-04-28  9:02   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-04-20 13:05 ` [patch 03/18] smp: Add generic smpboot facility Thomas Gleixner
2012-04-20 13:05   ` Thomas Gleixner
2012-04-20 20:07   ` Yinghai Lu
2012-04-20 20:07     ` Yinghai Lu
2012-04-21  2:07   ` Stephen Rothwell
2012-04-21  2:07     ` Stephen Rothwell
2012-04-28  9:04   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-04-20 13:05 ` [patch 04/18] smp: Provide generic idle thread allocation Thomas Gleixner
2012-04-20 13:05   ` Thomas Gleixner
2012-04-20 16:21   ` Sam Ravnborg
2012-04-20 16:21     ` Sam Ravnborg
2012-04-20 18:55     ` Thomas Gleixner
2012-04-20 18:55       ` Thomas Gleixner
2012-04-21  2:20   ` Stephen Rothwell
2012-04-21  2:20     ` Stephen Rothwell
2012-04-21  2:25   ` Frank Rowand
2012-04-21  2:25     ` Frank Rowand
2012-04-28  9:05   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-04-20 13:05 ` [patch 05/18] x86: Add task_struct argument to smp_ops.cpu_up Thomas Gleixner
2012-04-28  9:05   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-04-20 13:05 ` [patch 06/18] x86: Use generic idle thread allocation Thomas Gleixner
2012-04-28  9:06   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-04-20 13:05 ` [patch 07/18] powerpc: " Thomas Gleixner
2012-04-28  9:07   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-04-28 22:51     ` Benjamin Herrenschmidt [this message]
2012-04-20 13:05 ` [patch 08/18] ia64: " Thomas Gleixner
2012-04-28  9:08   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-04-20 13:05 ` [patch 09/18] arm: " Thomas Gleixner
2012-04-28  9:09   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-04-20 13:05 ` [patch 11/18] hexagon: " Thomas Gleixner
2012-04-24 16:47   ` Richard Kuo
2012-04-28  9:10   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-04-20 13:05 ` [patch 10/18] mips: " Thomas Gleixner
2012-04-28  9:10   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-04-20 13:05 ` [patch 12/18] s390: " Thomas Gleixner
2012-04-23  7:09   ` Martin Schwidefsky
2012-04-28  9:11   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-04-20 13:05 ` [patch 13/18] blackfin: " Thomas Gleixner
2012-04-28  9:13   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-04-20 13:05 ` [patch 14/18] cris: " Thomas Gleixner
2012-04-23  7:57   ` Jesper Nilsson
2012-04-28  9:12   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-04-20 13:05 ` [patch 15/18] sh: " Thomas Gleixner
2012-04-21  3:18   ` Paul Mundt
2012-04-28  9:14   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-04-20 13:05 ` [patch 16/18] alpha: " Thomas Gleixner
2012-04-28  9:15   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-04-20 13:05 ` [patch 17/18] parisc: " Thomas Gleixner
2012-04-28  9:16   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-04-20 13:05 ` [patch 18/18] sparc: " Thomas Gleixner
2012-04-22 19:52   ` David Miller
2012-04-28  9:15   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-04-20 13:16 ` [patch 00/18] SMP: Boot and CPU hotplug refactoring - Part 1 Thomas Gleixner
2012-04-20 13:21 ` Peter Zijlstra
2012-04-20 13:47   ` Thomas Gleixner
2012-04-21  0:08     ` Suresh Siddha
2012-05-03  9:41       ` Thomas Gleixner
2012-05-03 23:42         ` Suresh Siddha
2012-05-03 17:43       ` [tip:smp/hotplug] smp, idle: Allocate idle thread for each possible cpu during boot tip-bot for Suresh Siddha
2012-04-20 15:42   ` [patch 00/18] SMP: Boot and CPU hotplug refactoring - Part 1 Tejun Heo
2012-04-20 15:49     ` Peter Zijlstra
2012-04-20 15:56       ` Thomas Gleixner
2012-04-20 13:56 ` Srivatsa S. Bhat
2012-04-20 14:18   ` Thomas Gleixner
2012-04-24 18:44     ` Konrad Rzeszutek Wilk
2012-05-21  1:42     ` Rusty Russell
2012-05-21  8:25       ` Thomas Gleixner
2012-05-22  0:53         ` Rusty Russell
2012-04-20 14:06 ` richard -rw- weinberger
2012-04-20 14:19   ` Thomas Gleixner
2012-04-20 14:27 ` James Bottomley
2012-04-20 17:55 ` Paul E. McKenney
2012-04-20 23:11 ` Venki Pallipadi
2012-04-21  1:04 ` Frank Rowand
2012-04-21  1:55   ` Frank Rowand
2012-04-22 21:01 ` Chris Metcalf
2012-04-22 21:01   ` Chris Metcalf
2012-04-22 21:01   ` Chris Metcalf
2012-04-30  8:05 ` Santosh Shilimkar

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=1335653506.20866.16.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=rusty@rustcorp.com.au \
    --cc=srivatsa.bhat@linux.vnet.ibm.com \
    --cc=tglx@linutronix.de \
    --subject='Re: [tip:smp/hotplug] powerpc: Use generic idle thread allocation' \
    /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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.