@@ -17,9 +17,25 @@
#define barrier() __asm__ __volatile__("": : :"memory")
#endif
+#ifdef KVM_BRLOCK_DEBUG
+
+#include "kvm/rwsem.h"
+
+DECLARE_RWSEM(brlock_sem);
+
+#define br_read_lock() down_read(&brlock_sem);
+#define br_read_unlock() up_read(&brlock_sem);
+
+#define br_write_lock() down_write(&brlock_sem);
+#define br_write_unlock() up_write(&brlock_sem);
+
+#else
+
#define br_read_lock() barrier()
#define br_read_unlock() barrier()
#define br_write_lock() kvm__pause()
#define br_write_unlock() kvm__continue()
#endif
+
+#endif
Adds a debug mode which allows to switch the brlock into a big rwlock. This can be used to verify we don't end up with a BKL kind of lock with the current brlock implementation. Signed-off-by: Sasha Levin <levinsasha928@gmail.com> --- tools/kvm/include/kvm/brlock.h | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)