Monday, March 10, 2008

Generic pointers mess

One of my latest bugs gave me 4 days of vandering in the dark. I was getting really strange warning from the lockdep when I was enabling clocks on tmio chip. The code was 1-to-1 converted from working one, so there shouldn't be any problems. But there were. After double-checking all locking logic, increasing lockdep constants to really big values and even looking into lockdep details, I finally found the source of the problem: as a private data I passed not the structure I exected to receive.
Pretty trivial problem for a language w/o runtime type checking functionality. Maybe it's time to implement it
as a wrapper around various magic values and type checking functions? In the userspace IIUC glib permits smth. like that, it manages a class-based system with objects allocation, etc. Would I like to see smth. like this in kernel? Probably no. Would I like to see some generic way to enable such checks for objects like spin locks, mutexes, etc? Definitely yes.

No comments: