Kernel correctness is incredibly important, so kernel authors build extensive debugging and self-checking infrastructure into their systems. But kernels are deployed in challenging situations, so debugging tools designed more for simple, user-level processes don’t always apply. We can add a lot to our debugging toolboxes by considering how kernel designers make their systems more robust. Today, we consider the spinlock subsystem.
Part 1: Survey
In the first part, we’ll look at other operating systems’ spinlocks and characterize their debugging and robustness features, and differences from Chickadee’s spinlocks.
Every group will want to familiarize themselves with Chickadee’s k-lock.hh. Then each group should choose an operating system. Here’s a selection. FreeBSD and Linux’s implementations are far more complex. Each group should tackle another one teaching OS and then one real OS. Are the teaching OS features mirrored in the real OS? Does the real OS have more features? What features?
OS/161 teaching operating system
xv6 teaching operating system
- Function prototypes
FreeBSD operating system
- Locking manual page
- Lock profiling support
- Lock validation facility
Linux operating system
- Unreliable Guide to Locking in Linux (sadly, this is not that useful)
- Linus’s spin_lock tutorial
- Runtime locking correctness validator, “lockdep”
- Kernel Lock Torture Test
- https://github.com/torvalds/linux/tree/master/kernel/locking — directory containing lock implementations
- see also the
lockdepfiles in https://github.com/torvalds/linux/tree/master/kernel/locking
Part 2: Recommendations
Look at code (possibly dividing the work among the group) and discuss about
what you see. Develop a proposal for changes to Chickadee’s
to make it more debuggable. Mention features you found in the other operating
systems that should not be ported to Chickadee, as well as features that
should. Outline implementations if you can.
Part 3: Presentations and discussion
In the last half hour of class, each group will present their ideas; we’ll discuss and conclude.