Messages in this thread | | | Date | Thu, 21 Jun 2007 13:48:51 -0700 (PDT) | From | Linus Torvalds <> | Subject | Re: [BUG] long freezes on thinkpad t60 |
| |
On Thu, 21 Jun 2007, Ingo Molnar wrote: > > damn, i first wrote up an explanation about why that ugly __delay(1) is > there (it almost hurts my eyes when i look at it!) but then deleted it > as superfluous :-/
I'm fine with a delay, but the __delay(1) is simply not "correct". It doesn't do anything.
"udelay()" waits for a certain time. Use that.
> the reason for the __delay(1) was really mundane: to be able to figure > out when to print a 'we locked up' message to the user.
No it does not.
You may think it does, but it does nothing of the sort.
Use "udelay()" or somethign that actually takes a *time*.
Just __delay() is nothing but a loop, and calling it with an argument of 1 is stupid and buggy.
The only *possibly* valid use of "__delay()" implies using a counter that is based on the "loops_per_sec" thing, which depends on what the delay function actually is.
For example, the delay function may well turn out to be this:
__asm__ __volatile__( "\tjmp 1f\n" ".align 16\n" "1:\tjmp 2f\n" ".align 16\n" "2:\tdecl %0\n\tjns 2b" :"=&a" (d0) :"0" (loops));
Notice? "Your code, it does nothing!"
When I said that the code was buggy, I meant it.
It has nothing to do with spinlocks. And "__delay(1)" is *always* a bug.
You migth want to replace it with
smp_rmb(); udelay(1);
instead, at which point it *does* something: it has that read barrier (which is not actually needed on x86, but whatever), and it has a delay that is *meaningful*.
A plain "__delay(1)" is neither.
So let me repeat my statement: "What a piece of crap".
Linus - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |