RE: x86/non-x86: percpu, node ids, apic ids x86.git fixup
Applied that patch and UP kernel built ok, and then crashed in the same place with the memset() to a user-looking address from kmem_cache_alloc() So the percpu changes are innocent ... something else since 2.6.24 is to blame. Only 5749 commits :-) I'll start bisecting. The bisection narrowed in on an innocent patch in ipv4 space. Meanwhile the rush of patches continues. When I retested yesterday when Linus HEAD was 8af03e782... the CONFIG_SMP=n kernel worked perfectly. So maybe it was fixed? Or maybe the bug depends on the relative location of various bits of code/data and as the kernel grows and shrinks with incoming changes the problem comes and goes :-( -Tony ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: x86/non-x86: percpu, node ids, apic ids x86.git fixup
* Luck, Tony [EMAIL PROTECTED] wrote: I'll start digging on why this doesn't boot ... but you might as well send the fixes so far upstream to Linus so that the SMP fix is available Well a pure 2.6.24 version compiled with CONFIG_SMP=n booted just fine, so the breakage is recent ... and more than likely related to this change. I've only had a casual dig at the failing case ... kernel dies in memset() as called from kmem_cache_alloc() with the address being written as 0x40117b48 (which is off in the virtual address space range used by users ... not a kernel address). hm, as far as i could check, on ia64 UP the .percpu section link difference was the only ia64 difference i could find out of those changes. Could you try to copy a 2.6.24 include/asm-generic/percpu.h, include/asm-ia64.h and include/linux/percpu.h into your current tree, and see whether that boots? If yes, then it's the percpu changes. The patch below does this ontop of very latest -git - and it builds fine with your UP config with a crosscompiler. I'll dig some more tomorrow. thanks. Ingo --- include/asm-generic/percpu.h | 99 --- include/asm-ia64/percpu.h| 57 +++- include/linux/percpu.h | 20 3 files changed, 82 insertions(+), 94 deletions(-) Index: linux-x86.q/include/asm-generic/percpu.h === --- linux-x86.q.orig/include/asm-generic/percpu.h +++ linux-x86.q/include/asm-generic/percpu.h @@ -3,79 +3,54 @@ #include linux/compiler.h #include linux/threads.h -/* - * Determine the real variable name from the name visible in the - * kernel sources. - */ -#define per_cpu_var(var) per_cpu__##var - +#define __GENERIC_PER_CPU #ifdef CONFIG_SMP -/* - * per_cpu_offset() is the offset that has to be added to a - * percpu variable to get to the instance for a certain processor. - * - * Most arches use the __per_cpu_offset array for those offsets but - * some arches have their own ways of determining the offset (x86_64, s390). - */ -#ifndef __per_cpu_offset extern unsigned long __per_cpu_offset[NR_CPUS]; #define per_cpu_offset(x) (__per_cpu_offset[x]) -#endif - -/* - * Determine the offset for the currently active processor. - * An arch may define __my_cpu_offset to provide a more effective - * means of obtaining the offset to the per cpu variables of the - * current processor. - */ -#ifndef __my_cpu_offset -#define __my_cpu_offset per_cpu_offset(raw_smp_processor_id()) -#define my_cpu_offset per_cpu_offset(smp_processor_id()) -#else -#define my_cpu_offset __my_cpu_offset -#endif - -/* - * Add a offset to a pointer but keep the pointer as is. - * - * Only S390 provides its own means of moving the pointer. - */ -#ifndef SHIFT_PERCPU_PTR -#define SHIFT_PERCPU_PTR(__p, __offset)RELOC_HIDE((__p), (__offset)) -#endif - -/* - * A percpu variable may point to a discarded regions. The following are - * established ways to produce a usable pointer from the percpu variable - * offset. - */ -#define per_cpu(var, cpu) \ - (*SHIFT_PERCPU_PTR(per_cpu_var(var), per_cpu_offset(cpu))) -#define __get_cpu_var(var) \ - (*SHIFT_PERCPU_PTR(per_cpu_var(var), my_cpu_offset)) -#define __raw_get_cpu_var(var) \ - (*SHIFT_PERCPU_PTR(per_cpu_var(var), __my_cpu_offset)) - - -#ifdef CONFIG_HAVE_SETUP_PER_CPU_AREA -extern void setup_per_cpu_areas(void); -#endif +/* Separate out the type, so (int[3], foo) works. */ +#define DEFINE_PER_CPU(type, name) \ +__attribute__((__section__(.data.percpu))) __typeof__(type) per_cpu__##name + +#define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \ +__attribute__((__section__(.data.percpu.shared_aligned))) \ +__typeof__(type) per_cpu__##name \ +cacheline_aligned_in_smp + +/* var is in discarded region: offset to particular copy we want */ +#define per_cpu(var, cpu) (*({ \ + extern int simple_identifier_##var(void); \ + RELOC_HIDE(per_cpu__##var, __per_cpu_offset[cpu]); })) +#define __get_cpu_var(var) per_cpu(var, smp_processor_id()) +#define __raw_get_cpu_var(var) per_cpu(var, raw_smp_processor_id()) + +/* A macro to avoid #include hell... */ +#define percpu_modcopy(pcpudst, src, size) \ +do { \ + unsigned int __i; \ + for_each_possible_cpu(__i) \ + memcpy((pcpudst)+__per_cpu_offset[__i], \ + (src), (size)); \ +} while (0) #else /* ! SMP */ -#define per_cpu(var, cpu) (*((void)(cpu), per_cpu_var(var))) -#define __get_cpu_var(var) per_cpu_var(var) -#define __raw_get_cpu_var(var) per_cpu_var(var) +#define DEFINE_PER_CPU(type, name) \ +
RE: x86/non-x86: percpu, node ids, apic ids x86.git fixup
hm, as far as i could check, on ia64 UP the .percpu section link difference was the only ia64 difference i could find out of those changes. Could you try to copy a 2.6.24 include/asm-generic/percpu.h, include/asm-ia64.h and include/linux/percpu.h into your current tree, and see whether that boots? If yes, then it's the percpu changes. The patch below does this ontop of very latest -git - and it builds fine with your UP config with a crosscompiler. Applied that patch and UP kernel built ok, and then crashed in the same place with the memset() to a user-looking address from kmem_cache_alloc() So the percpu changes are innocent ... something else since 2.6.24 is to blame. Only 5749 commits :-) I'll start bisecting. -Tony ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
RE: x86/non-x86: percpu, node ids, apic ids x86.git fixup
So the percpu changes are innocent ... something else since 2.6.24 is to blame. Only 5749 commits :-) I'll start bisecting. 12 bisections later ... nothing! I think I got lost in the maze. Bisection #5 had a crash, but it looked to be a very differnt crash (and looked to happen later than the bug I was hunting). So I marked that as good on the theory that it looked like this bug wasn't in the kernel. Same thing happened at bisection #9. But I ended up with: commit bfada697bd534d2c16fd07fbef3a4924c4d4e014 Author: Pavel Emelyanov [EMAIL PROTECTED] Date: Sun Dec 2 00:57:08 2007 +1100 [IPV4]: Use ctl paths to register devinet sysctls Which just looks too improbable to be the cause of the UP crash. Git won't revert it out from top of tree automatically so I can't easily test whether some weird magic means that this is the buggy commit. Perhaps the issue is another offset of object X in kernel w.r.t. object Y ... and so the good/bad choices in the bisection are actually pretty random depending on how much code is stuffed between X Y at each bisection point. -Tony ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: x86/non-x86: percpu, node ids, apic ids x86.git fixup
On Wed, 30 Jan 2008, Linux Kernel Mailing List wrote: Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=dd5af90a7f3d79e04b7eace9a98644dbf2038f4d Commit: dd5af90a7f3d79e04b7eace9a98644dbf2038f4d Parent: 3212bff370c2f22e4987c6679ba485654cefb178 Author: Mike Travis [EMAIL PROTECTED] AuthorDate: Wed Jan 30 13:33:32 2008 +0100 Committer: Ingo Molnar [EMAIL PROTECTED] CommitDate: Wed Jan 30 13:33:32 2008 +0100 x86/non-x86: percpu, node ids, apic ids x86.git fixup Signed-off-by: Ingo Molnar [EMAIL PROTECTED] Signed-off-by: Thomas Gleixner [EMAIL PROTECTED] --- arch/x86/Kconfig |2 +- include/asm-generic/percpu.h | 12 ++-- init/main.c |4 ++-- kernel/module.c |8 This broke powerpc (and presumably ia64 and sparc64) in current linux-2.6.git: | init/main.c:376: error: static declaration of 'setup_per_cpu_areas' follows non-static declaration | include2/asm/percpu.h:33: error: previous declaration of 'setup_per_cpu_areas' was here as the generic and x86-specific parts were integrated, while the powerpc/ia64/sparc64-specific parts are still missing. 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index f0887d1..8e1b33c 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -97,7 +97,7 @@ config GENERIC_TIME_VSYSCALL bool default X86_64 -config ARCH_SETS_UP_PER_CPU_AREA +config HAVE_SETUP_PER_CPU_AREA def_bool X86_64 config ARCH_SUPPORTS_OPROFILE diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h index c41b1a7..4b8d31c 100644 --- a/include/asm-generic/percpu.h +++ b/include/asm-generic/percpu.h @@ -47,7 +47,7 @@ extern unsigned long __per_cpu_offset[NR_CPUS]; #endif /* - * A percpu variable may point to a discarded reghions. The following are + * A percpu variable may point to a discarded regions. The following are * established ways to produce a usable pointer from the percpu variable * offset. */ @@ -59,18 +59,10 @@ extern unsigned long __per_cpu_offset[NR_CPUS]; (*SHIFT_PERCPU_PTR(per_cpu_var(var), __my_cpu_offset)) -#ifdef CONFIG_ARCH_SETS_UP_PER_CPU_AREA +#ifdef CONFIG_HAVE_SETUP_PER_CPU_AREA extern void setup_per_cpu_areas(void); #endif -/* A macro to avoid #include hell... */ -#define percpu_modcopy(pcpudst, src, size) \ -do { \ - unsigned int __i; \ - for_each_possible_cpu(__i) \ - memcpy((pcpudst)+per_cpu_offset(__i), \ -(src), (size)); \ -} while (0) #else /* ! SMP */ #define per_cpu(var, cpu)(*((void)(cpu), per_cpu_var(var))) diff --git a/init/main.c b/init/main.c index 5843fe9..3316dff 100644 --- a/init/main.c +++ b/init/main.c @@ -363,7 +363,7 @@ static inline void smp_prepare_cpus(unsigned int maxcpus) { } #else -#ifndef CONFIG_ARCH_SETS_UP_PER_CPU_AREA +#ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA unsigned long __per_cpu_offset[NR_CPUS] __read_mostly; EXPORT_SYMBOL(__per_cpu_offset); @@ -384,7 +384,7 @@ static void __init setup_per_cpu_areas(void) ptr += size; } } -#endif /* CONFIG_ARCH_SETS_UP_CPU_AREA */ +#endif /* CONFIG_HAVE_SETUP_PER_CPU_AREA */ /* Called by boot processor to activate the rest. */ static void __init smp_init(void) diff --git a/kernel/module.c b/kernel/module.c index f6a4e72..bd60278 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -430,6 +430,14 @@ static unsigned int find_pcpusec(Elf_Ehdr *hdr, return find_sec(hdr, sechdrs, secstrings, .data.percpu); } +static void percpu_modcopy(void *pcpudest, const void *from, unsigned long size) +{ + int cpu; + + for_each_possible_cpu(cpu) + memcpy(pcpudest + per_cpu_offset(cpu), from, size); +} + static int percpu_modinit(void) { pcpu_num_used = 2; - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html With kind regards, Geert Uytterhoeven Software Architect Sony Network and Software Technology Center Europe The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium Phone:+32 (0)2 700 8453 Fax: +32 (0)2 700 8622 E-mail: [EMAIL PROTECTED] Internet: http://www.sony-europe.com/ Sony Network and Software Technology Center Europe A division of Sony Service Centre (Europe) N.V. Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium VAT BE 0413.825.160 · RPR Brussels Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619___
Re: x86/non-x86: percpu, node ids, apic ids x86.git fixup
* Mike Travis [EMAIL PROTECTED] wrote: This broke powerpc (and presumably ia64 and sparc64) in current linux-2.6.git: I'm generating a fixup patch right now... thanks! Sorry about that: we cross-built on ARM but not on SMP non-x86 platforms so this dependency/breakage went unnoticed. Ingo ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: x86/non-x86: percpu, node ids, apic ids x86.git fixup
Ingo Molnar wrote: * Luck, Tony [EMAIL PROTECTED] wrote: thanks! Sorry about that: we cross-built on ARM but not on SMP non-x86 platforms so this dependency/breakage went unnoticed. Yes ... all ia64 builds (UP and SMP) are broken at the moment. Please Cc: me with the fixup patch. Could you check the patch below? With this applied to latest -git, ia64 buils fine for me in a cross-compiling environment. (but i dont know whether it boots ...) Ingo This patch is from a different patch set (aka zero-based patch). That one will be updated and resubmitted soon... Thanks, Mike - Subject: generic: percpu infrastructure to rebase the per cpu area to zero From: [EMAIL PROTECTED] * Support an option CONFIG_HAVE_ZERO_BASED_PER_CPU that makes offsets for per cpu variables to start at zero. If a percpu area starts at zero then: - We do not need RELOC_HIDE anymore - Provides for the future capability of architectures providing a per cpu allocator that returns offsets instead of pointers. The offsets would be independent of the processor so that address calculations can be done in a processor independent way. Per cpu instructions can then add the processor specific offset at the last minute possibly in an atomic instruction. The data the linker provides is different for zero based percpu segments: __per_cpu_load - The address at which the percpu area was loaded __per_cpu_size - The length of the per cpu area * Removes the __per_cpu_x in lockdep. The __per_cpu_x are already pointers. There is no need to take the address. * Changes generic setup_per_cpu_areas to allocate per_cpu space in node local memory. This requires a generic early_cpu_to_node function. Signed-off-by: Mike Travis [EMAIL PROTECTED] Reviewed-by: Christoph Lameter [EMAIL PROTECTED] Signed-off-by: Ingo Molnar [EMAIL PROTECTED] --- arch/ia64/Kconfig |2 - arch/ia64/kernel/module.c | 11 arch/powerpc/Kconfig |2 - arch/sparc64/mm/init.c|5 include/asm-alpha/topology.h |1 include/asm-generic/percpu.h |7 - include/asm-generic/sections.h| 10 include/asm-generic/topology.h|3 ++ include/asm-generic/vmlinux.lds.h | 15 include/asm-ia64/percpu.h | 29 +-- include/asm-ia64/topology.h |1 include/asm-mips/mach-ip27/topology.h |1 include/asm-powerpc/percpu.h | 29 +-- include/asm-powerpc/topology.h|1 include/asm-s390/percpu.h | 42 +++--- include/asm-sparc64/percpu.h | 22 ++--- init/main.c | 18 -- kernel/lockdep.c |4 +-- 18 files changed, 78 insertions(+), 125 deletions(-) Index: linux-x86.q/arch/ia64/Kconfig === --- linux-x86.q.orig/arch/ia64/Kconfig +++ linux-x86.q/arch/ia64/Kconfig @@ -80,7 +80,7 @@ config GENERIC_TIME_VSYSCALL bool default y -config ARCH_SETS_UP_PER_CPU_AREA +config HAVE_SETUP_PER_CPU_AREA def_bool y config DMI Index: linux-x86.q/arch/ia64/kernel/module.c === --- linux-x86.q.orig/arch/ia64/kernel/module.c +++ linux-x86.q/arch/ia64/kernel/module.c @@ -940,14 +940,3 @@ module_arch_cleanup (struct module *mod) if (mod-arch.core_unw_table) unw_remove_unwind_table(mod-arch.core_unw_table); } - -#ifdef CONFIG_SMP -void -percpu_modcopy (void *pcpudst, const void *src, unsigned long size) -{ - unsigned int i; - for_each_possible_cpu(i) { - memcpy(pcpudst + per_cpu_offset(i), src, size); - } -} -#endif /* CONFIG_SMP */ Index: linux-x86.q/arch/powerpc/Kconfig === --- linux-x86.q.orig/arch/powerpc/Kconfig +++ linux-x86.q/arch/powerpc/Kconfig @@ -42,7 +42,7 @@ config GENERIC_HARDIRQS bool default y -config ARCH_SETS_UP_PER_CPU_AREA +config HAVE_SETUP_PER_CPU_AREA def_bool PPC64 config IRQ_PER_CPU Index: linux-x86.q/arch/sparc64/mm/init.c === --- linux-x86.q.orig/arch/sparc64/mm/init.c +++ linux-x86.q/arch/sparc64/mm/init.c @@ -1328,6 +1328,11 @@ pgd_t swapper_pg_dir[2048]; static void sun4u_pgprot_init(void); static void sun4v_pgprot_init(void); +/* Dummy function */ +void __init setup_per_cpu_areas(void) +{ +} + void __init paging_init(void) { unsigned long end_pfn, pages_avail, shift, phys_base; Index:
Re: x86/non-x86: percpu, node ids, apic ids x86.git fixup
Luck, Tony wrote: Could you check the patch below? With this applied to latest -git, ia64 buils fine for me in a cross-compiling environment. (but i dont know whether it boots ...) Uni-processor build still fails with this patch (config is arch/ia64/configs/tiger_defconfig with CONFIG_SMP switched from =y to =n). I'll add an ia64-nosmp config to our cross build test environment and fix this up... Thanks, Mike arch/ia64/kernel/built-in.o(.text+0x5012): In function `show_interrupts': : relocation truncated to fit: IMM22 per_cpu__kstat arch/ia64/kernel/built-in.o(.text+0x53e1): In function `__bind_irq_vector': : relocation truncated to fit: IMM22 per_cpu__vector_irq arch/ia64/kernel/built-in.o(.text+0x5612): In function `__clear_irq_vector': : relocation truncated to fit: IMM22 per_cpu__vector_irq arch/ia64/kernel/built-in.o(.text+0x5a81): In function `__setup_vector_irq': : relocation truncated to fit: IMM22 per_cpu__vector_irq arch/ia64/kernel/built-in.o(.text+0x6231): In function `ia64_handle_irq': : relocation truncated to fit: IMM22 per_cpuirq_regs arch/ia64/kernel/built-in.o(.text+0x6272): In function `ia64_handle_irq': : relocation truncated to fit: IMM22 per_cpu__vector_irq arch/ia64/kernel/built-in.o(.text+0x7b81): In function `cpu_idle_wait': : relocation truncated to fit: IMM22 .text arch/ia64/kernel/built-in.o(.text+0x7e21): In function `cpu_idle': : relocation truncated to fit: IMM22 .text arch/ia64/kernel/built-in.o(.text+0x7fd1): In function `ia64_save_extra': : relocation truncated to fit: IMM22 per_cpu__pfm_syst_info arch/ia64/kernel/built-in.o(.text+0x8071): In function `ia64_load_extra': : relocation truncated to fit: IMM22 per_cpu__pfm_syst_info arch/ia64/kernel/built-in.o(.text+0x95c0): In function `pfm_write_ibr_dbr': : additional relocation overflows omitted from the output ld: final link failed: Nonrepresentable section on output make: *** [.tmp_vmlinux1] Error 1 SMP build (config zx1_defconfig) builds ok and boots ok too. -Tony ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: x86/non-x86: percpu, node ids, apic ids x86.git fixup
* Luck, Tony [EMAIL PROTECTED] wrote: Could you check the patch below? With this applied to latest -git, ia64 buils fine for me in a cross-compiling environment. (but i dont know whether it boots ...) Uni-processor build still fails with this patch (config is arch/ia64/configs/tiger_defconfig with CONFIG_SMP switched from =y to =n). could you try the full patchset that Travis has just sent and which i've put into x86.git, you can pull it from: git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86.git it's a fixes only tree, ontop of Linus-very-latest. Head 4b9e425c25f84. [pull from ssh://master.kernel.org if it's not on git.kernel.org yet, uploaded it this very minute.] Ingo ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: x86/non-x86: percpu, node ids, apic ids x86.git fixup
* Ingo Molnar [EMAIL PROTECTED] wrote: Uni-processor build still fails with this patch (config is arch/ia64/configs/tiger_defconfig with CONFIG_SMP switched from =y to =n). could you try the full patchset that Travis has just sent and which i've put into x86.git, you can pull it from: btw., i needed the fix below to get DISCONTIGMEM + !NUMA to build. (this is an ia64 build breakage independent of the x86.git merge) Ingo -- Subject: ia64: build fix From: Ingo Molnar [EMAIL PROTECTED] DISCONTIGMEM does not build with NUMA disabled: include/linux/gfp.h: In function `alloc_pages_node': include/linux/gfp.h:189: error: implicit declaration of function `NODE_DATA' include/linux/gfp.h:189: error: invalid type argument of `-' In file included from include/asm/uaccess.h:39, Signed-off-by: Ingo Molnar [EMAIL PROTECTED] --- arch/ia64/Kconfig |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) Index: linux-x86.q/arch/ia64/Kconfig === --- linux-x86.q.orig/arch/ia64/Kconfig +++ linux-x86.q/arch/ia64/Kconfig @@ -351,7 +351,8 @@ config ARCH_SELECT_MEMORY_MODEL def_bool y config ARCH_DISCONTIGMEM_ENABLE - def_bool y + def_bool n + depends on NUMA help Say Y to support efficient handling of discontiguous physical memory, for architectures which are either NUMA (Non-Uniform Memory Access) @@ -372,7 +373,7 @@ config ARCH_DISCONTIGMEM_DEFAULT config NUMA bool NUMA support - depends on !IA64_HP_SIM !FLATMEM + depends on !IA64_HP_SIM default y if IA64_SGI_SN2 select ACPI_NUMA if ACPI help ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: x86/non-x86: percpu, node ids, apic ids x86.git fixup
On Wed, Jan 30, 2008 at 07:49:20PM +0100, Ingo Molnar wrote: * Luck, Tony [EMAIL PROTECTED] wrote: Could you check the patch below? With this applied to latest -git, ia64 buils fine for me in a cross-compiling environment. (but i dont know whether it boots ...) Uni-processor build still fails with this patch (config is arch/ia64/configs/tiger_defconfig with CONFIG_SMP switched from =y to =n). could you try the full patchset that Travis has just sent and which i've put into x86.git, you can pull it from: Looks ok for powerpc so far, I haven't gotten through all defconfigs yet but the first ones that failed before build now. pasemi_defconfig boots as well. -Olof ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
RE: x86/non-x86: percpu, node ids, apic ids x86.git fixup
could you try the full patchset that Travis has just sent and which i've put into x86.git, you can pull it from: git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86.git it's a fixes only tree, ontop of Linus-very-latest. Head 4b9e425c25f84. [pull from ssh://master.kernel.org if it's not on git.kernel.org yet, uploaded it this very minute.] Same build fail for CONFIG_SMP=n. The SMP=y build is good (for tiger_defconfig) and boots ok too. -Tony ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: x86/non-x86: percpu, node ids, apic ids x86.git fixup
* Mike Travis [EMAIL PROTECTED] wrote: Could this be a problem with: #ifdef HAVE_MODEL_SMALL_ATTRIBUTE # define PER_CPU_ATTRIBUTES __attribute__((__model__ (__small__))) #endif This is only defined for !__ASSEMBLY__ nope, moving that per the patch below did not resolve the link problems. Ingo -- Subject: ia64: build fix #3 From: Ingo Molnar [EMAIL PROTECTED] Signed-off-by: Ingo Molnar [EMAIL PROTECTED] --- include/asm-ia64/percpu.h |8 1 file changed, 4 insertions(+), 4 deletions(-) Index: linux-x86.q/include/asm-ia64/percpu.h === --- linux-x86.q.orig/include/asm-ia64/percpu.h +++ linux-x86.q/include/asm-ia64/percpu.h @@ -8,6 +8,10 @@ #define PERCPU_ENOUGH_ROOM PERCPU_PAGE_SIZE +#ifdef HAVE_MODEL_SMALL_ATTRIBUTE +# define PER_CPU_ATTRIBUTES__attribute__((__model__ (__small__))) +#endif + #ifdef __ASSEMBLY__ # define THIS_CPU(var) (per_cpu__##var) /* use this to mark accesses to per-CPU variables... */ #else /* !__ASSEMBLY__ */ @@ -15,10 +19,6 @@ #include linux/threads.h -#ifdef HAVE_MODEL_SMALL_ATTRIBUTE -# define PER_CPU_ATTRIBUTES__attribute__((__model__ (__small__))) -#endif - #ifdef CONFIG_SMP #define __my_cpu_offset__ia64_per_cpu_var(local_per_cpu_offset) ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: x86/non-x86: percpu, node ids, apic ids x86.git fixup
* Olof Johansson [EMAIL PROTECTED] wrote: could you try the full patchset that Travis has just sent and which i've put into x86.git, you can pull it from: Looks ok for powerpc so far, I haven't gotten through all defconfigs yet but the first ones that failed before build now. pasemi_defconfig boots as well. great, thanks! Ingo ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
RE: x86/non-x86: percpu, node ids, apic ids x86.git fixup
I'm having trouble replicating this error. With the latest linux-2.6.git plus the patch I just sent, I get the following errors: drivers/input/mouse/psmouse-base.c:45: error: __param_proto causes a section type conflict drivers/md/md.c:5881: error: __param_start_ro causes a section type conflict Weird. psmouse-base.c builds ok for me. Perhaps there is a compiler version difference? I'm running a rather old 3.4.6 that came with my RHEL 4.5 release. (plenty of warnings too, but no vmlinux) New section mismatch checks are complaining about lots of stuff in this post 2.6.24 world. There are a couple of dozen other warnings in a normal build. I copied arch/ia64/configs/tiger_defconfig to .config, ran menuconfig to turn off SMP and built with this line Yup ... my script is a little different. It uses $ sed -e '/CONFIG_SMP/d' arch/ia64/configs/tiger_defconfig .config $ make oldconfig But the net effect should be equivalent. #ifdef HAVE_MODEL_SMALL_ATTRIBUTE # define PER_CPU_ATTRIBUTES __attribute__((__model__ (__small__))) #endif This is only defined for !__ASSEMBLY__ Some place in there. The CONFIG_SMP=n path in ia64 makes quite radical changes ... rather than putting all the per-cpu stuff into the top 64K of address space and providing a per-cpu TLB mapping for that range to a different physical address ... it just makes all the per-cpu stuff link as ordinary variables in .data. The error messages indicate that some of the new code is unaware of this. -Tony ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: x86/non-x86: percpu, node ids, apic ids x86.git fixup
* Luck, Tony [EMAIL PROTECTED] wrote: This is only defined for !__ASSEMBLY__ Some place in there. The CONFIG_SMP=n path in ia64 makes quite radical changes ... rather than putting all the per-cpu stuff into the top 64K of address space and providing a per-cpu TLB mapping for that range to a different physical address ... it just makes all the per-cpu stuff link as ordinary variables in .data. The error messages indicate that some of the new code is unaware of this. ah, that was the vital clue. The patch below makes the small memory model only defined on SMP, and makes the config build/link fine here. Does this build and boot on your box? Ingo Subject: ia64: build fix #3 From: Ingo Molnar [EMAIL PROTECTED] Signed-off-by: Ingo Molnar [EMAIL PROTECTED] --- include/asm-ia64/percpu.h |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Index: linux-x86.q/include/asm-ia64/percpu.h === --- linux-x86.q.orig/include/asm-ia64/percpu.h +++ linux-x86.q/include/asm-ia64/percpu.h @@ -15,12 +15,12 @@ #include linux/threads.h +#ifdef CONFIG_SMP + #ifdef HAVE_MODEL_SMALL_ATTRIBUTE # define PER_CPU_ATTRIBUTES__attribute__((__model__ (__small__))) #endif -#ifdef CONFIG_SMP - #define __my_cpu_offset__ia64_per_cpu_var(local_per_cpu_offset) extern void *per_cpu_init(void); ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: x86/non-x86: percpu, node ids, apic ids x86.git fixup
* Ingo Molnar [EMAIL PROTECTED] wrote: Some place in there. The CONFIG_SMP=n path in ia64 makes quite radical changes ... rather than putting all the per-cpu stuff into the top 64K of address space and providing a per-cpu TLB mapping for that range to a different physical address ... it just makes all the per-cpu stuff link as ordinary variables in .data. The error messages indicate that some of the new code is unaware of this. ah, that was the vital clue. The patch below makes the small memory model only defined on SMP, and makes the config build/link fine here. Does this build and boot on your box? if this works for you then could you please send me your Acked-by as well, for this and the other ia64 changes, so that we can send these to Linus ASAP? Ingo ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
RE: x86/non-x86: percpu, node ids, apic ids x86.git fixup
ah, that was the vital clue. The patch below makes the small memory model only defined on SMP, and makes the config build/link fine here. Does this build and boot on your box? I applied this on top of the git pull from git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86.git and I see see a build problem for SMP=n :-( -Tony ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: x86/non-x86: percpu, node ids, apic ids x86.git fixup
* Luck, Tony [EMAIL PROTECTED] wrote: ah, that was the vital clue. The patch below makes the small memory model only defined on SMP, and makes the config build/link fine here. Does this build and boot on your box? I applied this on top of the git pull from git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86.git and I see see a build problem for SMP=n :-( could you send the .config you are using? Ingo ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
RE: x86/non-x86: percpu, node ids, apic ids x86.git fixup
could you send the .config you are using? Ok. Attached. -Tony upconfig Description: upconfig ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: x86/non-x86: percpu, node ids, apic ids x86.git fixup
* Luck, Tony [EMAIL PROTECTED] wrote: could you send the .config you are using? Ok. Attached. thanks a ton - this produced a link error here too. after half an hour of head scratching, the updated patch below solves the build problem. The problem i believe is this code in arch/ia64/kernel/mca_asm.S: #define GET_IA64_MCA_DATA(reg) \ GET_THIS_PADDR(reg, ia64_mca_data) \ ;; \ ld8 reg=[reg] this i believe builds an implicit dependency between the mca_asm.o position within the image and the ia64_mca_data percpu variable it accesses - it relies on the immediate 22 addressing mode that has 4MB of scope. Per chance, the .config you sent creates a 14MB image, and the percpu variables moved too far away for the linker to be able to fulfill this constraint. The workaround is to define PER_CPU_ATTRIBUTES to link percpu variables back into the .percpu section on UP too - which ia64 links specially into its vmlinux.lds. But ultimately i think the better solution would be to remove this dependency between arch/ia64/kernel/mca_asm.S and the position of the percpu data. Is my analysis correct? Do you like my fix and does the patch build and boot on your system? Thanks, Ingo --- Subject: ia64: on UP percpu variables are not small memory model From: Ingo Molnar [EMAIL PROTECTED] Tony says: | The CONFIG_SMP=n path in ia64 makes quite radical changes ... rather | than putting all the per-cpu stuff into the top 64K of address space | and providing a per-cpu TLB mapping for that range to a different | physical address ... it just makes all the per-cpu stuff link as ordinary | variables in .data. the new generic percpu code got confused about this as PER_CPU_ATTRIBUTES was defined even on UP, so it picked up that small memory model - which was not possible to get linked. The right fix is to only define that on SMP. This resolved the build failures in my cross-compiling environment. also link these variables into the .percpu section - some assembly code has offset dependencies. Signed-off-by: Ingo Molnar [EMAIL PROTECTED] --- include/asm-ia64/percpu.h |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) Index: linux-x86.q/include/asm-ia64/percpu.h === --- linux-x86.q.orig/include/asm-ia64/percpu.h +++ linux-x86.q/include/asm-ia64/percpu.h @@ -15,18 +15,20 @@ #include linux/threads.h +#ifdef CONFIG_SMP + #ifdef HAVE_MODEL_SMALL_ATTRIBUTE # define PER_CPU_ATTRIBUTES__attribute__((__model__ (__small__))) #endif -#ifdef CONFIG_SMP - #define __my_cpu_offset__ia64_per_cpu_var(local_per_cpu_offset) extern void *per_cpu_init(void); #else /* ! SMP */ +#define PER_CPU_ATTRIBUTES __attribute__((__section__(.data.percpu))) + #define per_cpu_init() (__phys_per_cpu_start) #endif /* SMP */ ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
RE: x86/non-x86: percpu, node ids, apic ids x86.git fixup
this i believe builds an implicit dependency between the mca_asm.o position within the image and the ia64_mca_data percpu variable it accesses - it relies on the immediate 22 addressing mode that has 4MB of scope. Per chance, the .config you sent creates a 14MB image, and the percpu variables moved too far away for the linker to be able to fulfill this constraint. Sounds very plausible. The workaround is to define PER_CPU_ATTRIBUTES to link percpu variables back into the .percpu section on UP too - which ia64 links specially into its vmlinux.lds. But ultimately i think the better solution would be to remove this dependency between arch/ia64/kernel/mca_asm.S and the position of the percpu data. Yup. That fixes the build ... the resulting binary doesn't boot though :-( I just realized that it has been a while since I tried booting a UP kernel ... so the problem may be unrelated bitrot elsewhere. Overall you are right that the mca_asm.S code should not be dependent on the relative location of the data objects. I'll start digging on why this doesn't boot ... but you might as well send the fixes so far upstream to Linus so that the SMP fix is available (which is all anyone really cares about ... there are very, very few UP ia64 systems in existence). Acked-by: Tony Luck [EMAIL PROTECTED] -Tony ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: x86/non-x86: percpu, node ids, apic ids x86.git fixup
Ingo Molnar wrote: * Luck, Tony [EMAIL PROTECTED] wrote: Could you check the patch below? With this applied to latest -git, ia64 buils fine for me in a cross-compiling environment. (but i dont know whether it boots ...) Uni-processor build still fails with this patch (config is arch/ia64/configs/tiger_defconfig with CONFIG_SMP switched from =y to =n). could you try the full patchset that Travis has just sent and which i've put into x86.git, you can pull it from: git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86.git it's a fixes only tree, ontop of Linus-very-latest. Head 4b9e425c25f84. [pull from ssh://master.kernel.org if it's not on git.kernel.org yet, uploaded it this very minute.] Just FYI, the following diff from the above tree applied to linux-2.6.git works with ps3_defconfig on the PS3 (powerpc): git diff dd430ca20c40ecccd6954a7efd13d4398f507728..3823daf866c272c670dda7dc6179a647da64467f -Geoff ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: x86/non-x86: percpu, node ids, apic ids x86.git fixup
* Luck, Tony [EMAIL PROTECTED] wrote: I'll start digging on why this doesn't boot ... but you might as well send the fixes so far upstream to Linus so that the SMP fix is available (which is all anyone really cares about ... there are very, very few UP ia64 systems in existence). Acked-by: Tony Luck [EMAIL PROTECTED] thanks alot! Can i also add your Acked-by to this patch: Subject: ia64: use generic percpu From: [EMAIL PROTECTED] it seems like a sensible cleanup to me. Ingo ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[powerpc changes] Re: x86/non-x86: percpu, node ids, apic ids x86.git fixup
* Olof Johansson [EMAIL PROTECTED] wrote: could you try the full patchset that Travis has just sent and which i've put into x86.git, you can pull it from: Looks ok for powerpc so far, I haven't gotten through all defconfigs yet but the first ones that failed before build now. pasemi_defconfig boots as well. could the PowerPC maintainers please Ack the following patch (attached below): Subject: POWERPC: use generic per cpu From: [EMAIL PROTECTED] so that we can push this fix upstream ASAP? Ingo --- Subject: POWERPC: use generic per cpu From: [EMAIL PROTECTED] Powerpc has a way to determine the address of the per cpu area of the currently executing processor via the paca and the array of per cpu offsets is avoided by looking up the per cpu area from the remote paca's (copying x86_64). Cc: Paul Mackerras [EMAIL PROTECTED] Cc: Geert Uytterhoeven [EMAIL PROTECTED] Signed-off-by: Mike Travis [EMAIL PROTECTED] Signed-off-by: Ingo Molnar [EMAIL PROTECTED] --- include/asm-powerpc/percpu.h | 22 +++--- 1 file changed, 3 insertions(+), 19 deletions(-) Index: linux-x86.q/include/asm-powerpc/percpu.h === --- linux-x86.q.orig/include/asm-powerpc/percpu.h +++ linux-x86.q/include/asm-powerpc/percpu.h @@ -13,28 +13,12 @@ #include asm/paca.h #define __per_cpu_offset(cpu) (paca[cpu].data_offset) -#define __my_cpu_offset() get_paca()-data_offset +#define __my_cpu_offset get_paca()-data_offset #define per_cpu_offset(x) (__per_cpu_offset(x)) -/* var is in discarded region: offset to particular copy we want */ -#define per_cpu(var, cpu) (*RELOC_HIDE(per_cpu__##var, __per_cpu_offset(cpu))) -#define __get_cpu_var(var) (*RELOC_HIDE(per_cpu__##var, __my_cpu_offset())) -#define __raw_get_cpu_var(var) (*RELOC_HIDE(per_cpu__##var, local_paca-data_offset)) +#endif /* CONFIG_SMP */ +#endif /* __powerpc64__ */ -extern void setup_per_cpu_areas(void); - -#else /* ! SMP */ - -#define per_cpu(var, cpu) (*((void)(cpu), per_cpu__##var)) -#define __get_cpu_var(var) per_cpu__##var -#define __raw_get_cpu_var(var) per_cpu__##var - -#endif /* SMP */ - -#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name - -#else #include asm-generic/percpu.h -#endif #endif /* _ASM_POWERPC_PERCPU_H_ */ ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [powerpc changes] Re: x86/non-x86: percpu, node ids, apic ids x86.git fixup
On Wed, Jan 30, 2008 at 10:25:58PM +0100, Ingo Molnar wrote: * Olof Johansson [EMAIL PROTECTED] wrote: could you try the full patchset that Travis has just sent and which i've put into x86.git, you can pull it from: Looks ok for powerpc so far, I haven't gotten through all defconfigs yet but the first ones that failed before build now. pasemi_defconfig boots as well. could the PowerPC maintainers please Ack the following patch (attached below): Subject: POWERPC: use generic per cpu From: [EMAIL PROTECTED] so that we can push this fix upstream ASAP? Subject: POWERPC: use generic per cpu From: [EMAIL PROTECTED] Powerpc has a way to determine the address of the per cpu area of the currently executing processor via the paca and the array of per cpu offsets is avoided by looking up the per cpu area from the remote paca's (copying x86_64). Cc: Paul Mackerras [EMAIL PROTECTED] Cc: Geert Uytterhoeven [EMAIL PROTECTED] Signed-off-by: Mike Travis [EMAIL PROTECTED] Signed-off-by: Ingo Molnar [EMAIL PROTECTED] Paul is at LCA, I'm not sure if he's reading email. Looks good to me so: Acked-by: Olof Johansson [EMAIL PROTECTED] -Olof ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [powerpc changes] Re: x86/non-x86: percpu, node ids, apic ids x86.git fixup
Ingo Molnar wrote: * Olof Johansson [EMAIL PROTECTED] wrote: could you try the full patchset that Travis has just sent and which i've put into x86.git, you can pull it from: Looks ok for powerpc so far, I haven't gotten through all defconfigs yet but the first ones that failed before build now. pasemi_defconfig boots as well. could the PowerPC maintainers please Ack the following patch (attached below): Subject: POWERPC: use generic per cpu From: [EMAIL PROTECTED] so that we can push this fix upstream ASAP? Ingo --- Subject: POWERPC: use generic per cpu From: [EMAIL PROTECTED] Powerpc has a way to determine the address of the per cpu area of the currently executing processor via the paca and the array of per cpu offsets is avoided by looking up the per cpu area from the remote paca's (copying x86_64). Cc: Paul Mackerras [EMAIL PROTECTED] Cc: Geert Uytterhoeven [EMAIL PROTECTED] Signed-off-by: Mike Travis [EMAIL PROTECTED] Signed-off-by: Ingo Molnar [EMAIL PROTECTED] --- include/asm-powerpc/percpu.h | 22 +++--- 1 file changed, 3 insertions(+), 19 deletions(-) Tested on PS3 with ps3_defconfig and works OK. Acked-by: Geoff Levand [EMAIL PROTECTED] ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
RE: x86/non-x86: percpu, node ids, apic ids x86.git fixup
I'll start digging on why this doesn't boot ... but you might as well send the fixes so far upstream to Linus so that the SMP fix is available Well a pure 2.6.24 version compiled with CONFIG_SMP=n booted just fine, so the breakage is recent ... and more than likely related to this change. I've only had a casual dig at the failing case ... kernel dies in memset() as called from kmem_cache_alloc() with the address being written as 0x40117b48 (which is off in the virtual address space range used by users ... not a kernel address). I'll dig some more tomorrow. -Tony ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev