changelog shortlog tags branches files raw gz bz2 help

Mercurial > hg > plan9front / changeset: kernel: include lock pointer in error report, stop spamming lockloop prints when we are panicing

changeset 7181: 0949b361c51e
parent 7180: c34b759d11c6
child 7182: f7fd59ea46c5
author: cinap_lenrek@felloff.net
date: Wed, 01 May 2019 09:39:02 +0200
files: sys/src/9/port/taslock.c
description: kernel: include lock pointer in error report, stop spamming lockloop prints when we are panicing
     1.1--- a/sys/src/9/port/taslock.c
     1.2+++ b/sys/src/9/port/taslock.c
     1.3@@ -36,8 +36,12 @@ dumplockmem(char *tag, Lock *l)
     1.4 void
     1.5 lockloop(Lock *l, uintptr pc)
     1.6 {
     1.7+	extern int panicking;
     1.8 	Proc *p;
     1.9 
    1.10+	if(panicking)
    1.11+		return;
    1.12+
    1.13 	p = l->p;
    1.14 	print("lock %#p loop key %#lux pc %#p held by pc %#p proc %lud\n",
    1.15 		l, l->key, pc, l->pc, p ? p->pid : 0);
    1.16@@ -186,11 +190,17 @@ unlock(Lock *l)
    1.17 	}
    1.18 #endif
    1.19 	if(l->key == 0)
    1.20-		print("unlock: not locked: pc %#p\n", getcallerpc(&l));
    1.21+		print("unlock(%#p): not locked: pc %#p\n",
    1.22+			l, getcallerpc(&l));
    1.23 	if(l->isilock)
    1.24-		print("unlock of ilock: pc %#p, held by %#p\n", getcallerpc(&l), l->pc);
    1.25-	if(l->p != up)
    1.26-		print("unlock: up changed: pc %#p, acquired at pc %#p, lock p %#p, unlock up %#p\n", getcallerpc(&l), l->pc, l->p, up);
    1.27+		print("unlock(%#p) of ilock: pc %#p, held by %#p\n",
    1.28+			l, getcallerpc(&l), l->pc);
    1.29+	if(l->p != up){
    1.30+		print("unlock(%#p): up changed: pc %#p, acquired at pc %#p, lock p %#p, unlock up %#p\n",
    1.31+			l, getcallerpc(&l), l->pc, l->p, up);
    1.32+		dumpaproc(l->p);
    1.33+		dumpaproc(up);
    1.34+	}
    1.35 	l->m = nil;
    1.36 	coherence();
    1.37 	l->key = 0;
    1.38@@ -223,11 +233,11 @@ iunlock(Lock *l)
    1.39 		ilockpcs[n++ & 0xff]  = l->pc;
    1.40 #endif
    1.41 	if(l->key == 0)
    1.42-		print("iunlock: not locked: pc %#p\n", getcallerpc(&l));
    1.43+		print("iunlock(%#p): not locked: pc %#p\n", l, getcallerpc(&l));
    1.44 	if(!l->isilock)
    1.45-		print("iunlock of lock: pc %#p, held by %#p\n", getcallerpc(&l), l->pc);
    1.46+		print("iunlock(%#p) of lock: pc %#p, held by %#p\n", l, getcallerpc(&l), l->pc);
    1.47 	if(islo())
    1.48-		print("iunlock while lo: pc %#p, held by %#p\n", getcallerpc(&l), l->pc);
    1.49+		print("iunlock(%#p) while lo: pc %#p, held by %#p\n", l, getcallerpc(&l), l->pc);
    1.50 
    1.51 	sr = l->sr;
    1.52 	l->m = nil;