[PATCH v2 7/8] kvm tools: Add debug mode to brlock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 tools/kvm/include/kvm/brlock.h |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/tools/kvm/include/kvm/brlock.h b/tools/kvm/include/kvm/brlock.h
index 1863166..4cc0521 100644
--- a/tools/kvm/include/kvm/brlock.h
+++ b/tools/kvm/include/kvm/brlock.h
@@ -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
-- 
1.7.5.rc3

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux