From 25eff8d4cd7400372d490c392519c5b0064c03f7 Mon Sep 17 00:00:00 2001 From: Yinghai Lu Date: Fri, 1 Feb 2008 17:49:41 +0100 Subject: x86_64: add debug name for early_res helps debugging problems in this rather murky area of code. Signed-off-by: Yinghai Lu Signed-off-by: Ingo Molnar --- arch/x86/kernel/e820_64.c | 15 ++++++++++----- arch/x86/kernel/head64.c | 6 +++--- arch/x86/mm/init_64.c | 2 +- arch/x86/mm/numa_64.c | 2 +- 4 files changed, 15 insertions(+), 10 deletions(-) (limited to 'arch') diff --git a/arch/x86/kernel/e820_64.c b/arch/x86/kernel/e820_64.c index c617174e896..b74e83b214c 100644 --- a/arch/x86/kernel/e820_64.c +++ b/arch/x86/kernel/e820_64.c @@ -54,30 +54,33 @@ static unsigned long __initdata end_user_pfn = MAXMEM>>PAGE_SHIFT; struct early_res { unsigned long start, end; + char name[16]; }; static struct early_res early_res[MAX_EARLY_RES] __initdata = { - { 0, PAGE_SIZE }, /* BIOS data page */ + { 0, PAGE_SIZE, "BIOS data page" }, /* BIOS data page */ #ifdef CONFIG_SMP - { SMP_TRAMPOLINE_BASE, SMP_TRAMPOLINE_BASE + 2*PAGE_SIZE }, + { SMP_TRAMPOLINE_BASE, SMP_TRAMPOLINE_BASE + 2*PAGE_SIZE, "SMP_TRAMPOLINE" }, #endif {} }; -void __init reserve_early(unsigned long start, unsigned long end) +void __init reserve_early(unsigned long start, unsigned long end, char *name) { int i; struct early_res *r; for (i = 0; i < MAX_EARLY_RES && early_res[i].end; i++) { r = &early_res[i]; if (end > r->start && start < r->end) - panic("Overlapping early reservations %lx-%lx to %lx-%lx\n", - start, end, r->start, r->end); + panic("Overlapping early reservations %lx-%lx %s to %lx-%lx %s\n", + start, end - 1, name?name:"", r->start, r->end - 1, r->name); } if (i >= MAX_EARLY_RES) panic("Too many early reservations"); r = &early_res[i]; r->start = start; r->end = end; + if (name) + strncpy(r->name, name, sizeof(r->name) - 1); } void __init early_res_to_bootmem(void) @@ -85,6 +88,8 @@ void __init early_res_to_bootmem(void) int i; for (i = 0; i < MAX_EARLY_RES && early_res[i].end; i++) { struct early_res *r = &early_res[i]; + printk(KERN_INFO "early res: %d [%lx-%lx] %s\n", i, + r->start, r->end - 1, r->name); reserve_bootmem_generic(r->start, r->end - r->start); } } diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c index a317336cdea..24dbf56928d 100644 --- a/arch/x86/kernel/head64.c +++ b/arch/x86/kernel/head64.c @@ -75,7 +75,7 @@ static __init void reserve_ebda(void) if (ebda_size > 64*1024) ebda_size = 64*1024; - reserve_early(ebda_addr, ebda_addr + ebda_size); + reserve_early(ebda_addr, ebda_addr + ebda_size, "EBDA"); } void __init x86_64_start_kernel(char * real_mode_data) @@ -105,14 +105,14 @@ void __init x86_64_start_kernel(char * real_mode_data) pda_init(0); copy_bootdata(__va(real_mode_data)); - reserve_early(__pa_symbol(&_text), __pa_symbol(&_end)); + reserve_early(__pa_symbol(&_text), __pa_symbol(&_end), "TEXT DATA BSS"); /* Reserve INITRD */ if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) { unsigned long ramdisk_image = boot_params.hdr.ramdisk_image; unsigned long ramdisk_size = boot_params.hdr.ramdisk_size; unsigned long ramdisk_end = ramdisk_image + ramdisk_size; - reserve_early(ramdisk_image, ramdisk_end); + reserve_early(ramdisk_image, ramdisk_end, "RAMDISK"); } reserve_ebda(); diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index cc50a13ce8d..9a471be4f5f 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c @@ -420,7 +420,7 @@ void __init_refok init_memory_mapping(unsigned long start, unsigned long end) mmu_cr4_features = read_cr4(); __flush_tlb_all(); - reserve_early(table_start << PAGE_SHIFT, table_end << PAGE_SHIFT); + reserve_early(table_start << PAGE_SHIFT, table_end << PAGE_SHIFT, "PGTABLE"); } #ifndef CONFIG_NUMA diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c index dc3b1f7e145..d3395486608 100644 --- a/arch/x86/mm/numa_64.c +++ b/arch/x86/mm/numa_64.c @@ -103,7 +103,7 @@ static int __init allocate_cachealigned_memnodemap(void) } pad_addr = (nodemap_addr + pad) & ~pad; memnodemap = phys_to_virt(pad_addr); - reserve_early(nodemap_addr, nodemap_addr + nodemap_size); + reserve_early(nodemap_addr, nodemap_addr + nodemap_size, "MEMNODEMAP"); printk(KERN_DEBUG "NUMA: Allocated memnodemap from %lx - %lx\n", nodemap_addr, nodemap_addr + nodemap_size); -- cgit v1.2.3-18-g5258 From 24a5da73f49c17ca88f369b257fef620a494e79d Mon Sep 17 00:00:00 2001 From: Yinghai Lu Date: Fri, 1 Feb 2008 17:49:41 +0100 Subject: x86_64: make bootmap_start page align v6 boot oopses when a system has 64 or 128 GB of RAM installed: Calling initcall 0xffffffff80bc33b6: sctp_init+0x0/0x711() BUG: unable to handle kernel NULL pointer dereference at 000000000000005f IP: [] proc_register+0xe7/0x10f PGD 0 Oops: 0000 [1] SMP CPU 0 Modules linked in: Pid: 1, comm: swapper Not tainted 2.6.24-smp-g5a514e21-dirty #6 RIP: 0010:[] [] proc_register+0xe7/0x10f RSP: 0000:ffff810824c57e60 EFLAGS: 00010246 RAX: 000000000000d7d7 RBX: ffff811024c5fa80 RCX: ffff810824c57e08 RDX: 0000000000000000 RSI: 0000000000000195 RDI: ffffffff80cc2460 RBP: ffffffffffffffff R08: 0000000000000000 R09: ffff811024c5fa80 R10: 0000000000000000 R11: 0000000000000002 R12: ffff810824c57e6c R13: 0000000000000000 R14: ffff810824c57ee0 R15: 00000006abd25bee FS: 0000000000000000(0000) GS:ffffffff80b4d000(0000) knlGS:0000000000000000 CS: 0010 DS: 0018 ES: 0018 CR0: 000000008005003b CR2: 000000000000005f CR3: 0000000000201000 CR4: 00000000000006e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Process swapper (pid: 1, threadinfo ffff810824c56000, task ffff812024c52000) Stack: ffffffff80a57348 0000019500000000 ffff811024c5fa80 0000000000000000 00000000ffffff97 ffffffff802bfef0 0000000000000000 ffffffffffffffff 0000000000000000 ffffffff80bc3b4b ffff810824c57ee0 ffffffff80bc34a5 Call Trace: [] ? create_proc_entry+0x73/0x8a [] ? sctp_snmp_proc_init+0x1c/0x34 [] ? sctp_init+0xef/0x711 [] ? kernel_init+0x175/0x2e1 [] ? child_rip+0xa/0x12 [] ? kernel_init+0x0/0x2e1 [] ? child_rip+0x0/0x12 Code: 1e 48 83 7b 38 00 75 08 48 c7 43 38 f0 e8 82 80 48 83 7b 30 00 75 08 48 c7 43 30 d0 e9 82 80 48 c7 c7 60 24 cc 80 e8 bd 5a 54 00 <48> 8b 45 60 48 89 6b 58 48 89 5d 60 48 89 43 50 fe 05 f5 25 a0 RIP [] proc_register+0xe7/0x10f RSP CR2: 000000000000005f ---[ end trace 02c2d78def82877a ]--- Kernel panic - not syncing: Attempted to kill init! it turns out some variables near end of bss are corrupted already. in System.map we have ffffffff80d40420 b rsi_table ffffffff80d40620 B krb5_seq_lock ffffffff80d40628 b i.20437 ffffffff80d40630 b xprt_rdma_inline_write_padding ffffffff80d40638 b sunrpc_table_header ffffffff80d40640 b zero ffffffff80d40644 b min_memreg ffffffff80d40648 b rpcrdma_tk_lock_g ffffffff80d40650 B sctp_assocs_id_lock ffffffff80d40658 B proc_net_sctp ffffffff80d40660 B sctp_assocs_id ffffffff80d40680 B sysctl_sctp_mem ffffffff80d40690 B sysctl_sctp_rmem ffffffff80d406a0 B sysctl_sctp_wmem ffffffff80d406b0 b sctp_ctl_socket ffffffff80d406b8 b sctp_pf_inet6_specific ffffffff80d406c0 b sctp_pf_inet_specific ffffffff80d406c8 b sctp_af_v4_specific ffffffff80d406d0 b sctp_af_v6_specific ffffffff80d406d8 b sctp_rand.33270 ffffffff80d406dc b sctp_memory_pressure ffffffff80d406e0 b sctp_sockets_allocated ffffffff80d406e4 b sctp_memory_allocated ffffffff80d406e8 b sctp_sysctl_header ffffffff80d406f0 b zero ffffffff80d406f4 A __bss_stop ffffffff80d406f4 A _end and setup_node_bootmem() will use that page 0xd40000 for bootmap Bootmem setup node 0 0000000000000000-0000000828000000 NODE_DATA [000000000008a485 - 0000000000091484] bootmap [0000000000d406f4 - 0000000000e456f3] pages 105 Bootmem setup node 1 0000000828000000-0000001028000000 NODE_DATA [0000000828000000 - 0000000828006fff] bootmap [0000000828007000 - 0000000828106fff] pages 100 Bootmem setup node 2 0000001028000000-0000001828000000 NODE_DATA [0000001028000000 - 0000001028006fff] bootmap [0000001028007000 - 0000001028106fff] pages 100 Bootmem setup node 3 0000001828000000-0000002028000000 NODE_DATA [0000001828000000 - 0000001828006fff] bootmap [0000001828007000 - 0000001828106fff] pages 100 setup_node_bootmem() makes NODE_DATA cacheline aligned, and bootmap is page-aligned. the patch updates find_e820_area() to make sure we can meet the alignment constraints. Signed-off-by: Yinghai Lu Signed-off-by: Ingo Molnar --- arch/x86/kernel/e820_64.c | 8 +++++--- arch/x86/kernel/setup_64.c | 3 ++- arch/x86/mm/init_64.c | 13 ++++--------- arch/x86/mm/numa_64.c | 35 ++++++++++++++++++++--------------- 4 files changed, 31 insertions(+), 28 deletions(-) (limited to 'arch') diff --git a/arch/x86/kernel/e820_64.c b/arch/x86/kernel/e820_64.c index b74e83b214c..9f65b4cc323 100644 --- a/arch/x86/kernel/e820_64.c +++ b/arch/x86/kernel/e820_64.c @@ -171,12 +171,13 @@ int __init e820_all_mapped(unsigned long start, unsigned long end, } /* - * Find a free area in a specific range. + * Find a free area with specified alignment in a specific range. */ unsigned long __init find_e820_area(unsigned long start, unsigned long end, - unsigned size) + unsigned size, unsigned long align) { int i; + unsigned long mask = ~(align - 1); for (i = 0; i < e820.nr_map; i++) { struct e820entry *ei = &e820.map[i]; @@ -190,7 +191,8 @@ unsigned long __init find_e820_area(unsigned long start, unsigned long end, continue; while (bad_addr(&addr, size) && addr+size <= ei->addr+ei->size) ; - last = PAGE_ALIGN(addr) + size; + addr = (addr + align - 1) & mask; + last = addr + size; if (last > ei->addr + ei->size) continue; if (last > end) diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c index 77fb87bf6e5..18df70c534b 100644 --- a/arch/x86/kernel/setup_64.c +++ b/arch/x86/kernel/setup_64.c @@ -182,7 +182,8 @@ contig_initmem_init(unsigned long start_pfn, unsigned long end_pfn) unsigned long bootmap_size, bootmap; bootmap_size = bootmem_bootmap_pages(end_pfn)<> PAGE_SHIFT, end_pfn); diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index 9a471be4f5f..eabcaed76c2 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c @@ -354,17 +354,10 @@ static void __init find_early_table_space(unsigned long end) * need roughly 0.5KB per GB. */ start = 0x8000; - table_start = find_e820_area(start, end, tables); + table_start = find_e820_area(start, end, tables, PAGE_SIZE); if (table_start == -1UL) panic("Cannot find space for the kernel page tables"); - /* - * When you have a lot of RAM like 256GB, early_table will not fit - * into 0x8000 range, find_e820_area() will find area after kernel - * bss but the table_start is not page aligned, so need to round it - * up to avoid overlap with bss: - */ - table_start = round_up(table_start, PAGE_SIZE); table_start >>= PAGE_SHIFT; table_end = table_start; @@ -420,7 +413,9 @@ void __init_refok init_memory_mapping(unsigned long start, unsigned long end) mmu_cr4_features = read_cr4(); __flush_tlb_all(); - reserve_early(table_start << PAGE_SHIFT, table_end << PAGE_SHIFT, "PGTABLE"); + if (!after_bootmem) + reserve_early(table_start << PAGE_SHIFT, + table_end << PAGE_SHIFT, "PGTABLE"); } #ifndef CONFIG_NUMA diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c index d3395486608..9f533deb9da 100644 --- a/arch/x86/mm/numa_64.c +++ b/arch/x86/mm/numa_64.c @@ -84,25 +84,23 @@ static int __init populate_memnodemap(const struct bootnode *nodes, static int __init allocate_cachealigned_memnodemap(void) { - unsigned long pad, pad_addr; + unsigned long addr; memnodemap = memnode.embedded_map; if (memnodemapsize <= ARRAY_SIZE(memnode.embedded_map)) return 0; - pad = L1_CACHE_BYTES - 1; - pad_addr = 0x8000; - nodemap_size = pad + sizeof(s16) * memnodemapsize; - nodemap_addr = find_e820_area(pad_addr, end_pfn<> PAGE_SHIFT; end_pfn = end >> PAGE_SHIFT; - node_data[nodeid] = early_node_mem(nodeid, start, end, pgdat_size); + node_data[nodeid] = early_node_mem(nodeid, start, end, pgdat_size, + SMP_CACHE_BYTES); if (node_data[nodeid] == NULL) return; nodedata_phys = __pa(node_data[nodeid]); @@ -211,8 +212,12 @@ void __init setup_node_bootmem(int nodeid, unsigned long start, /* Find a place for the bootmem map */ bootmap_pages = bootmem_bootmap_pages(end_pfn - start_pfn); bootmap_start = round_up(nodedata_phys + pgdat_size, PAGE_SIZE); + /* + * SMP_CAHCE_BYTES could be enough, but init_bootmem_node like + * to use that to align to PAGE_SIZE + */ bootmap = early_node_mem(nodeid, bootmap_start, end, - bootmap_pages<= end) free_bootmem((unsigned long)node_data[nodeid], -- cgit v1.2.3-18-g5258 From 32ed937d0596e849e1976791e78c006cee8356ca Mon Sep 17 00:00:00 2001 From: Yinghai Lu Date: Fri, 1 Feb 2008 17:49:41 +0100 Subject: x86: fix comments in vmlinux_64.lds for bzImage, the vmlinux_64.lds still have s32 bit code, and startup_32 should be 0. fix the comment. Signed-off-by: Yinghai Lu Signed-off-by: Ingo Molnar --- arch/x86/boot/compressed/vmlinux_64.lds | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch') diff --git a/arch/x86/boot/compressed/vmlinux_64.lds b/arch/x86/boot/compressed/vmlinux_64.lds index f6e5b445f45..7e5c7209f6c 100644 --- a/arch/x86/boot/compressed/vmlinux_64.lds +++ b/arch/x86/boot/compressed/vmlinux_64.lds @@ -3,7 +3,7 @@ OUTPUT_ARCH(i386:x86-64) ENTRY(startup_64) SECTIONS { - /* Be careful parts of head_64.S assume startup_64 is at + /* Be careful parts of head_64.S assume startup_32 is at * address 0. */ . = 0; -- cgit v1.2.3-18-g5258 From 69e97c028b25ef10018d513ead6e7caad276e19f Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Fri, 1 Feb 2008 17:49:41 +0100 Subject: x86: silence section mismatch warning in smpboot_64.c Silence the following warning: WARNING: o-x86_64/arch/x86/kernel/built-in.o(.text+0x17cd3): Section mismatch in reference from the function remove_cpu_from_maps() to the variable .cpuinit.data:cpu_initialized remove_cpu:maps() had a single user: __cpu_disable() so mark it static and annotate it with __ref to silence the warning from modpost. _cpu_disable() has a single user in kernel/cpu.c: => take_cpu_down() which again has a single user in the following call: => __stop_machine_run(take_cpu_down, &tcd_param, cpu); Here a kthread is created. So maybe the warning is correct and the right fix is to remove the __cpuinitdata annotation of cpu_initialized? Note: The analysis were disturbed by the fact that we had a variable with the same name in cpu/common.c - but this is 32 bit only] Note: Should smpboot_64 use cpu_clear()? Signed-off-by: Sam Ravnborg Cc: "H. Peter Anvin" Signed-off-by: Ingo Molnar --- arch/x86/kernel/smpboot_64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch') diff --git a/arch/x86/kernel/smpboot_64.c b/arch/x86/kernel/smpboot_64.c index cc64b8085c2..d53bd6fcb42 100644 --- a/arch/x86/kernel/smpboot_64.c +++ b/arch/x86/kernel/smpboot_64.c @@ -1019,7 +1019,7 @@ static void remove_siblinginfo(int cpu) cpu_clear(cpu, cpu_sibling_setup_map); } -void remove_cpu_from_maps(void) +static void __ref remove_cpu_from_maps(void) { int cpu = smp_processor_id(); -- cgit v1.2.3-18-g5258 From c72258c7c9de448d5ea826ec6b4737eccbaa6718 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Fri, 1 Feb 2008 17:49:42 +0100 Subject: x86: fix section mismatch warnings when referencing notifiers Fix the following warnings: WARNING: arch/x86/kernel/built-in.o(.exit.text+0xf8): Section mismatch in reference from the function msr_exit() to the variable .cpuinit.data:msr_class_cpu_notifier WARNING: arch/x86/kernel/built-in.o(.exit.text+0x158): Section mismatch in reference from the function cpuid_exit() to the variable .cpuinit.data:cpuid_class_cpu_notifier WARNING: arch/x86/kernel/built-in.o(.exit.text+0x171): Section mismatch in reference from the function microcode_exit() to the variable .cpuinit.data:mc_cpu_notifier In all three cases there were a function annotated __exit that referenced a variable annotated __cpuinitdata. The fix was to replace the annotation of the notifier with __refdata to tell modpost that the reference to a _cpuinit function in the notifier are OK. The unregister call that references the notifier variable will simple delete the function pointer so there is no problem ignoring the reference. Note: This looks like another case where __cpuinit has been used as replacement for proper use of CONFIG_HOTPLUG_CPU to decide what code are used for HOTPLUG_CPU. Signed-off-by: Sam Ravnborg Cc: "H. Peter Anvin" Signed-off-by: Ingo Molnar --- arch/x86/kernel/cpuid.c | 2 +- arch/x86/kernel/microcode.c | 2 +- arch/x86/kernel/msr.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'arch') diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c index dec66e45281..a63432d800f 100644 --- a/arch/x86/kernel/cpuid.c +++ b/arch/x86/kernel/cpuid.c @@ -170,7 +170,7 @@ static int __cpuinit cpuid_class_cpu_callback(struct notifier_block *nfb, return err ? NOTIFY_BAD : NOTIFY_OK; } -static struct notifier_block __cpuinitdata cpuid_class_cpu_notifier = +static struct notifier_block __refdata cpuid_class_cpu_notifier = { .notifier_call = cpuid_class_cpu_callback, }; diff --git a/arch/x86/kernel/microcode.c b/arch/x86/kernel/microcode.c index 6ff447f9fda..f2702d01b8a 100644 --- a/arch/x86/kernel/microcode.c +++ b/arch/x86/kernel/microcode.c @@ -797,7 +797,7 @@ mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu) return NOTIFY_OK; } -static struct notifier_block __cpuinitdata mc_cpu_notifier = { +static struct notifier_block __refdata mc_cpu_notifier = { .notifier_call = mc_cpu_callback, }; diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c index 21f6e3c0be1..bd82850e651 100644 --- a/arch/x86/kernel/msr.c +++ b/arch/x86/kernel/msr.c @@ -168,7 +168,7 @@ static int __cpuinit msr_class_cpu_callback(struct notifier_block *nfb, return err ? NOTIFY_BAD : NOTIFY_OK; } -static struct notifier_block __cpuinitdata msr_class_cpu_notifier = { +static struct notifier_block __refdata msr_class_cpu_notifier = { .notifier_call = msr_class_cpu_callback, }; -- cgit v1.2.3-18-g5258 From 009cbadb6e9364e0b006ef6531953c0eced1db4d Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Fri, 1 Feb 2008 17:49:42 +0100 Subject: x86: fix section mismatch warning in acpi/boot.c Fix following warning: WARNING: o-x86_64/arch/x86/kernel/built-in.o(.text+0x13d15): Section mismatch in reference from the function acpi_map_lsapic() to the function .cpuinit.text:mp_register_lapic() The function acpi_map_lsapic() is exported and thus not annotated. But the sole user is acpi/processor_core.c in a __cpuinit path. So create a small wrapper and put back the annotation thus avoiding the warning. Signed-off-by: Sam Ravnborg Signed-off-by: Ingo Molnar --- arch/x86/kernel/acpi/boot.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'arch') diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 0ca27c7b0e8..d2a58431a07 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -496,7 +496,8 @@ EXPORT_SYMBOL(acpi_register_gsi); * ACPI based hotplug support for CPU */ #ifdef CONFIG_ACPI_HOTPLUG_CPU -int acpi_map_lsapic(acpi_handle handle, int *pcpu) + +static int __cpuinit _acpi_map_lsapic(acpi_handle handle, int *pcpu) { struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; union acpi_object *obj; @@ -551,6 +552,11 @@ int acpi_map_lsapic(acpi_handle handle, int *pcpu) return 0; } +/* wrapper to silence section mismatch warning */ +int __ref acpi_map_lsapic(acpi_handle handle, int *pcpu) +{ + return _acpi_map_lsapic(handle, pcpu); +} EXPORT_SYMBOL(acpi_map_lsapic); int acpi_unmap_lsapic(int cpu) -- cgit v1.2.3-18-g5258 From 31f3dff6c536e33f97c8f5049e1dd0a392933265 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Fri, 1 Feb 2008 17:49:42 +0100 Subject: x86: fix section mismatch warning in kernel/pci-calgary Fix following warning: WARNING: arch/x86/kernel/built-in.o(.text+0x1eb41): Section mismatch in reference from the function calgary_handle_quirks() to the function .init.text:calgary_set_split_completion_timeout() calgary_handle_quirks() are only called at __init time (in calgary_init_one() via handle_quirks ops). So annotate this function and the sister function __init. Signed-off-by: Sam Ravnborg Signed-off-by: Ingo Molnar --- arch/x86/kernel/pci-calgary_64.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'arch') diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c index 21f34db2c03..1fe7f043ebd 100644 --- a/arch/x86/kernel/pci-calgary_64.c +++ b/arch/x86/kernel/pci-calgary_64.c @@ -1006,7 +1006,7 @@ static void __init calgary_set_split_completion_timeout(void __iomem *bbar, readq(target); /* flush */ } -static void calioc2_handle_quirks(struct iommu_table *tbl, struct pci_dev *dev) +static void __init calioc2_handle_quirks(struct iommu_table *tbl, struct pci_dev *dev) { unsigned char busnum = dev->bus->number; void __iomem *bbar = tbl->bbar; @@ -1022,7 +1022,7 @@ static void calioc2_handle_quirks(struct iommu_table *tbl, struct pci_dev *dev) writel(cpu_to_be32(val), target); } -static void calgary_handle_quirks(struct iommu_table *tbl, struct pci_dev *dev) +static void __init calgary_handle_quirks(struct iommu_table *tbl, struct pci_dev *dev) { unsigned char busnum = dev->bus->number; -- cgit v1.2.3-18-g5258 From 9347e0b0ce6255f4abef462d373577e7c8362fc6 Mon Sep 17 00:00:00 2001 From: Yinghai Lu Date: Fri, 1 Feb 2008 17:49:42 +0100 Subject: x86: remove unneeded round_up Signed-off-by: Yinghai Lu Signed-off-by: Ingo Molnar --- arch/x86/mm/numa_64.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'arch') diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c index 9f533deb9da..a920d09b919 100644 --- a/arch/x86/mm/numa_64.c +++ b/arch/x86/mm/numa_64.c @@ -168,10 +168,9 @@ static void * __init early_node_mem(int nodeid, unsigned long start, unsigned long mem = find_e820_area(start, end, size, align); void *ptr; - if (mem != -1L) { - mem = round_up(mem, align); + if (mem != -1L) return __va(mem); - } + ptr = __alloc_bootmem_nopanic(size, align, __pa(MAX_DMA_ADDRESS)); if (ptr == NULL) { printk(KERN_ERR "Cannot find %lu bytes in node %d\n", -- cgit v1.2.3-18-g5258 From bb0e1290876a534d542f624cd549dab90cc767c4 Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Fri, 1 Feb 2008 17:49:42 +0100 Subject: x86: make early_console static in early_printk.c Not necessary to expose it, also fixes sparse warning. arch/x86/kernel/early_printk.c:196:16: warning: symbol 'early_console' was not declared. Should it be static? Signed-off-by: Harvey Harrison Signed-off-by: Ingo Molnar --- arch/x86/kernel/early_printk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch') diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c index b7d6c23f287..cff84cd9987 100644 --- a/arch/x86/kernel/early_printk.c +++ b/arch/x86/kernel/early_printk.c @@ -193,7 +193,7 @@ static struct console simnow_console = { }; /* Direct interface for emergencies */ -struct console *early_console = &early_vga_console; +static struct console *early_console = &early_vga_console; static int early_console_initialized = 0; void early_printk(const char *fmt, ...) -- cgit v1.2.3-18-g5258 From 4a1485131a6038ba5382f407db48badc332672c4 Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Fri, 1 Feb 2008 17:49:43 +0100 Subject: x86: fix sparse warnings in cpu/common.c The casts will always be needed, may as well make them the right signedness. The ebx variables can easily be unsigned, may as well. arch/x86/kernel/cpu/common.c:261:21: warning: incorrect type in argument 2 (different signedness) arch/x86/kernel/cpu/common.c:261:21: expected unsigned int *eax arch/x86/kernel/cpu/common.c:261:21: got int * arch/x86/kernel/cpu/common.c:262:9: warning: incorrect type in argument 3 (different signedness) arch/x86/kernel/cpu/common.c:262:9: expected unsigned int *ebx arch/x86/kernel/cpu/common.c:262:9: got int * arch/x86/kernel/cpu/common.c:263:9: warning: incorrect type in argument 4 (different signedness) arch/x86/kernel/cpu/common.c:263:9: expected unsigned int *ecx arch/x86/kernel/cpu/common.c:263:9: got int * arch/x86/kernel/cpu/common.c:264:9: warning: incorrect type in argument 5 (different signedness) arch/x86/kernel/cpu/common.c:264:9: expected unsigned int *edx arch/x86/kernel/cpu/common.c:264:9: got int * arch/x86/kernel/cpu/common.c:293:30: warning: incorrect type in argument 3 (different signedness) arch/x86/kernel/cpu/common.c:293:30: expected unsigned int *ebx arch/x86/kernel/cpu/common.c:293:30: got int * arch/x86/kernel/cpu/common.c:350:22: warning: incorrect type in argument 2 (different signedness) arch/x86/kernel/cpu/common.c:350:22: expected unsigned int *eax arch/x86/kernel/cpu/common.c:350:22: got int * arch/x86/kernel/cpu/common.c:351:10: warning: incorrect type in argument 3 (different signedness) arch/x86/kernel/cpu/common.c:351:10: expected unsigned int *ebx arch/x86/kernel/cpu/common.c:351:10: got int * arch/x86/kernel/cpu/common.c:352:10: warning: incorrect type in argument 4 (different signedness) arch/x86/kernel/cpu/common.c:352:10: expected unsigned int *ecx arch/x86/kernel/cpu/common.c:352:10: got int * arch/x86/kernel/cpu/common.c:353:10: warning: incorrect type in argument 5 (different signedness) arch/x86/kernel/cpu/common.c:353:10: expected unsigned int *edx arch/x86/kernel/cpu/common.c:353:10: got int * arch/x86/kernel/cpu/common.c:362:30: warning: incorrect type in argument 3 (different signedness) arch/x86/kernel/cpu/common.c:362:30: expected unsigned int *ebx arch/x86/kernel/cpu/common.c:362:30: got int * Signed-off-by: Harvey Harrison Signed-off-by: Ingo Molnar --- arch/x86/kernel/cpu/common.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'arch') diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index d608c9ebbfe..b7b2142b58e 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -258,10 +258,10 @@ static int __cpuinit have_cpuid_p(void) void __init cpu_detect(struct cpuinfo_x86 *c) { /* Get vendor name */ - cpuid(0x00000000, &c->cpuid_level, - (int *)&c->x86_vendor_id[0], - (int *)&c->x86_vendor_id[8], - (int *)&c->x86_vendor_id[4]); + cpuid(0x00000000, (unsigned int *)&c->cpuid_level, + (unsigned int *)&c->x86_vendor_id[0], + (unsigned int *)&c->x86_vendor_id[8], + (unsigned int *)&c->x86_vendor_id[4]); c->x86 = 4; if (c->cpuid_level >= 0x00000001) { @@ -283,7 +283,7 @@ void __init cpu_detect(struct cpuinfo_x86 *c) static void __cpuinit early_get_cap(struct cpuinfo_x86 *c) { u32 tfms, xlvl; - int ebx; + unsigned int ebx; memset(&c->x86_capability, 0, sizeof c->x86_capability); if (have_cpuid_p()) { @@ -343,14 +343,14 @@ static void __init early_cpu_detect(void) static void __cpuinit generic_identify(struct cpuinfo_x86 * c) { u32 tfms, xlvl; - int ebx; + unsigned int ebx; if (have_cpuid_p()) { /* Get vendor name */ - cpuid(0x00000000, &c->cpuid_level, - (int *)&c->x86_vendor_id[0], - (int *)&c->x86_vendor_id[8], - (int *)&c->x86_vendor_id[4]); + cpuid(0x00000000, (unsigned int *)&c->cpuid_level, + (unsigned int *)&c->x86_vendor_id[0], + (unsigned int *)&c->x86_vendor_id[8], + (unsigned int *)&c->x86_vendor_id[4]); get_cpu_vendor(c, 0); /* Initialize the standard set of capabilities */ -- cgit v1.2.3-18-g5258 From 93809be8b140c101d27f00d0a622ebac90bc7a67 Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Fri, 1 Feb 2008 17:49:43 +0100 Subject: x86: fixes for lookup_address args Signedness mismatches in level argument. Signed-off-by: Harvey Harrison Signed-off-by: Ingo Molnar --- arch/x86/kernel/efi_64.c | 2 +- arch/x86/mm/fault.c | 2 +- arch/x86/mm/ioremap.c | 3 ++- arch/x86/mm/pageattr-test.c | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) (limited to 'arch') diff --git a/arch/x86/kernel/efi_64.c b/arch/x86/kernel/efi_64.c index 4b73992c1e1..674f2379480 100644 --- a/arch/x86/kernel/efi_64.c +++ b/arch/x86/kernel/efi_64.c @@ -44,7 +44,7 @@ static void __init early_mapping_set_exec(unsigned long start, int executable) { pte_t *kpte; - int level; + unsigned int level; while (start < end) { kpte = lookup_address((unsigned long)__va(start), &level); diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index e28cc5277b1..e4440d0abf8 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c @@ -382,7 +382,7 @@ static void show_fault_oops(struct pt_regs *regs, unsigned long error_code, #ifdef CONFIG_X86_PAE if (error_code & PF_INSTR) { - int level; + unsigned int level; pte_t *pte = lookup_address(address, &level); if (pte && pte_present(*pte) && !pte_exec(*pte)) diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index a177d76e1c5..c004d94608f 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c @@ -75,7 +75,8 @@ static int ioremap_change_attr(unsigned long paddr, unsigned long size, { unsigned long vaddr = (unsigned long)__va(paddr); unsigned long nrpages = size >> PAGE_SHIFT; - int err, level; + unsigned int level; + int err; /* No change for pages after the last mapping */ if ((paddr + size - 1) >= (max_pfn_mapped << PAGE_SHIFT)) diff --git a/arch/x86/mm/pageattr-test.c b/arch/x86/mm/pageattr-test.c index 06353d43f72..7573e786d2f 100644 --- a/arch/x86/mm/pageattr-test.c +++ b/arch/x86/mm/pageattr-test.c @@ -42,7 +42,7 @@ static __init int print_split(struct split_state *s) s->max_exec = 0; for (i = 0; i < max_pfn_mapped; ) { unsigned long addr = (unsigned long)__va(i << PAGE_SHIFT); - int level; + unsigned int level; pte_t *pte; pte = lookup_address(addr, &level); @@ -106,7 +106,7 @@ static __init int exercise_pageattr(void) unsigned long *bm; pte_t *pte, pte0; int failed = 0; - int level; + unsigned int level; int i, k; int err; -- cgit v1.2.3-18-g5258 From d987402695f16ae33999d7315b915099d64616d4 Mon Sep 17 00:00:00 2001 From: Alexander van Heukelum Date: Fri, 1 Feb 2008 17:49:43 +0100 Subject: x86: avoid section mismatch involving arch_register_cpu Avoid section mismatch involving arch_register_cpu. Marking arch_register_cpu as __init and removing the export for non-hotplug-cpu configurations makes the following warning go away: Section mismatch in reference from the function arch_register_cpu() to the function .devinit.text:register_cpu() The function arch_register_cpu() references the function __devinit register_cpu(). This is often because arch_register_cpu lacks a __devinit annotation or the annotation of register_cpu is wrong. The only external user of arch_register_cpu in the tree is in drivers/acpi/processor_core.c where it is guarded by ACPI_HOTPLUG_CPU (which depends on HOTPLUG_CPU). Signed-off-by: Alexander van Heukelum CC: Sam Ravnborg Signed-off-by: Ingo Molnar --- arch/x86/kernel/topology.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'arch') diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c index 78cbb655aa7..e6757aaa202 100644 --- a/arch/x86/kernel/topology.c +++ b/arch/x86/kernel/topology.c @@ -57,11 +57,10 @@ void arch_unregister_cpu(int num) } EXPORT_SYMBOL(arch_unregister_cpu); #else -int arch_register_cpu(int num) +static int __init arch_register_cpu(int num) { return register_cpu(&per_cpu(cpu_devices, num).cpu, num); } -EXPORT_SYMBOL(arch_register_cpu); #endif /*CONFIG_HOTPLUG_CPU*/ static int __init topology_init(void) -- cgit v1.2.3-18-g5258