Skip to content

Commit

Permalink
Merge branch 'x86/numa' into x86/devel
Browse files Browse the repository at this point in the history
Conflicts:

	arch/x86/Kconfig
	arch/x86/kernel/e820.c
	arch/x86/kernel/efi_64.c
	arch/x86/kernel/mpparse.c
	arch/x86/kernel/setup.c
	arch/x86/kernel/setup_32.c
	arch/x86/mm/init_64.c
	include/asm-x86/proto.h

Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Ingo Molnar committed Jul 8, 2008
2 parents 3de352b + 46f68e1 commit 2b4fa85
Show file tree
Hide file tree
Showing 22 changed files with 611 additions and 278 deletions.
35 changes: 31 additions & 4 deletions arch/x86/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ config ARCH_HAS_CACHE_LINE_SIZE
def_bool y

config HAVE_SETUP_PER_CPU_AREA
def_bool X86_64 || (X86_SMP && !X86_VOYAGER)
def_bool X86_64_SMP || (X86_SMP && !X86_VOYAGER)

config HAVE_CPUMASK_OF_CPU_MAP
def_bool X86_64_SMP
Expand Down Expand Up @@ -579,7 +579,21 @@ config SWIOTLB

config IOMMU_HELPER
def_bool (CALGARY_IOMMU || GART_IOMMU || SWIOTLB)
config MAXSMP
bool "Configure Maximum number of SMP Processors and NUMA Nodes"
depends on X86_64 && SMP
default n
help
Configure maximum number of CPUS and NUMA Nodes for this architecture.
If unsure, say N.

if MAXSMP
config NR_CPUS
int
default "4096"
endif

if !MAXSMP
config NR_CPUS
int "Maximum number of CPUs (2-4096)"
range 2 4096
Expand All @@ -592,7 +606,8 @@ config NR_CPUS
minimum value which makes sense is 2.

This is purely to save memory - each supported CPU adds
approximately one kilobyte to the kernel image.
approximately eight kilobytes to the kernel image.
endif

config SCHED_SMT
bool "SMT (Hyperthreading) scheduler support"
Expand Down Expand Up @@ -983,13 +998,25 @@ config NUMA_EMU
into virtual nodes when booted with "numa=fake=N", where N is the
number of nodes. This is only useful for debugging.

if MAXSMP

config NODES_SHIFT
int
default "9"
endif

if !MAXSMP
config NODES_SHIFT
int "Max num nodes shift(1-9)"
range 1 9 if X86_64
int "Maximum NUMA Nodes (as a power of 2)"
range 1 9 if X86_64
default "6" if X86_64
default "4" if X86_NUMAQ
default "3"
depends on NEED_MULTIPLE_NODES
help
Specify the maximum number of NUMA Nodes available on the target
system. Increases memory reserved to accomodate various tables.
endif

config HAVE_ARCH_BOOTMEM_NODE
def_bool y
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/Kconfig.debug
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ config DEBUG_PAGEALLOC
config DEBUG_PER_CPU_MAPS
bool "Debug access to per_cpu maps"
depends on DEBUG_KERNEL
depends on X86_64_SMP
depends on X86_SMP
default n
help
Say Y to verify that the per_cpu map being accessed has
Expand Down
9 changes: 3 additions & 6 deletions arch/x86/kernel/apic_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@

unsigned long mp_lapic_addr;

DEFINE_PER_CPU(u16, x86_bios_cpu_apicid) = BAD_APICID;
EXPORT_PER_CPU_SYMBOL(x86_bios_cpu_apicid);

/*
* Knob to control our willingness to enable the local APIC.
*
Expand Down Expand Up @@ -1546,9 +1543,9 @@ void __cpuinit generic_processor_info(int apicid, int version)
}
#ifdef CONFIG_SMP
/* are we being called early in kernel startup? */
if (x86_cpu_to_apicid_early_ptr) {
u16 *cpu_to_apicid = x86_cpu_to_apicid_early_ptr;
u16 *bios_cpu_apicid = x86_bios_cpu_apicid_early_ptr;
if (early_per_cpu_ptr(x86_cpu_to_apicid)) {
u16 *cpu_to_apicid = early_per_cpu_ptr(x86_cpu_to_apicid);
u16 *bios_cpu_apicid = early_per_cpu_ptr(x86_bios_cpu_apicid);

cpu_to_apicid[cpu] = apicid;
bios_cpu_apicid[cpu] = apicid;
Expand Down
11 changes: 4 additions & 7 deletions arch/x86/kernel/apic_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@ static unsigned long apic_phys;

unsigned long mp_lapic_addr;

DEFINE_PER_CPU(u16, x86_bios_cpu_apicid) = BAD_APICID;
EXPORT_PER_CPU_SYMBOL(x86_bios_cpu_apicid);

unsigned int __cpuinitdata maxcpus = NR_CPUS;
/*
* Get the LAPIC version
Expand Down Expand Up @@ -1075,9 +1072,9 @@ void __cpuinit generic_processor_info(int apicid, int version)
max_physical_apicid = apicid;

/* are we being called early in kernel startup? */
if (x86_cpu_to_apicid_early_ptr) {
u16 *cpu_to_apicid = x86_cpu_to_apicid_early_ptr;
u16 *bios_cpu_apicid = x86_bios_cpu_apicid_early_ptr;
if (early_per_cpu_ptr(x86_cpu_to_apicid)) {
u16 *cpu_to_apicid = early_per_cpu_ptr(x86_cpu_to_apicid);
u16 *bios_cpu_apicid = early_per_cpu_ptr(x86_bios_cpu_apicid);

cpu_to_apicid[cpu] = apicid;
bios_cpu_apicid[cpu] = apicid;
Expand Down Expand Up @@ -1253,7 +1250,7 @@ __cpuinit int apic_is_clustered_box(void)
if ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD) && !is_vsmp_box())
return 0;

bios_cpu_apicid = x86_bios_cpu_apicid_early_ptr;
bios_cpu_apicid = early_per_cpu_ptr(x86_bios_cpu_apicid);
bitmap_zero(clustermap, NUM_APIC_CLUSTERS);

for (i = 0; i < NR_CPUS; i++) {
Expand Down
22 changes: 19 additions & 3 deletions arch/x86/kernel/head64.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@
#include <asm/e820.h>
#include <asm/bios_ebda.h>

/* boot cpu pda */
static struct x8664_pda _boot_cpu_pda __read_mostly;

#ifdef CONFIG_SMP
/*
* We install an empty cpu_pda pointer table to indicate to early users
* (numa_set_node) that the cpu_pda pointer table for cpus other than
* the boot cpu is not yet setup.
*/
static struct x8664_pda *__cpu_pda[NR_CPUS] __initdata;
#else
static struct x8664_pda *__cpu_pda[NR_CPUS] __read_mostly;
#endif

static void __init zap_identity_mappings(void)
{
pgd_t *pgd = pgd_offset_k(0UL);
Expand Down Expand Up @@ -88,10 +102,12 @@ void __init x86_64_start_kernel(char * real_mode_data)

early_printk("Kernel alive\n");

for (i = 0; i < NR_CPUS; i++)
cpu_pda(i) = &boot_cpu_pda[i];

_cpu_pda = __cpu_pda;
cpu_pda(0) = &_boot_cpu_pda;
pda_init(0);

early_printk("Kernel really alive\n");

copy_bootdata(__va(real_mode_data));

reserve_early(__pa_symbol(&_text), __pa_symbol(&_end), "TEXT DATA BSS");
Expand Down
4 changes: 2 additions & 2 deletions arch/x86/kernel/nmi_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ int __init check_nmi_watchdog(void)
if (!atomic_read(&nmi_active))
return 0;

prev_nmi_count = kmalloc(NR_CPUS * sizeof(int), GFP_KERNEL);
prev_nmi_count = kmalloc(nr_cpu_ids * sizeof(int), GFP_KERNEL);
if (!prev_nmi_count)
goto error;

Expand All @@ -101,7 +101,7 @@ int __init check_nmi_watchdog(void)
smp_call_function(nmi_cpu_busy, (void *)&endflag, 0, 0);
#endif

for (cpu = 0; cpu < NR_CPUS; cpu++)
for (cpu = 0; cpu < nr_cpu_ids; cpu++)
prev_nmi_count[cpu] = cpu_pda(cpu)->__nmi_count;
local_irq_enable();
mdelay((20*1000)/nmi_hz); // wait 20 ticks
Expand Down
Loading

0 comments on commit 2b4fa85

Please sign in to comment.