My First Kernel Module: A Debugging Nightmare

Original article


Problem 1

2 threads want to access a piece of data. If one thread modifies data at same time as another thread READs it, we encounter data races .

Easy solution

mutex or spinlock

Use READ-WRITE locks

Harder solution

We use Read, Copy, Update (RCU).

The bug was caused due to indicating threads were free. Due to msleep and other functions. Then we tried to access the old copy. However it had already been freed.