ref: ad0726a14a697df6320fde5898ae961518194299
parent: 5b23c72a126578bdb3f808534dc6652e5a0fe8a4
	author: cinap_lenrek <cinap_lenrek@felloff.net>
	date: Sat Apr  6 12:42:27 EDT 2024
	
kernel: print warning in rlock() and wlock() when we hold spinlocks Just like for qlock(), print a warning when the process calls rlock() and wlock() while holding a spinlock.
--- a/sys/src/9/port/qlock.c
+++ b/sys/src/9/port/qlock.c
@@ -153,6 +153,11 @@
 {Proc *p;
+ if(m->ilockdepth != 0)
+		print("rlock: %#p: ilockdepth %d\n", getcallerpc(&q), m->ilockdepth);+ if(up != nil && up->nlocks)
+		print("rlock: %#p: nlocks %d\n", getcallerpc(&q), up->nlocks);+
lock(&q->use);
rwstats.rlock++;
 	if(q->writer == 0 && q->head == nil){@@ -208,6 +213,11 @@
uintptr pc;
pc = getcallerpc(&q);
+
+ if(m->ilockdepth != 0)
+		print("wlock: %#p: ilockdepth %d\n", pc, m->ilockdepth);+ if(up != nil && up->nlocks)
+		print("wlock: %#p: nlocks %d\n", pc, up->nlocks);lock(&q->use);
rwstats.wlock++;
--
⑨