clinux-kernelspinlock

How the function do_raw_spin_lock is implemented in linux


While debugging panic issue realted to spinlock, I came across this definition of spinlock in

include/linux/spinlock.h

. It is rather hard for me to understand this definition. Why is __acquires(lock) used after the do_raw_spin_lock function? What is the signification of such declaration?

static inline void do_raw_spin_lock(raw_spinlock_t *lock) __acquires(lock)
{
        __acquire(lock);
        arch_spin_lock(&lock->raw_lock);
}

Please help me how such declaration are decoded and work.


Solution

  • It is used for static analysis.

    http://en.wikipedia.org/wiki/Sparse