lkml.org 
[lkml]   [1998]   [Oct]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch, 2.1.124] Re: BogoMIPS

On Tue, 6 Oct 1998, Richard B. Johnson wrote:

> > Sorry, it is not. Someone shown timings of empty loop at they were
> > dependend on placement of code in page. (It gives plenty of sense if
> > code happens to cross page boundary.)
>
> It does not make any sense. That kind is situation is the primary
> reason for the instruction-queue (which includes the 32-byte code-
> queue + the prefetcher + the external cache). When register-to-
> register looping operations occur, everything will have already been
> fetched. It is only when memory oprands occur, or you run off the
> cache-line with new code, that any new code fetches occur.

depending on how smart the TLB code is, it _can_ make alot of sense. It's
in the L1 cache, but it's still physically indexed, while the CPU needs a
linear address. So we go through the TLB phase no matter how hard it is
already cached. And it's naive to think that in such a scenario, going
through page boundaries is a simple matter in the CPU, especially for
typically streamlike memory access pattern, like code fetching.

anyway, i'd be curious wether the attached patch shows any effect on
machines that are affected by BogoMIPS irregularities. We cannot .align
PAGE_SIZE due to ld limitations, but we can pull another trick to force
__delay on a page boundary. (the current version wastes about 2000 bytes
of nonswappable memory too)

the patch works here and is against 2.1.124.

-- mingo

--- linux/arch/i386/lib/delay.c.orig4 Tue Oct 6 22:38:34 1998
+++ linux/arch/i386/lib/delay.c Tue Oct 6 22:56:56 1998
@@ -15,7 +15,11 @@
#include <asm/smp.h>
#endif

-void __delay(unsigned long loops)
+#define __delayfunc(prototype) \
+ prototype __attribute__ ((__section__ (".text.delay"))); \
+ prototype
+
+__delayfunc(void __delay (unsigned long loops))
{
__asm__ __volatile__(
"1:\tdecl %0\n\tjns 1b"
@@ -24,7 +28,7 @@
:"ax");
}

-inline void __const_udelay(unsigned long xloops)
+__delayfunc(inline void __const_udelay(unsigned long xloops))
{
__asm__("mull %0"
:"=d" (xloops)
@@ -33,7 +37,9 @@
__delay(xloops);
}

-void __udelay(unsigned long usecs)
+__delayfunc(void __udelay(unsigned long usecs))
{
__const_udelay(usecs * 0x000010c6); /* 2**32 / 1000000 */
}
+
+
--- linux/arch/i386/vmlinux.lds.orig4 Tue Oct 6 22:47:11 1998
+++ linux/arch/i386/vmlinux.lds Tue Oct 6 22:47:49 1998
@@ -14,6 +14,8 @@
*(.gnu.warning)
} = 0x9090
.text.lock : { *(.text.lock) } /* out-of-line lock text */
+ . = ALIGN(4096);
+ .text.delay : { *(.text.delay) } /* page aligned delay code */
.rodata : { *(.rodata) }
.kstrtab : { *(.kstrtab) }


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:44    [W:0.203 / U:1.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site