Am 21.11.2010 um 20:24 schrieb Segher Boessenkool:
+#if defined(__powerpc64__) || defined(CONFIG_PPC_64BITSUPPORT) +#ifdef CONFIG_PPC_64BITSUPPORT
Phew - too much ifdef for my taste. How about the idea I mentioned in the mail before to just make is_ppc64 return always 0 on ppc32 hosts without compat config option? Then you could also protect the slbia and slbmte and whatever ppc64 specific pieces with #ifdefs but not care about the rest :). Would hopefully make this code a lot more readable!
Yeah. Factor out most stuff so you have a single #ifdef for them :-)
Actually this patch is designed for the mid-term goal of dropping legacy 64-bit support, so any CONFIG_PPC_64BITSUPPORT code path is supposed to go away. Creating new defines that can't just be stripped in order to drop it would be bad.
- asm volatile("isync" ::: "memory");
And this would be awesome to get as inline function too! :)
Too bad that won't work. It will not work as written either -- the asm can still be moved around relative to some stuff.
Put the isync in the same asm that it is syncing for.
You mean, unroll the loop into one asm volatile() or do the isync in every iteration? (Are you implying it is necessary here?)
Oh, btw, slbia does not invalidate all SLBs (it doesn't invalidate #0). It probably doesn't matter here, since you write #0 soon enough, and you cannot have an exception happen before that. Also, the slbia does invalidate the ERATs. But you might want to check this, and/or add a comment.
We did think of the initial SLB, and my loop starts at #0. Never heard of ERATs before, are they bad for us or just an info?
Andreas