News for hackers. Stuff that matters.
Re:Nasty Lockup Issue Still Being Investigated for Linux 3.18 by jacquesm on Sunday November 30, 2014 @02:25PM (#8677765)
The more mature a system is the harder the bugs will be. It's a simple bit math: easy bugs can be found by just reasoning about the code, harder bugs can be found with some persistence and sometimes a debugger. Those are all found relatively early on in the life of a codebase. But a really hard bug that shows up only under stressful situations on a system that has been running stable for days, weeks or even months will have a cycle time roughly equivalent to the number of incidences that you can generate on a single machine. Hard to reproduce -> hard to analyze -> therefore hard to fix.

Anything you can do to speed up the occurrence of such a bug should be reached for first because just speeding up the frequency with which the bug appears guarantees that you'll be able to fix it sooner, and to be more certain that you have fixed the bug once you think that you have identified the problem.

You can waste months on little nasty ones like this. I love it though, digging in on a bug and not letting go until the sucker is nailed for good. Especially hardware related bugs (interrupt handlers that are not 100% transparent for instance) and subtle timing bugs can be super hard to fix. But that feeling when you finally find it is absolutely priceless, it's like solving a very complex puzzle and finding the solution. I wished it did not take such a toll on my nights though :)

Re:Nasty Lockup Issue Still Being Investigated for Linux 3.18 by Someone on Sunday November 30, 2014 @05:31PM (#8678444)
"easy bugs can be found by just reasoning about the code"

I probably live in a dream world, but I would say software bugs of the 'causes deadlock in a OS that is used in millions of devices' type should (maybe even must) be avoided by reasoning about the code. If you find that you cannot reason about the whole system at the time, you either simplify it (python's GIL is a nice extreme example; you never read about race conditions inside Python's core) or you improve your logic.

In my world, you should only need the debugger for hardware related bugs, and then, it often is a combination of intuition and sheer perseverence that solves the issue. Especially if timing is involved, looking at the system can make the problem go away. But even there, having thought about the system will help a lot. For example, your reasoning might have said "between two X-es, we always get at least one Y, so…". You can turn that into a hypothesis that can be tested easily (in theory. Practice can be quite different)

On the other hand, if you must use modern PC hardware, you get a lot of unavoidable complexity (multiple interrupt levels, drivers that you cannot all check do compliance with your model of how drivers work, etc), so you may end up with the case where reasoning about the code isn't really possible.

Re:Nasty Lockup Issue Still Being Investigated for Linux 3.18 by nieve on Sunday November 30, 2014 @08:55PM (#8679122)
You're not just living in a dream world, you're using the phrase to excuse a snide strawman. The Linux kernel is 12-20 million lines of code depending on how you count it (and how far up the top end has gone recently). It is not possible for humans to know and comprehend the entire codebase, much less avoid all lockup bugs by reasoning about the code. In fact I'm pretty sure all extant methods of creating a correctness proof fail at that scale (even if you can ignore drivers). Much of the kernel requires specialized skills and experience the majority of kernel developers don't have.

Beyond that the kernel developers value both correctness and performance. Most of these bugs involve multiprocessing and a huge amount of effort has gone into getting rid of them global locks, but even they aren't easy to reason about at that scale - I think you're missing the common thread in "deadlock" and "Global Interpreter Lock". Pretending that a world could exist where we can simply reason about something like the Linux kernel and then using it to state that devs can simplify or improve the logic is taking a completely unsupported cheap shot and the disclaimer about the real world doesn't change that. I'm not even sure what your motivation for the equivalent of "if you pretend that friction & drag don't exist it's really easy to figure out aerodynamics, so plane designers need to do better" (hint, it's not) is, but it certainly isn't to inform, contribute, or facilitate the debate.

Re:Nasty Lockup Issue Still Being Investigated for Linux 3.18 by Someone on Monday December 01, 2014 @06:35PM (#8684786)
Divide and conquer. For every modular part in the kernel, define what it is supposed to do: are calls reentrant? What combinations of calls are allowed? What interrupts can it generate? Etc.

If you don't make rules as to how the parts are to behave, how are writers of device drivers going to know how to make a working driver? Tweak it until it doesn't hang the system in a few days?

And how are you going to fix that deadlock you find during debugging? You may know (simple exampe) that thread T1 holds lock L1 while trying to get L2, while thread T2 holds L2 while trying to get L1, but without guidance on how things are supposed to work, how do you even know whether to fix T1 or T2?

IMO, the more complex the system, the greater the need for simpe rules that limit what different parts can do.

Chances are there will still be lockup bugs, but that is not a reason not to try and avoid them.

Re:Nasty Lockup Issue Still Being Investigated for Linux 3.18 by mrich on Monday December 01, 2014 @10:32AM (#8681526)
Who says a kernel must have 15 million lines of code? I'm pretty sure there are kernels out there that have been verified correct. Of course the hardware could still be broken (can also be proven correct) or a cosmic ray could flip some bits...
Re:Nasty Lockup Issue Still Being Investigated for Linux 3.18 by lomnakkus on Monday December 01, 2014 @01:20PM (#8682681)
Re:Nasty Lockup Issue Still Being Investigated for Linux 3.18 by encoderer on Sunday November 30, 2014 @04:01PM (#8678068)
Once a program overflows a single engineer's mental buffer, all bets are off. I think the size of that buffer is one thing that separates good from great in our line of work. We engineer systems to not rely on a single persons understanding, and it's an important part of what we do, but that doesn't mean we don't lose something when it gets beyond the grok of the humans building it.
Re:Nasty Lockup Issue Still Being Investigated for Linux 3.18 by agency on Sunday November 30, 2014 @06:09PM (#8678595)
"Relative to the complexity we can create, we are all statistically at the same point in understanding it." (paraphrasing Rich Hickey)

I don't think the size of the buffer is what distinguishes the good from great, because complexity is combinatorial in nature. It's the ability to mitigate complexity by designing systems composed of simple parts.

Re:Nasty Lockup Issue Still Being Investigated for Linux 3.18 by ams6110 on Sunday November 30, 2014 @09:57PM (#8679270)
These sorts of discussions always remind me of the essay that "nobody knows how to make a pencil"

http://www.econlib.org/library/Essays/rdPncl1.html

Re:Nasty Lockup Issue Still Being Investigated for Linux 3.18 by jrockway on Monday December 01, 2014 @12:36AM (#8679682)
This is a nice philosophy, but with Linux's extensive suite of automated tests (zero), I'm more surprised that it ever works at all.

The other day I was "backporting" some input patches to an older kernel version. The patches all applied cleanly. The resulting source code compiled. The feature I wanted worked. But it still scares me too much to check it in.

Re:Nasty Lockup Issue Still Being Investigated for Linux 3.18 by gioele on Monday December 01, 2014 @01:44AM (#8679815)
> Linux's extensive suite of automated tests (zero),

What about LTP [1] and Autotest [2]?

«Linux Test Project is a joint project started by SGI, OSDL and Bull developed and maintained by IBM, Cisco, Fujitsu, SUSE, Red Hat, Oracle and others. The project goal is to deliver tests to the open source community that validate the reliability, robustness, and stability of Linux.

The LTP testsuite contains a collection of tools for testing the Linux kernel and related features.»

[1] http://linux-test-project.github.io/

[2] http://autotest.github.io/

Re:Nasty Lockup Issue Still Being Investigated for Linux 3.18 by jrockway on Monday December 01, 2014 @02:19AM (#8679882)
These look pretty nice. I wish these were included with the main source tree.
Re:Nasty Lockup Issue Still Being Investigated for Linux 3.18 by cesarb on Monday December 01, 2014 @07:32AM (#8680624)
There are also a few tests within the main source tree.

Locking and RCU have built-in "torture" tests (CONFIG_LOCK_TORTURE_TEST and CONFIG_RCU_TORTURE_TEST). Take also a look at the tools/testing/ directory in the kernel source tree.