OSDL to fund a kernel tech writer
Posted Nov 12, 2006 15:27 UTC (Sun) by
Blaisorblade (guest, #25465)
In reply to:
OSDL to fund a kernel tech writer by MisterIO
Parent article:
OSDL to fund a kernel tech writer
> The linux kernel books are not really better at that,except for the
> linux drivers book,but it goes too quickly out of date with the kernel!
I've had problems even at using a Linux driver book, namely Linux Device Drivers. Maybe I'm off topic since this is too detailed, but I couldn't explain myself without examples - I would have needed much more time to write this post).
I was not trying to write a driver from scratch, but to remove excess locking (which was doing harm) from an existing driver (arch/um/drivers/net_kern.c: uml_net_open in 2.6.18 is one offending place, with
spin_lock(&lp->lock);
...
um_request_irq(...) /* a request_irq wrapper, allocates memory with GFP_KERNEL*/
...
spin_unlock(&lp->lock);
).
In LDD3 examples there is no lock protecting against multiple concurrent open and/or close operations, which is correct, but there is also no explaination of why it is not needed (there is a complex *undocumented* state machine infrastructure preventing this) - and I've verified that in practice this error happens to other driver authors (in out-of-tree code).
Additionally, the code had to use a spinlock in _open to protect against concurrent ->read and ->write operations (again, not needed for the same reason) - which meant that sleep-inside-spinlock warnings were extremely common.
So, actual bugs were resulting from a lack of documentation.
(
Log in to post comments)