linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: linux-arch@vger.kernel.org, Peter Zijlstra <peterz@infradead.org>,
	Rusty Russell <rusty@rustcorp.com.au>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Ingo Molnar <mingo@kernel.org>,
	"Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: [patch 18/18] sparc: Use generic idle thread allocation
Date: Fri, 20 Apr 2012 13:05:56 -0000	[thread overview]
Message-ID: <20120420124558.055198736@linutronix.de> (raw)
In-Reply-To: 20120420122120.097464672@linutronix.de

[-- Attachment #1: sparc-use-generic-idle-thread-allocation.patch --]
[-- Type: text/plain, Size: 6437 bytes --]

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: "David S. Miller" <davem@davemloft.net>
---
 arch/sparc/Kconfig            |    1 +
 arch/sparc/include/asm/leon.h |    5 +++--
 arch/sparc/kernel/leon_smp.c  |    9 ++-------
 arch/sparc/kernel/smp_32.c    |   10 +++++-----
 arch/sparc/kernel/smp_64.c    |   10 +++-------
 arch/sparc/kernel/sun4d_smp.c |    8 ++------
 arch/sparc/kernel/sun4m_smp.c |    7 ++-----
 7 files changed, 18 insertions(+), 32 deletions(-)

Index: linux-2.6/arch/sparc/Kconfig
===================================================================
--- linux-2.6.orig/arch/sparc/Kconfig
+++ linux-2.6/arch/sparc/Kconfig
@@ -30,6 +30,7 @@ config SPARC
 	select USE_GENERIC_SMP_HELPERS if SMP
 	select GENERIC_PCI_IOMAP
 	select HAVE_NMI_WATCHDOG if SPARC64
+	select GENERIC_SMP_IDLE_THREAD
 
 config SPARC32
 	def_bool !64BIT
Index: linux-2.6/arch/sparc/include/asm/leon.h
===================================================================
--- linux-2.6.orig/arch/sparc/include/asm/leon.h
+++ linux-2.6/arch/sparc/include/asm/leon.h
@@ -315,6 +315,7 @@ struct leon2_cacheregs {
 #include <linux/interrupt.h>
 
 struct device_node;
+struct task_struct;
 extern unsigned int leon_build_device_irq(unsigned int real_irq,
 					   irq_flow_handler_t flow_handler,
 					   const char *name, int do_ack);
@@ -344,7 +345,7 @@ extern int leon_smp_nrcpus(void);
 extern void leon_clear_profile_irq(int cpu);
 extern void leon_smp_done(void);
 extern void leon_boot_cpus(void);
-extern int leon_boot_one_cpu(int i);
+extern int leon_boot_one_cpu(int i, struct task_struct *);
 void leon_init_smp(void);
 extern void cpu_idle(void);
 extern void init_IRQ(void);
@@ -380,7 +381,7 @@ extern int leon_ipi_irq;
 #define init_leon() do {} while (0)
 #define leon_smp_done() do {} while (0)
 #define leon_boot_cpus() do {} while (0)
-#define leon_boot_one_cpu(i) 1
+#define leon_boot_one_cpu(i, t) 1
 #define leon_init_smp() do {} while (0)
 
 #endif /* !defined(CONFIG_SPARC_LEON) */
Index: linux-2.6/arch/sparc/kernel/leon_smp.c
===================================================================
--- linux-2.6.orig/arch/sparc/kernel/leon_smp.c
+++ linux-2.6/arch/sparc/kernel/leon_smp.c
@@ -201,16 +201,11 @@ void __init leon_boot_cpus(void)
 
 }
 
-int __cpuinit leon_boot_one_cpu(int i)
+int __cpuinit leon_boot_one_cpu(int i, struct task_struct *idle)
 {
-
-	struct task_struct *p;
 	int timeout;
 
-	/* Cook up an idler for this guy. */
-	p = fork_idle(i);
-
-	current_set[i] = task_thread_info(p);
+	current_set[i] = task_thread_info(idle);
 
 	/* See trampoline.S:leon_smp_cpu_startup for details...
 	 * Initialize the contexts table
Index: linux-2.6/arch/sparc/kernel/smp_32.c
===================================================================
--- linux-2.6.orig/arch/sparc/kernel/smp_32.c
+++ linux-2.6/arch/sparc/kernel/smp_32.c
@@ -413,8 +413,8 @@ void __init smp_prepare_boot_cpu(void)
 
 int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle)
 {
-	extern int __cpuinit smp4m_boot_one_cpu(int);
-	extern int __cpuinit smp4d_boot_one_cpu(int);
+	extern int __cpuinit smp4m_boot_one_cpu(int, struct task_struct *);
+	extern int __cpuinit smp4d_boot_one_cpu(int, struct task_struct *);
 	int ret=0;
 
 	switch(sparc_cpu_model) {
@@ -427,13 +427,13 @@ int __cpuinit __cpu_up(unsigned int cpu,
 		BUG();
 		break;
 	case sun4m:
-		ret = smp4m_boot_one_cpu(cpu);
+		ret = smp4m_boot_one_cpu(cpu, tidle);
 		break;
 	case sun4d:
-		ret = smp4d_boot_one_cpu(cpu);
+		ret = smp4d_boot_one_cpu(cpu, tidle);
 		break;
 	case sparc_leon:
-		ret = leon_boot_one_cpu(cpu);
+		ret = leon_boot_one_cpu(cpu, tidle);
 		break;
 	case sun4e:
 		printk("SUN4E\n");
Index: linux-2.6/arch/sparc/kernel/smp_64.c
===================================================================
--- linux-2.6.orig/arch/sparc/kernel/smp_64.c
+++ linux-2.6/arch/sparc/kernel/smp_64.c
@@ -343,21 +343,17 @@ extern unsigned long sparc64_cpu_startup
  */
 static struct thread_info *cpu_new_thread = NULL;
 
-static int __cpuinit smp_boot_one_cpu(unsigned int cpu)
+static int __cpuinit smp_boot_one_cpu(unsigned int cpu, struct task_struct *idle)
 {
 	unsigned long entry =
 		(unsigned long)(&sparc64_cpu_startup);
 	unsigned long cookie =
 		(unsigned long)(&cpu_new_thread);
-	struct task_struct *p;
 	void *descr = NULL;
 	int timeout, ret;
 
-	p = fork_idle(cpu);
-	if (IS_ERR(p))
-		return PTR_ERR(p);
 	callin_flag = 0;
-	cpu_new_thread = task_thread_info(p);
+	cpu_new_thread = task_thread_info(idle);
 
 	if (tlb_type == hypervisor) {
 #if defined(CONFIG_SUN_LDOMS) && defined(CONFIG_HOTPLUG_CPU)
@@ -1229,7 +1225,7 @@ void __devinit smp_fill_in_sib_core_maps
 
 int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle)
 {
-	int ret = smp_boot_one_cpu(cpu);
+	int ret = smp_boot_one_cpu(cpu, tidle);
 
 	if (!ret) {
 		cpumask_set_cpu(cpu, &smp_commenced_mask);
Index: linux-2.6/arch/sparc/kernel/sun4d_smp.c
===================================================================
--- linux-2.6.orig/arch/sparc/kernel/sun4d_smp.c
+++ linux-2.6/arch/sparc/kernel/sun4d_smp.c
@@ -127,18 +127,14 @@ void __init smp4d_boot_cpus(void)
 	local_flush_cache_all();
 }
 
-int __cpuinit smp4d_boot_one_cpu(int i)
+int __cpuinit smp4d_boot_one_cpu(int i, struct task_struct *idle)
 {
 	unsigned long *entry = &sun4d_cpu_startup;
-	struct task_struct *p;
 	int timeout;
 	int cpu_node;
 
 	cpu_find_by_instance(i, &cpu_node, NULL);
-	/* Cook up an idler for this guy. */
-	p = fork_idle(i);
-	current_set[i] = task_thread_info(p);
-
+	current_set[i] = task_thread_info(idle);
 	/*
 	 * Initialize the contexts table
 	 * Since the call to prom_startcpu() trashes the structure,
Index: linux-2.6/arch/sparc/kernel/sun4m_smp.c
===================================================================
--- linux-2.6.orig/arch/sparc/kernel/sun4m_smp.c
+++ linux-2.6/arch/sparc/kernel/sun4m_smp.c
@@ -91,18 +91,15 @@ void __init smp4m_boot_cpus(void)
 	local_flush_cache_all();
 }
 
-int __cpuinit smp4m_boot_one_cpu(int i)
+int __cpuinit smp4m_boot_one_cpu(int i, struct task_struct *idle)
 {
 	unsigned long *entry = &sun4m_cpu_startup;
-	struct task_struct *p;
 	int timeout;
 	int cpu_node;
 
 	cpu_find_by_mid(i, &cpu_node);
+	current_set[i] = task_thread_info(idle);
 
-	/* Cook up an idler for this guy. */
-	p = fork_idle(i);
-	current_set[i] = task_thread_info(p);
 	/* See trampoline.S for details... */
 	entry += ((i - 1) * 3);
 

  parent reply	other threads:[~2012-04-20 13:05 UTC|newest]

Thread overview: 82+ 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-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-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-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-20 13:05 ` [patch 05/18] x86: Add task_struct argument to smp_ops.cpu_up Thomas Gleixner
2012-04-20 13:05 ` [patch 06/18] x86: Use generic idle thread allocation Thomas Gleixner
2012-04-20 13:05 ` [patch 07/18] powerpc: " Thomas Gleixner
2012-04-20 13:05   ` Thomas Gleixner
2012-04-20 13:05 ` [patch 08/18] ia64: " Thomas Gleixner
2012-04-20 13:05 ` [patch 09/18] arm: " Thomas Gleixner
2012-04-20 13:05   ` Thomas Gleixner
2012-04-20 13:05 ` [patch 11/18] hexagon: " Thomas Gleixner
2012-04-20 13:05   ` Thomas Gleixner
2012-04-24 16:47   ` Richard Kuo
2012-04-24 16:47     ` Richard Kuo
2012-04-20 13:05 ` [patch 10/18] mips: " Thomas Gleixner
2012-04-20 13:05   ` Thomas Gleixner
2012-04-20 13:05 ` [patch 12/18] s390: " Thomas Gleixner
2012-04-20 13:05   ` Thomas Gleixner
2012-04-23  7:09   ` Martin Schwidefsky
2012-04-23  7:09     ` Martin Schwidefsky
2012-04-20 13:05 ` [patch 13/18] blackfin: " Thomas Gleixner
2012-04-20 13:05 ` [patch 14/18] cris: " Thomas Gleixner
2012-04-23  7:57   ` Jesper Nilsson
2012-04-23  7:57     ` Jesper Nilsson
2012-04-20 13:05 ` [patch 15/18] sh: " Thomas Gleixner
2012-04-20 13:05   ` Thomas Gleixner
2012-04-21  3:18   ` Paul Mundt
2012-04-20 13:05 ` [patch 16/18] alpha: " Thomas Gleixner
2012-04-20 13:05   ` Thomas Gleixner
2012-04-20 13:05 ` [patch 17/18] parisc: " Thomas Gleixner
2012-04-20 13:05   ` Thomas Gleixner
2012-04-20 13:05 ` Thomas Gleixner [this message]
2012-04-20 13:05   ` [patch 18/18] sparc: " Thomas Gleixner
2012-04-22 19:52   ` David Miller
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  9:41         ` Thomas Gleixner
2012-05-03 23:42         ` Suresh Siddha
2012-04-20 15:42   ` 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-21  8:25         ` Thomas Gleixner
2012-05-22  0:53         ` Rusty Russell
2012-04-20 14:06 ` richard -rw- weinberger
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-30  8:05 ` Santosh Shilimkar
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=20120420124558.055198736@linutronix.de \
    --to=tglx@linutronix.de \
    --cc=davem@davemloft.net \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@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 \
    /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).