LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: linuxppc-dev@ozlabs.org
Subject: [RFC] cpu hotplug in powermac g5
Date: Wed, 21 Jun 2006 01:22:49 +0200	[thread overview]
Message-ID: <1150845770.16662.7.camel@johannes> (raw)

The following patch seems to make cpu hotplugging mostly work on my quad
powermac G5. The first part (platforms/powermac/smp.c) actually plugs in
the right functions after which it already works, but the CPUs get
warmer when offline than when online and idle.

The modification in powerpc/kernel/smp.c makes the generic cpu die
routine also do more power saving just like the idle loop. I have no
idea if it is correct.

There do seem to be some bugs with this, once a while I get a soft
lockup detected but I can't figure out why/when it happened. Other than
that, I can online/offline CPUs at will with this patch.

--- linux-2.6-git.orig/arch/powerpc/platforms/powermac/smp.c	2006-06-20 23:23:17.731573780 +0200
+++ linux-2.6-git/arch/powerpc/platforms/powermac/smp.c	2006-06-21 00:20:47.189942635 +0200
@@ -905,8 +905,15 @@ struct smp_ops_t core99_smp_ops = {
 	.setup_cpu	= smp_core99_setup_cpu,
 	.give_timebase	= smp_core99_give_timebase,
 	.take_timebase	= smp_core99_take_timebase,
-#if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PPC32)
+#if defined(CONFIG_HOTPLUG_CPU)
+# if defined(CONFIG_PPC32)
 	.cpu_disable	= smp_core99_cpu_disable,
 	.cpu_die	= smp_core99_cpu_die,
+# endif
+# if defined(CONFIG_PPC64)
+	.cpu_disable	= generic_cpu_disable,
+	.cpu_die	= generic_cpu_die,
+	.cpu_enable	= generic_cpu_enable,
+# endif
 #endif
 };
--- linux-2.6-git.orig/arch/powerpc/kernel/smp.c	2006-06-21 01:15:42.183256221 +0200
+++ linux-2.6-git/arch/powerpc/kernel/smp.c	2006-06-21 01:15:44.879231957 +0200
@@ -441,8 +441,16 @@ void generic_mach_cpu_die(void)
 	printk(KERN_DEBUG "CPU%d offline\n", cpu);
 	__get_cpu_var(cpu_state) = CPU_DEAD;
 	smp_wmb();
-	while (__get_cpu_var(cpu_state) != CPU_UP_PREPARE)
-		cpu_relax();
+	while (__get_cpu_var(cpu_state) != CPU_UP_PREPARE) {
+		if (ppc_md.power_save) {
+			/* need we do more? what about TIF_POLLING_NRFLAG? */
+			ppc_md.power_save();
+		} else {
+			HMT_low();
+			HMT_very_low();
+		}
+		HMT_medium(); /* should be after loop? */
+	}
 
 #ifdef CONFIG_PPC64
 	flush_tlb_pending();

             reply	other threads:[~2006-06-21 11:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-20 23:22 Johannes Berg [this message]
2006-06-23 10:03 ` [RFC] cpu hotplug in powermac g5 Johannes Berg

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=1150845770.16662.7.camel@johannes \
    --to=johannes@sipsolutions.net \
    --cc=linuxppc-dev@ozlabs.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