loops_per_sec
Ralf,
The variable loops_per_sec has become loops_per_jiffy around 2.4.1, breaking the mips delay functions. I edited include/asm-mips/delay.h to rename the variable. There's other places in mips64 where loops_per_sec is being used. Furthermore, since it's loops per "jiffy", the delay must be further increased by a factor of HZ.
Pete
Quoted 5 lines · Pete Popov
The variable
loops_per_sechas becomeloops_per_jiffyaround 2.4.1, breaking the mips delay functions. I editedinclude/asm-mips/delay.hto rename the variable. There's other places in mips64 whereloops_per_secis being used. Furthermore, since it's loops per "jiffy", the delay must be further increased by a factor of HZ.
A partial fix appears to be in place for mips already. This patch should complete the picture. I need people using mips and mips64 to confirm that it works please; I can't test it right now.
Signature · 2 lines
Keith M Wesolowski <[email protected]> http://foobazco.org/~wesolows ------(( Project Foobazco Coordinator and Network Administrator ))------
Index: arch/mips/kernel/setup.c
===================================================================
RCS file: /cvs/linux/arch/mips/kernel/setup.c,v
retrieving revision 1.53
mips/kernel/setup.c +0 -2
@@ -62,8 +62,6 @@*/ char cyclecounter_available; -unsigned long loops_per_sec; -/* * There are several bus types available for MIPS machines. "RISC PC" * type machines have ISA, EISA, VLB or PCI available, DECstations
Index: arch/mips64/kernel/proc.c
===================================================================
RCS file: /cvs/linux/arch/mips64/kernel/proc.c,v
retrieving revision 1.4
mips64/kernel/proc.c +2 -2
@@ -48,8 +48,8 @@mach_group_to_name[mips_machgroup][mips_machtype]); */ len +=sprintf (buffer + len,"BogoMIPS\t\t: %lu.%02lu\n" , - (loops_per_sec +2500 ) /500000 , - ((loops_per_sec +2500 ) /5000 ) %100 ); + (loops_per_jiffy +2500 ) / (500000 /HZ ), + ((loops_per_jiffy +2500 ) / (5000 /HZ )) %100 );/* len += sprintf(buffer + len, "Number of cpus\t\t: %d\n", smp_num_cpus);*/ #if defined (__MIPSEB__) len +=sprintf (buffer + len,"byteorder\t\t: big endian\n" );
Index: arch/mips64/kernel/setup.c
===================================================================
RCS file: /cvs/linux/arch/mips64/kernel/setup.c,v
retrieving revision 1.17
mips64/kernel/setup.c +0 -2
@@ -56,8 +56,6 @@*/ char cyclecounter_available; -unsigned long loops_per_sec; -/* * Set if box has EISA slots. */
Index: include/asm-mips/delay.h
===================================================================
RCS file: /cvs/linux/include/asm-mips/delay.h,v
retrieving revision 1.9
asm-mips/delay.h +5 -5
@@ -11,7 +11,7 @@#include <linux/config.h> -extern unsigned long loops_per_sec; +extern unsigned long loops_per_jiffy;extern __inline__void __delay (unsigned long loops)
@@ -35,21 +35,21 @@* first constant multiplications gets optimized away if the delay is * a constant) */ -extern __inline__void __udelay (unsigned long usecs,unsigned long lps) +extern __inline__void __udelay (unsigned long usecs,unsigned long lpj) {unsigned long lo; - usecs *=0x000010c6 ;/* 2**32 / 1000000 */ + usecs *=0x00068db8 ;/* 2**32 / (1000000 / HZ) */ __asm__("multu\t%2,%3" :"=h" (usecs),"=l" (lo) - :"r" (usecs),"r" (lps)); + :"r" (usecs),"r" (lpj));__delay (usecs); }#ifdef CONFIG_SMP #define __udelay_val cpu_data[smp_processor_id()].udelay_val#else -#define __udelay_val loops_per_sec +#define __udelay_val loops_per_jiffy#endif #define udelay (usecs) __udelay((usecs),__udelay_val)
Index: include/asm-mips64/delay.h
===================================================================
RCS file: /cvs/linux/include/asm-mips64/delay.h,v
retrieving revision 1.7
asm-mips64/delay.h +5 -5
@@ -12,7 +12,7 @@#include <linux/config.h> -extern unsigned long loops_per_sec; +extern unsigned long loops_per_jiffy;extern __inline__void __delay (unsigned long loops)
@@ -36,21 +36,21 @@* first constant multiplications gets optimized away if the delay is * a constant) */ -extern __inline__void __udelay (unsigned long usecs,unsigned long lps) +extern __inline__void __udelay (unsigned long usecs,unsigned long lpj) {unsigned long lo; - usecs *=0x000010c6f7a0b5edUL ;/* 2**64 / 1000000 */ + usecs *=0x00068db8bac710cbUL ;/* 2**64 / (1000000 / HZ) */ __asm__("dmultu\t%2,%3" :"=h" (usecs),"=l" (lo) - :"r" (usecs),"r" (lps)); + :"r" (usecs),"r" (lpj));__delay (usecs); }#ifdef CONFIG_SMP #define __udelay_val cpu_data[smp_processor_id()].udelay_val#else -#define __udelay_val loops_per_sec +#define __udelay_val loops_per_jiffy#endif #define udelay (usecs) __udelay((usecs),__udelay_val)
Index: include/asm-mips64/smp.h
===================================================================
RCS file: /cvs/linux/include/asm-mips64/smp.h,v
retrieving revision 1.3
asm-mips64/smp.h +1 -1
@@ -10,7 +10,7 @@ #if 0 struct cpuinfo_mips { /* XXX */ - unsigned long loops_per_sec; + unsigned long loops_per_jiffy; unsigned long last_asn; unsigned long *pgd_cache; unsigned long *pte_cache;