LWN.net Logo

New v. v. experimental HOTPLUG CPU megapatch.

From:  Rusty Russell <rusty@rustcorp.com.au>
To:  Ingo Molnar <mingo@elte.hu>
Subject:  New v. v. experimental HOTPLUG CPU megapatch.
Date:  Tue, 03 Feb 2004 18:39:17 +1100
Cc:  akpm@osdl.org, linux-kernel@vger.kernel.org, Nick Piggin <piggin@cyberone.com.au>, dipankar@in.ibm.com

This is my first cut of a patch, still has some old code in it.  As an
attachment since it's 70k (I'll split into multiple parts later, this
is the x86 part, too).

Patch against 2.6.2-rc2-mm2.  Works basically, gives "APIC error on
CPU1: 08(08)" under stress.  Clues welcome.

Basically consists of:

1) New file stop_machine.[ch] which takes logic out of module.c (I
   haven't converted module.c code over yet though).

2) x86: arch_cpu_down_check (called before offlining) and arch_cpu_down
   (called when machine stopped, moves irqs).

3) x86: idle loop code to play dead.

4) migrate_all_tasks() called with machine stopped, and migrates
   kernel threads as well.

5) cpu.c fires off a thread to do the dirty work: it schedules with
   interrupts still disabled on dead cpu. 

6) Most threads are happy to run on "wrong" CPUs, but slab.c reap
   timer needs a little fixing, and still needs to stop when CPU goes
   offline.  softirq threads are tied to CPU: I just hacked in a check
   so the do nothing if CPU is offline.  Moving the migration thread
   is safe since it should have nothing to do.

7) Ugly change to finish_arch_switch so it doesn't re-enable
   interrupts if the CPU is down (switching from take_cpu_down kthread
   to idle task).  __migrate_task() still needs check for cpu down,
   AFAICT.

Given it was about a day's work, I'm happy it works at all...

Cheers,
Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.


Copyright © 2004, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds