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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]