Cache On and ECC clear
Eric W. Biederman
ebiederman at lnxi.com
Fri Mar 26 19:42:00 CET 2004
Li-Ta Lo <ollie at lanl.gov> writes:
> On Fri, 2004-03-26 at 17:46, Eric W. Biederman wrote:
> > Li-Ta Lo <ollie at lanl.gov> writes:
> > > Isn't it just one line in C to clear the memory ? Why not use
> > > string instruction instead of mov ?
> > A string mov instruction is slower.
> I just tried with a stosl version. It is not slower at all.
Usually stosl is coded in microcode... I much prefer to work
with real instructions. Since memory bandwidth is the bottleneck
it should not much matter. stosl actually runs faster with the cache
disabled (because it needs fewer instruction fetches) which is another
good reason not to use it.
stosl is also not conductive to breaking the loop up or doing
other odd things if something goes wrong. A mov based loop
is more straight forward to modify if it comes to that.
A slightly better question is why am I not using a loop using the
sse registers, which would probably be the ideal case. I don't have
a good answer to that but I seem to recall some documented errata.
Plus we are memory bandwidth limited not instruction dispatch limited
so the exact loop does not matter a lot.
Given the memory bandwidth limitation it probably means we
would not see a performance penalty if coded the loop in C.
However this piece of code is the dominant speed factor when
booting so I don't want to take chances.
> We are using stosl in the asm code to clear stack and bss,
> why not use it here too.
20/30K versus gigabytes. stack and bss clearing simply do not matter
More information about the coreboot