#ifdef CONFIG_LOCK_KERNEL
#include <linux/sched.h>
-#include <trace/events/bkl.h>
#define kernel_locked() (current->lock_depth >= 0)
return 0;
}
-extern void __lockfunc _lock_kernel(void) __acquires(kernel_lock);
-extern void __lockfunc _unlock_kernel(void) __releases(kernel_lock);
+extern void __lockfunc
+_lock_kernel(const char *func, const char *file, int line)
+__acquires(kernel_lock);
-#define lock_kernel() { \
- trace_lock_kernel(__func__, __FILE__, __LINE__); \
- _lock_kernel(); \
-}
+extern void __lockfunc
+_unlock_kernel(const char *func, const char *file, int line)
+__releases(kernel_lock);
-#define unlock_kernel() { \
- trace_unlock_kernel(__func__, __FILE__, __LINE__); \
- _unlock_kernel(); \
-}
+#define lock_kernel() do { \
+ _lock_kernel(__func__, __FILE__, __LINE__); \
+} while (0)
+
+#define unlock_kernel() do { \
+ _unlock_kernel(__func__, __FILE__, __LINE__); \
+} while (0)
/*
* Various legacy drivers don't really need the BKL in a specific
#else
-#define lock_kernel() trace_lock_kernel(__func__, __FILE__, __LINE__);
-#define unlock_kernel() trace_unlock_kernel(__func__, __FILE__, __LINE__);
+#define lock_kernel()
+#define unlock_kernel()
#define release_kernel_lock(task) do { } while(0)
#define cycle_kernel_lock() do { } while(0)
#define reacquire_kernel_lock(task) 0
#include <linux/module.h>
#include <linux/kallsyms.h>
#include <linux/semaphore.h>
-#define CREATE_TRACE_POINTS
#include <linux/smp_lock.h>
+#define CREATE_TRACE_POINTS
+#include <trace/events/bkl.h>
+
/*
* The 'big kernel lock'
*
* This cannot happen asynchronously, so we only need to
* worry about other CPU's.
*/
-void __lockfunc _lock_kernel(void)
+void __lockfunc _lock_kernel(const char *func, const char *file, int line)
{
- int depth = current->lock_depth+1;
+ int depth = current->lock_depth + 1;
+
+ trace_lock_kernel(func, file, line);
+
if (likely(!depth))
__lock_kernel();
current->lock_depth = depth;
}
-void __lockfunc _unlock_kernel(void)
+void __lockfunc _unlock_kernel(const char *func, const char *file, int line)
{
BUG_ON(current->lock_depth < 0);
if (likely(--current->lock_depth < 0))
__unlock_kernel();
+
+ trace_unlock_kernel(func, file, line);
}
EXPORT_SYMBOL(_lock_kernel);