Re: [rfc patch] i386: don't save eflags on task switch
- From: Linus Torvalds <torvalds@xxxxxxxx>
- Date: Sun, 5 Nov 2006 09:51:36 -0800 (PST)
On Sun, 5 Nov 2006, Arjan van de Ven wrote:
actually lockdep is pretty good at finding this type of bug IMMEDIATELY
even without the actual race triggering ;)
Ehh. Last time this happened, lockdep didn't find _squat_.
This was when NT and AC leaked across context switches, because the
context switching had removed the "expensive" save/restore.
The thing is, complexity is in the unintended side effects, not in the
code itself. For example, let's say that we changed "restore_flags()" to
do
static inline void restore_flags(unsigned long x)
{
if (x & 0x200)
asm volatile("sti");
}
(I didn't check that IF is 0x200, but it's something like that) and it was
two cycles faster on average than just doing a "popf". The _complexity_
here is that now there might be some other x86-architecture-specific code
sequence that nobody even _realized_ actually depended on saving the other
flags too. Like the context switching thing did.
Is it likely? Maybe not. But that's the thing about complexity - you'd not
know, would you?
Do a few of these kinds of things, and _individually_ they are unlikely to
add new bugs, but once you've done ten or twenty of them, the likelihood
that _one_ of them added a subtle bug that it will take months or years to
find is suddenly not all that small any more.
This is why "robust" is so important. So _much_ more important than a
cycle or two. The fact is, saving and restoring all the eflags over a
context switch is just _more_robust_. If you do a pushfl/popfl, there's
simply not a lot you can screw up.
Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- Re: [rfc patch] i386: don't save eflags on task switch
- From: Zachary Amsden
- Re: [rfc patch] i386: don't save eflags on task switch
- References:
- Re: [rfc patch] i386: don't save eflags on task switch
- From: Chuck Ebbert
- Re: [rfc patch] i386: don't save eflags on task switch
- From: Andi Kleen
- Re: [rfc patch] i386: don't save eflags on task switch
- From: Zachary Amsden
- Re: [rfc patch] i386: don't save eflags on task switch
- From: Andi Kleen
- Re: [rfc patch] i386: don't save eflags on task switch
- From: Linus Torvalds
- Re: [rfc patch] i386: don't save eflags on task switch
- From: Arjan van de Ven
- Re: [rfc patch] i386: don't save eflags on task switch
- Prev by Date: Re: [PATCH] Fix SUNRPC wakeup/execute race condition
- Next by Date: Re: realtime-preempt patch-2.6.18-rt7 oops
- Previous by thread: Re: [rfc patch] i386: don't save eflags on task switch
- Next by thread: Re: [rfc patch] i386: don't save eflags on task switch
- Index(es):
Relevant Pages
|
|