From: Jeff Dike <jdike@ka...> - 2002-02-18 05:01:39
> With this patch it seems to work better but I still don't understand
> why the real value (reported by the real kernel on my system) is twice
> the value reported by the UM kernel. The "for" loop below expands to
> only 2 asm instructions, the same as the loop in __loop_delay()
> function (arch/i386/lib/delay.c).
Are you sure you read the assembly correctly? I get this with the UML
__delay for loop:
0x288 <__delay+12>: inc %eax
0x289 <__delay+13>: cmp %edx,%eax
0x28b <__delay+15>: jb 0x288 <__delay+12>
Three instructions, but I have no problem believing that one of them takes
twice as long as the others.
In any case, I just stole the i386 __loop_delay, and I get
Calibrating delay loop... 697.30 BogoMIPS
in UML, and
Calibrating delay loop... 1399.19 BogoMIPS
on the host.
So the 2-1 ratio is still there, despite the code being identical.
I wasn't too concerned about this, but at least it should silence the morons
who think that BogoMips ratings have something to do with real-world
On Mon, 18 Feb 2002, Jeff Dike wrote:
> Are you sure you read the assembly correctly? I get this with the UML
> __delay for loop:
> 0x288 <__delay+12>: inc %eax
> 0x289 <__delay+13>: cmp %edx,%eax
> 0x28b <__delay+15>: jb 0x288 <__delay+12>
OK, I made a mistake, I wrote this small loop in a separte file and
converted it to assembly. If the "time" variable is "int" (and not
"unsigned long"), the compiler optimizes the loop to only 2 instructions:
> Three instructions, but I have no problem believing that one of them takes
> twice as long as the others.
I think on a Pentium processor or newer these three intructions are
executed in only 2 clocks anyway, this is why we got the same result.
> So the 2-1 ratio is still there, despite the code being identical.
This is only true for a Pentium or newer processor because the delay loop
in the host kernel is not __loop_delay() but __rdtsc_delay(). The former
one inserts a delay of "2 * loops" clocks while the last one only "loops"
In this case, the correct BogoMIPS value seems to be the one reported by
UML (and the host kernel on a processor without TSC).
> I wasn't too concerned about this, but at least it should silence the
> morons who think that BogoMips ratings have something to do with
> real-world performance.
I would like to lend a helping hand in my spare time and I thought this
would be a good start. But, anyway, now the udelay() works well in the
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information on a proactive anti-virus service working
around the clock, around the globe, visit http://www.messagelabs.com