Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Cache information interface and implementation for AMD and Intel on Linux
[palacios.git] / linux_module / lockcheck.h
index 7151bd0..d80060b 100644 (file)
@@ -1,28 +1,33 @@
 #ifndef _lockcheck
 #define _lockcheck
 
-#define CHECK_LOCKS  0
-#define NUM_LOCKS    1024
 
-#if CHECK_LOCKS
+#ifdef V3_CONFIG_DEBUG_LOCKS
+
+// Maxmimum number of locks to handle
+#define NUM_LOCKS        1024
+// Maximum number of locks that can be simultaneously
+// held on each CPU
+#define LOCK_STACK_DEPTH 16
+
+//
+// The following macros are used
+// in the stub functions to call back to the lock
+// checker - if lock checking is not enabled, these 
+// turn into nothing
+//
 #define LOCKCHECK_INIT() palacios_lockcheck_init()
 #define LOCKCHECK_ALLOC(lock) palacios_lockcheck_alloc(lock)
 #define LOCKCHECK_FREE(lock)  palacios_lockcheck_free(lock)
-#define LOCKCHECK_LOCK(lock)  palacios_lockcheck_lock(lock)
-#define LOCKCHECK_UNLOCK(lock) palacios_lockcheck_unlock(lock)
-#define LOCKCHECK_LOCK_IRQSAVE(lock, flags)  palacios_lockcheck_lock_irqsave(lock,flags)
-#define LOCKCHECK_UNLOCK_IRQRESTORE(lock, flags) palacios_lockcheck_unlock_irqrestore(lock,flags)
+#define LOCKCHECK_LOCK_PRE(lock)
+#define LOCKCHECK_LOCK_POST(lock)  palacios_lockcheck_lock(lock)
+#define LOCKCHECK_UNLOCK_PRE(lock) palacios_lockcheck_unlock(lock)
+#define LOCKCHECK_UNLOCK_POST(lock) 
+#define LOCKCHECK_LOCK_IRQSAVE_PRE(lock, flags) 
+#define LOCKCHECK_LOCK_IRQSAVE_POST(lock, flags)  palacios_lockcheck_lock_irqsave(lock,flags)
+#define LOCKCHECK_UNLOCK_IRQRESTORE_PRE(lock, flags) palacios_lockcheck_unlock_irqrestore_pre(lock,flags)
+#define LOCKCHECK_UNLOCK_IRQRESTORE_POST(lock, flags) palacios_lockcheck_unlock_irqrestore_post(lock,flags)
 #define LOCKCHECK_DEINIT() palacios_lockcheck_deinit()
-#else
-#define LOCKCHECK_INIT()
-#define LOCKCHECK_ALLOC(lock) 
-#define LOCKCHECK_FREE(lock)  
-#define LOCKCHECK_LOCK(lock)  
-#define LOCKCHECK_UNLOCK(lock) 
-#define LOCKCHECK_LOCK_IRQSAVE(lock, flags)  
-#define LOCKCHECK_UNLOCK_IRQRESTORE(lock, flags) 
-#define LOCKCHECK_DEINIT()
-#endif
 
 void palacios_lockcheck_init(void);
 void palacios_lockcheck_alloc(void *lock);
@@ -30,7 +35,29 @@ void palacios_lockcheck_free(void *lock);
 void palacios_lockcheck_lock(void *lock);
 void palacios_lockcheck_unlock(void *lock);
 void palacios_lockcheck_lock_irqsave(void *lock,unsigned long flags);
-void palacios_lockcheck_unlock_irqrestore(void *lock,unsigned long flags);
+void palacios_lockcheck_unlock_irqrestore_pre(void *lock,unsigned long flags);
+void palacios_lockcheck_unlock_irqrestore_post(void *lock,unsigned long flags);
 void palacios_lockcheck_deinit(void);
 
+#else
+
+//
+// The following is what happens when lock checking is not on
+//
+#define LOCKCHECK_INIT()
+#define LOCKCHECK_ALLOC(lock) 
+#define LOCKCHECK_FREE(lock)  
+#define LOCKCHECK_LOCK_PRE(lock)
+#define LOCKCHECK_LOCK_POST(lock)  
+#define LOCKCHECK_UNLOCK_PRE(lock) 
+#define LOCKCHECK_UNLOCK_POST(lock)
+#define LOCKCHECK_LOCK_IRQSAVE_PRE(lock, flags)  
+#define LOCKCHECK_LOCK_IRQSAVE_POST(lock, flags)  
+#define LOCKCHECK_UNLOCK_IRQRESTORE_PRE(lock, flags) 
+#define LOCKCHECK_UNLOCK_IRQRESTORE_POST(lock, flags) 
+#define LOCKCHECK_DEINIT()
+
+#endif
+
+
 #endif