Re: [PATCH] Re: 2.4.0-testX fails to compile on my Athlon
Petr Vandrovec wrote: > > Unfortunately, real diff is at home... And it has one bad side effect, that > you must rerun 'make dep' manually if you modify task_struct in > linux/sched.h, as asm/asm_offsets.h -> linux/sched.h dependancy is not > handled by makefiles. But I do not do this modification very often, > fortunately... Maybe if I placed check_asm somewhere else than where sparc > tree has it... > So diff is not at home anymore... Maybe it should be polished more, as #ifdef CHECK_ASM in smp.h is not nice (probably generating dummy asm_offsets.h for check_asm pass), but after I looked at code generated by this patch and by Tim's patch, I think that Tim's approach with moving in_interrupt() testing out-of-line from asm/string.h is better. Best regards, Petr Vandrovec [EMAIL PROTECTED] diff -urdN linux/arch/i386/Makefile linux/arch/i386/Makefile --- linux/arch/i386/MakefileFri Dec 29 22:07:19 2000 +++ linux/arch/i386/MakefileWed Jan 3 10:07:10 2001 @@ -139,5 +139,8 @@ archmrproper: -archdep: +archdep: check_asm @$(MAKEBOOT) dep + +check_asm: + $(MAKE) -C arch/i386/kernel check_asm diff -urdN linux/arch/i386/kernel/Makefile linux/arch/i386/kernel/Makefile --- linux/arch/i386/kernel/Makefile Fri Dec 29 22:35:47 2000 +++ linux/arch/i386/kernel/Makefile Wed Jan 3 10:32:20 2001 @@ -7,6 +7,8 @@ # # Note 2! The CFLAGS definitions are now in the main makefile... +SH := $(CONFIG_SHELL) + .S.o: $(CC) $(AFLAGS) -traditional -c $< -o $*.o @@ -40,5 +42,95 @@ obj-$(CONFIG_X86_LOCAL_APIC) += apic.o obj-$(CONFIG_X86_IO_APIC) += io_apic.o mpparse.o obj-$(CONFIG_X86_VISWS_APIC) += visws_apic.o + +check_asm: dummy + @if [ ! -r $(HPATH)/asm/asm_offsets.h ] ; then \ + touch $(HPATH)/asm/asm_offsets.h ; \ + fi + @echo "/* Automatically generated. Do not edit. */" > asm_offsets.h + @echo "#ifndef __ASM_OFFSETS_H__" >> asm_offsets.h + @echo "#define __ASM_OFFSETS_H__" >> asm_offsets.h + @echo "" >> asm_offsets.h + @echo "#include " >> asm_offsets.h + @echo "" >> asm_offsets.h + @echo "#ifndef CONFIG_SMP" >> asm_offsets.h + @echo "" >> asm_offsets.h + @echo "#include " > tmp.c + @echo "#undef CONFIG_SMP" >> tmp.c + @echo "#include " >> tmp.c + $(CPP) $(CPPFLAGS) tmp.c -o tmp.i + @echo "/* Automatically generated. Do not edit. */" > check_asm_data.c + @echo "#include " >> check_asm_data.c + @echo "#undef CONFIG_SMP" >> check_asm_data.c + @echo "#include " >> check_asm_data.c + @echo "unsigned int check_asm_data[] = {" >> check_asm_data.c + $(SH) ./check_asm.sh -data task tmp.i check_asm_data.c + $(SH) ./check_asm.sh -data mm tmp.i check_asm_data.c + $(SH) ./check_asm.sh -data thread tmp.i check_asm_data.c + @echo '};' >> check_asm_data.c + $(CC) $(CFLAGS) -DCHECK_ASM -S -o check_asm_data.s check_asm_data.c + @echo "/* Automatically generated. Do not edit. */" > check_asm.c + @echo 'extern int printf(const char *fmt, ...);' >>check_asm.c + @echo "unsigned int check_asm_data[] = {" >> check_asm.c + $(SH) ./check_asm.sh -ints check_asm_data.s check_asm.c + @echo "};" >> check_asm.c + @echo 'int main(void) {' >> check_asm.c + @echo 'int i = 0;' >> check_asm.c + $(SH) ./check_asm.sh -printf task tmp.i check_asm.c + $(SH) ./check_asm.sh -printf mm tmp.i check_asm.c + $(SH) ./check_asm.sh -printf thread tmp.i check_asm.c + @echo 'return 0; }' >> check_asm.c + @rm -f tmp.[ci] check_asm_data.[cs] + $(HOSTCC) -o check_asm check_asm.c + ./check_asm >> asm_offsets.h + @rm -f check_asm check_asm.c + @echo "" >> asm_offsets.h + @echo "#else /* CONFIG_SMP */" >> asm_offsets.h + @echo "" >> asm_offsets.h + @echo "#include " > tmp.c + @echo "#undef CONFIG_SMP" >> tmp.c + @echo "#define CONFIG_SMP 1" >> tmp.c + @echo "#include " >> tmp.c + $(CPP) $(CPPFLAGS) tmp.c -o tmp.i + @echo "/* Automatically generated. Do not edit. */" > check_asm_data.c + @echo "#include " >> check_asm_data.c + @echo "#undef CONFIG_SMP" >> check_asm_data.c + @echo "#define CONFIG_SMP 1" >> check_asm_data.c + @echo "#include " >> check_asm_data.c + @echo "unsigned int check_asm_data[] = {" >> check_asm_data.c + $(SH) ./check_asm.sh -data task tmp.i check_asm_data.c + $(SH) ./check_asm.sh -data mm tmp.i check_asm_data.c + $(SH) ./check_asm.sh -data thread tmp.i check_asm_data.c + @echo '};' >> check_asm_data.c + $(CC) $(CFLAGS) -DCHECK_ASM -S -o check_asm_data.s check_asm_data.c + @echo "/* Automatically generated. Do not edit. */" > check_asm.c + @echo 'extern int printf(const char *fmt, ...);' >>check_asm.c +
Re: [PATCH] Re: 2.4.0-testX fails to compile on my Athlon
Petr Vandrovec wrote: Unfortunately, real diff is at home... And it has one bad side effect, that you must rerun 'make dep' manually if you modify task_struct in linux/sched.h, as asm/asm_offsets.h - linux/sched.h dependancy is not handled by makefiles. But I do not do this modification very often, fortunately... Maybe if I placed check_asm somewhere else than where sparc tree has it... So diff is not at home anymore... Maybe it should be polished more, as #ifdef CHECK_ASM in smp.h is not nice (probably generating dummy asm_offsets.h for check_asm pass), but after I looked at code generated by this patch and by Tim's patch, I think that Tim's approach with moving in_interrupt() testing out-of-line from asm/string.h is better. Best regards, Petr Vandrovec [EMAIL PROTECTED] diff -urdN linux/arch/i386/Makefile linux/arch/i386/Makefile --- linux/arch/i386/MakefileFri Dec 29 22:07:19 2000 +++ linux/arch/i386/MakefileWed Jan 3 10:07:10 2001 @@ -139,5 +139,8 @@ archmrproper: -archdep: +archdep: check_asm @$(MAKEBOOT) dep + +check_asm: + $(MAKE) -C arch/i386/kernel check_asm diff -urdN linux/arch/i386/kernel/Makefile linux/arch/i386/kernel/Makefile --- linux/arch/i386/kernel/Makefile Fri Dec 29 22:35:47 2000 +++ linux/arch/i386/kernel/Makefile Wed Jan 3 10:32:20 2001 @@ -7,6 +7,8 @@ # # Note 2! The CFLAGS definitions are now in the main makefile... +SH := $(CONFIG_SHELL) + .S.o: $(CC) $(AFLAGS) -traditional -c $ -o $*.o @@ -40,5 +42,95 @@ obj-$(CONFIG_X86_LOCAL_APIC) += apic.o obj-$(CONFIG_X86_IO_APIC) += io_apic.o mpparse.o obj-$(CONFIG_X86_VISWS_APIC) += visws_apic.o + +check_asm: dummy + @if [ ! -r $(HPATH)/asm/asm_offsets.h ] ; then \ + touch $(HPATH)/asm/asm_offsets.h ; \ + fi + @echo "/* Automatically generated. Do not edit. */" asm_offsets.h + @echo "#ifndef __ASM_OFFSETS_H__" asm_offsets.h + @echo "#define __ASM_OFFSETS_H__" asm_offsets.h + @echo "" asm_offsets.h + @echo "#include linux/config.h" asm_offsets.h + @echo "" asm_offsets.h + @echo "#ifndef CONFIG_SMP" asm_offsets.h + @echo "" asm_offsets.h + @echo "#include linux/config.h" tmp.c + @echo "#undef CONFIG_SMP" tmp.c + @echo "#include linux/sched.h" tmp.c + $(CPP) $(CPPFLAGS) tmp.c -o tmp.i + @echo "/* Automatically generated. Do not edit. */" check_asm_data.c + @echo "#include linux/config.h" check_asm_data.c + @echo "#undef CONFIG_SMP" check_asm_data.c + @echo "#include linux/sched.h" check_asm_data.c + @echo "unsigned int check_asm_data[] = {" check_asm_data.c + $(SH) ./check_asm.sh -data task tmp.i check_asm_data.c + $(SH) ./check_asm.sh -data mm tmp.i check_asm_data.c + $(SH) ./check_asm.sh -data thread tmp.i check_asm_data.c + @echo '};' check_asm_data.c + $(CC) $(CFLAGS) -DCHECK_ASM -S -o check_asm_data.s check_asm_data.c + @echo "/* Automatically generated. Do not edit. */" check_asm.c + @echo 'extern int printf(const char *fmt, ...);' check_asm.c + @echo "unsigned int check_asm_data[] = {" check_asm.c + $(SH) ./check_asm.sh -ints check_asm_data.s check_asm.c + @echo "};" check_asm.c + @echo 'int main(void) {' check_asm.c + @echo 'int i = 0;' check_asm.c + $(SH) ./check_asm.sh -printf task tmp.i check_asm.c + $(SH) ./check_asm.sh -printf mm tmp.i check_asm.c + $(SH) ./check_asm.sh -printf thread tmp.i check_asm.c + @echo 'return 0; }' check_asm.c + @rm -f tmp.[ci] check_asm_data.[cs] + $(HOSTCC) -o check_asm check_asm.c + ./check_asm asm_offsets.h + @rm -f check_asm check_asm.c + @echo "" asm_offsets.h + @echo "#else /* CONFIG_SMP */" asm_offsets.h + @echo "" asm_offsets.h + @echo "#include linux/config.h" tmp.c + @echo "#undef CONFIG_SMP" tmp.c + @echo "#define CONFIG_SMP 1" tmp.c + @echo "#include linux/sched.h" tmp.c + $(CPP) $(CPPFLAGS) tmp.c -o tmp.i + @echo "/* Automatically generated. Do not edit. */" check_asm_data.c + @echo "#include linux/config.h" check_asm_data.c + @echo "#undef CONFIG_SMP" check_asm_data.c + @echo "#define CONFIG_SMP 1" check_asm_data.c + @echo "#include linux/sched.h" check_asm_data.c + @echo "unsigned int check_asm_data[] = {" check_asm_data.c + $(SH) ./check_asm.sh -data task tmp.i check_asm_data.c + $(SH) ./check_asm.sh -data mm tmp.i check_asm_data.c + $(SH) ./check_asm.sh -data thread tmp.i check_asm_data.c + @echo '};' check_asm_data.c + $(CC) $(CFLAGS) -DCHECK_ASM -S -o check_asm_data.s check_asm_data.c + @echo "/* Automatically generated. Do not edit. */" check_asm.c + @echo 'extern int
Re: [PATCH] Re: 2.4.0-testX fails to compile on my Athlon
> For 2.4.0, probably disabling 3DNow in kernel when using SMP is best > solution, as AFAIK nobody tested correctness of 3DNow code on SMP... Or is > it obviously correct? Its obviously correct. At least if it doesnt work the MMX/XMM code for raid should also fail horribly ;) - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Re: 2.4.0-testX fails to compile on my Athlon
On 2 Jan 01 at 3:51, Tom Leete wrote: > Matt Wright wrote: > > > > I've looked for answers to this question before, but all I could find was > > someone asking a similar question and no replies... > > > > I'm having great trouble getting 2.4.0-testX to compile on my system when > > I select Athlon/K7 as the Processor Family > > > > I've attached below the error's I'm getting the kernel DOES compile if > > I select anything else... but I don't have anything else :) > > The problem with SMP+K7 builds is that include/asm-i386/string.h has no > business using in_interrupt(). That introduces circular dependencies which > nobody has been able to rearrange away. I solved it by porting check_asm code from arch/sparc into i386 (I had to learn check_asm about 'union'), and then replacing smp_processor_id() define in smp.h with #include #include #define smp_processor_id() (*(int*)(((unsigned char*)current)+AOFF_task_processor)) So now I still have real spinlocks (so I can debug some problems with nested console_lock), but inline memcpy... Unfortunately, real diff is at home... And it has one bad side effect, that you must rerun 'make dep' manually if you modify task_struct in linux/sched.h, as asm/asm_offsets.h -> linux/sched.h dependancy is not handled by makefiles. But I do not do this modification very often, fortunately... Maybe if I placed check_asm somewhere else than where sparc tree has it... For 2.4.0, probably disabling 3DNow in kernel when using SMP is best solution, as AFAIK nobody tested correctness of 3DNow code on SMP... Or is it obviously correct? Best regards, Petr Vandrovec [EMAIL PROTECTED] - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
[PATCH] Re: 2.4.0-testX fails to compile on my Athlon
Matt Wright wrote: > > I've looked for answers to this question before, but all I could find was > someone asking a similar question and no replies... > > I'm having great trouble getting 2.4.0-testX to compile on my system when > I select Athlon/K7 as the Processor Family > > I've attached below the error's I'm getting the kernel DOES compile if > I select anything else... but I don't have anything else :) > Hello, The problem with SMP+K7 builds is that include/asm-i386/string.h has no business using in_interrupt(). That introduces circular dependencies which nobody has been able to rearrange away. Here is a patch I've posted here several times. It moves the mmx functions from string.h to arch/i386/lib/mmx.c (lib.a).It does not __inline__ the call for memcpy() of large or unknown length. Athlon supposedly does branch prediction for function pointers, so that shouldn't hurt too much. The point is to get it to build: optimize later. The actual usefulness of this may be limited to development on UP machines. I don't know whether the AMD-760 SMP boards will be compatable with Linux SMP. Hearsay is that they will have significant architectural differences with Intel flavored SMP boards. Cheers, Tom Patch as attachment to avoid mailer brain damage. It has not been tested lately, but still applies cleanish. --- linux/arch/i386/lib/mmx.c.orig Wed Oct 27 21:30:39 1999 +++ linux/arch/i386/lib/mmx.c Tue Jun 6 04:20:01 2000 @@ -1,6 +1,7 @@ #include #include #include +#include /* * MMX 3DNow! library helper functions @@ -88,6 +89,21 @@ stts(); return p; } + +void * __constant_mmx_memcpy3d(void * to, const void * from, size_t len) +{ + if(in_interrupt()) + return __constant_memcpy(to, from, len); + return _mmx_memcpy(to, from, len); +} + +void *__mmx_memcpy3d(void *to, const void *from, size_t len) +{ + if(in_interrupt()) + return __memcpy(to, from, len); + return _mmx_memcpy(to, from, len); +} + static void fast_clear_page(void *page) { --- linux/include/asm-i386/mmx.h.orig Tue Jun 6 03:05:02 2000 +++ linux/include/asm-i386/mmx.hTue Jun 6 04:25:27 2000 @@ -10,5 +10,7 @@ extern void *_mmx_memcpy(void *to, const void *from, size_t size); extern void mmx_clear_page(void *page); extern void mmx_copy_page(void *to, void *from); +extern __inline__ void *__constant_mmx_memcpy3d(void * to, const void * from, size_t +len); +extern __inline__ void *__mmx_memcpy3d(void *to, const void *from, size_t len); #endif --- linux/include/asm-i386/string.h.origTue Jun 6 03:05:02 2000 +++ linux/include/asm-i386/string.h Tue Jun 6 04:30:37 2000 @@ -287,13 +287,6 @@ #ifdef CONFIG_X86_USE_3DNOW -/* All this just for in_interrupt() ... */ - -#include -#include -#include -#include -#include #include /* @@ -302,16 +295,16 @@ static inline void * __constant_memcpy3d(void * to, const void * from, size_t len) { - if(len<512 || in_interrupt()) + if(len<512) return __constant_memcpy(to, from, len); - return _mmx_memcpy(to, from, len); + return __constant_mmx_memcpy3d(to, from, len); } extern __inline__ void *__memcpy3d(void *to, const void *from, size_t len) { - if(len<512 || in_interrupt()) + if(len<512) return __memcpy(to, from, len); - return _mmx_memcpy(to, from, len); + return __mmx_memcpy3d(to, from, len); } #define memcpy(t, f, n) \
[PATCH] Re: 2.4.0-testX fails to compile on my Athlon
Matt Wright wrote: I've looked for answers to this question before, but all I could find was someone asking a similar question and no replies... I'm having great trouble getting 2.4.0-testX to compile on my system when I select Athlon/K7 as the Processor Family I've attached below the error's I'm getting the kernel DOES compile if I select anything else... but I don't have anything else :) Hello, The problem with SMP+K7 builds is that include/asm-i386/string.h has no business using in_interrupt(). That introduces circular dependencies which nobody has been able to rearrange away. Here is a patch I've posted here several times. It moves the mmx functions from string.h to arch/i386/lib/mmx.c (lib.a).It does not __inline__ the call for memcpy() of large or unknown length. Athlon supposedly does branch prediction for function pointers, so that shouldn't hurt too much. The point is to get it to build: optimize later. The actual usefulness of this may be limited to development on UP machines. I don't know whether the AMD-760 SMP boards will be compatable with Linux SMP. Hearsay is that they will have significant architectural differences with Intel flavored SMP boards. Cheers, Tom Patch as attachment to avoid mailer brain damage. It has not been tested lately, but still applies cleanish. --- linux/arch/i386/lib/mmx.c.orig Wed Oct 27 21:30:39 1999 +++ linux/arch/i386/lib/mmx.c Tue Jun 6 04:20:01 2000 @@ -1,6 +1,7 @@ #include linux/types.h #include linux/string.h #include linux/sched.h +#include asm/hardirq.h /* * MMX 3DNow! library helper functions @@ -88,6 +89,21 @@ stts(); return p; } + +void * __constant_mmx_memcpy3d(void * to, const void * from, size_t len) +{ + if(in_interrupt()) + return __constant_memcpy(to, from, len); + return _mmx_memcpy(to, from, len); +} + +void *__mmx_memcpy3d(void *to, const void *from, size_t len) +{ + if(in_interrupt()) + return __memcpy(to, from, len); + return _mmx_memcpy(to, from, len); +} + static void fast_clear_page(void *page) { --- linux/include/asm-i386/mmx.h.orig Tue Jun 6 03:05:02 2000 +++ linux/include/asm-i386/mmx.hTue Jun 6 04:25:27 2000 @@ -10,5 +10,7 @@ extern void *_mmx_memcpy(void *to, const void *from, size_t size); extern void mmx_clear_page(void *page); extern void mmx_copy_page(void *to, void *from); +extern __inline__ void *__constant_mmx_memcpy3d(void * to, const void * from, size_t +len); +extern __inline__ void *__mmx_memcpy3d(void *to, const void *from, size_t len); #endif --- linux/include/asm-i386/string.h.origTue Jun 6 03:05:02 2000 +++ linux/include/asm-i386/string.h Tue Jun 6 04:30:37 2000 @@ -287,13 +287,6 @@ #ifdef CONFIG_X86_USE_3DNOW -/* All this just for in_interrupt() ... */ - -#include asm/system.h -#include asm/ptrace.h -#include linux/smp.h -#include linux/spinlock.h -#include linux/interrupt.h #include asm/mmx.h /* @@ -302,16 +295,16 @@ static inline void * __constant_memcpy3d(void * to, const void * from, size_t len) { - if(len512 || in_interrupt()) + if(len512) return __constant_memcpy(to, from, len); - return _mmx_memcpy(to, from, len); + return __constant_mmx_memcpy3d(to, from, len); } extern __inline__ void *__memcpy3d(void *to, const void *from, size_t len) { - if(len512 || in_interrupt()) + if(len512) return __memcpy(to, from, len); - return _mmx_memcpy(to, from, len); + return __mmx_memcpy3d(to, from, len); } #define memcpy(t, f, n) \
Re: [PATCH] Re: 2.4.0-testX fails to compile on my Athlon
On 2 Jan 01 at 3:51, Tom Leete wrote: Matt Wright wrote: I've looked for answers to this question before, but all I could find was someone asking a similar question and no replies... I'm having great trouble getting 2.4.0-testX to compile on my system when I select Athlon/K7 as the Processor Family I've attached below the error's I'm getting the kernel DOES compile if I select anything else... but I don't have anything else :) The problem with SMP+K7 builds is that include/asm-i386/string.h has no business using in_interrupt(). That introduces circular dependencies which nobody has been able to rearrange away. I solved it by porting check_asm code from arch/sparc into i386 (I had to learn check_asm about 'union'), and then replacing smp_processor_id() define in smp.h with #include asm/asm_offsets.h #include asm/current.h #define smp_processor_id() (*(int*)(((unsigned char*)current)+AOFF_task_processor)) So now I still have real spinlocks (so I can debug some problems with nested console_lock), but inline memcpy... Unfortunately, real diff is at home... And it has one bad side effect, that you must rerun 'make dep' manually if you modify task_struct in linux/sched.h, as asm/asm_offsets.h - linux/sched.h dependancy is not handled by makefiles. But I do not do this modification very often, fortunately... Maybe if I placed check_asm somewhere else than where sparc tree has it... For 2.4.0, probably disabling 3DNow in kernel when using SMP is best solution, as AFAIK nobody tested correctness of 3DNow code on SMP... Or is it obviously correct? Best regards, Petr Vandrovec [EMAIL PROTECTED] - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Re: 2.4.0-testX fails to compile on my Athlon
For 2.4.0, probably disabling 3DNow in kernel when using SMP is best solution, as AFAIK nobody tested correctness of 3DNow code on SMP... Or is it obviously correct? Its obviously correct. At least if it doesnt work the MMX/XMM code for raid should also fail horribly ;) - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/