Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 3237
b: refs/heads/master
c: 76e4f66
h: refs/heads/master
i:
  3235: 26dd549
v: v3
  • Loading branch information
Ashok Raj authored and Linus Torvalds committed Jun 25, 2005
1 parent 6c6cadd commit bcae910
Show file tree
Hide file tree
Showing 9 changed files with 278 additions and 26 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e6982c671c560da4a0bc5c908cbcbec12bd5991d
refs/heads/master: 76e4f660d9f4c6d1bb473f72be2988c35eaca948
15 changes: 7 additions & 8 deletions trunk/arch/i386/mach-default/topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,11 @@ static int __init topology_init(void)
{
int i;

for (i = 0; i < MAX_NUMNODES; i++) {
if (node_online(i))
arch_register_node(i);
}
for (i = 0; i < NR_CPUS; i++)
if (cpu_possible(i)) arch_register_cpu(i);
for_each_online_node(i)
arch_register_node(i);

for_each_cpu(i)
arch_register_cpu(i);
return 0;
}

Expand All @@ -88,8 +87,8 @@ static int __init topology_init(void)
{
int i;

for (i = 0; i < NR_CPUS; i++)
if (cpu_possible(i)) arch_register_cpu(i);
for_each_cpu(i)
arch_register_cpu(i);
return 0;
}

Expand Down
9 changes: 9 additions & 0 deletions trunk/arch/x86_64/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,15 @@ config NR_CPUS
This is purely to save memory - each supported CPU requires
memory in the static kernel configuration.

config HOTPLUG_CPU
bool "Support for hot-pluggable CPUs (EXPERIMENTAL)"
depends on SMP && HOTPLUG && EXPERIMENTAL
help
Say Y here to experiment with turning CPUs off and on. CPUs
can be controlled through /sys/devices/system/cpu/cpu#.
Say N if you want to disable CPU hotplug.


config HPET_TIMER
bool
default y
Expand Down
29 changes: 29 additions & 0 deletions trunk/arch/x86_64/kernel/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <linux/interrupt.h>
#include <linux/seq_file.h>
#include <linux/module.h>
#include <linux/delay.h>
#include <asm/uaccess.h>
#include <asm/io_apic.h>

Expand Down Expand Up @@ -106,3 +107,31 @@ asmlinkage unsigned int do_IRQ(struct pt_regs *regs)
return 1;
}

#ifdef CONFIG_HOTPLUG_CPU
void fixup_irqs(cpumask_t map)
{
unsigned int irq;
static int warned;

for (irq = 0; irq < NR_IRQS; irq++) {
cpumask_t mask;
if (irq == 2)
continue;

cpus_and(mask, irq_affinity[irq], map);
if (any_online_cpu(mask) == NR_CPUS) {
printk("Breaking affinity for irq %i\n", irq);
mask = map;
}
if (irq_desc[irq].handler->set_affinity)
irq_desc[irq].handler->set_affinity(irq, mask);
else if (irq_desc[irq].action && !(warned++))
printk("Cannot set affinity for irq %i\n", irq);
}

/* That doesn't seem sufficient. Give it 1ms. */
local_irq_enable();
mdelay(1);
local_irq_disable();
}
#endif
29 changes: 28 additions & 1 deletion trunk/arch/x86_64/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
*
* X86-64 port
* Andi Kleen.
*
*
* CPU hotplug support - ashok.raj@intel.com
* $Id: process.c,v 1.38 2002/01/15 10:08:03 ak Exp $
*/

Expand All @@ -18,6 +19,7 @@

#include <stdarg.h>

#include <linux/cpu.h>
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
Expand Down Expand Up @@ -154,6 +156,29 @@ void cpu_idle_wait(void)
}
EXPORT_SYMBOL_GPL(cpu_idle_wait);

#ifdef CONFIG_HOTPLUG_CPU
DECLARE_PER_CPU(int, cpu_state);

#include <asm/nmi.h>
/* We don't actually take CPU down, just spin without interrupts. */
static inline void play_dead(void)
{
idle_task_exit();
wbinvd();
mb();
/* Ack it */
__get_cpu_var(cpu_state) = CPU_DEAD;

while (1)
safe_halt();
}
#else
static inline void play_dead(void)
{
BUG();
}
#endif /* CONFIG_HOTPLUG_CPU */

/*
* The idle thread. There's no useful work to be
* done, so just try to conserve power and have a
Expand All @@ -174,6 +199,8 @@ void cpu_idle (void)
idle = pm_idle;
if (!idle)
idle = default_idle;
if (cpu_is_offline(smp_processor_id()))
play_dead();
idle();
}

Expand Down
Loading

0 comments on commit bcae910

Please sign in to comment.