shithub: riscv

Download patch

ref: 3599f733ee9828b80a6f470646463793e01838e3
parent: 247ceabdb640e8642db6d2d90a2b68ad9112b66f
author: cinap_lenrek <cinap_lenrek@rei2>
date: Sun Feb 5 15:52:12 EST 2012

more checking for eqlock

--- a/sys/src/9/port/proc.c
+++ b/sys/src/9/port/proc.c
@@ -88,6 +88,9 @@
 			mmurelease(up);
 			unlock(&palloc);
 
+			up->mach = nil;
+			updatecpu(up);
+
 			up->qnext = procalloc.free;
 			procalloc.free = up;
 
@@ -411,6 +414,11 @@
 	Schedq *rq;
 	void (*pt)(Proc*, int, vlong);
 
+	if(p->state == Ready){
+		print("double ready %s %lud pc %p\n", p->text, p->pid, getcallerpc(&p));
+		return;
+	}
+		
 	s = splhi();
 	if(edfready(p)){
 		splx(s);
@@ -601,6 +609,7 @@
 	p->state = Scheding;
 	p->psstate = "New";
 	p->mach = 0;
+	p->eql = 0;
 	p->qnext = 0;
 	p->nchild = 0;
 	p->nwait = 0;
--- a/sys/src/9/port/qlock.c
+++ b/sys/src/9/port/qlock.c
@@ -24,7 +24,8 @@
 		print("eqlock: %#p: ilockdepth %d\n", getcallerpc(&q), m->ilockdepth);
 	if(up != nil && up->nlocks.ref)
 		print("eqlock: %#p: nlocks %lud\n", getcallerpc(&q), up->nlocks.ref);
-
+	if(up != nil && up->eql)
+		print("eqlock: %#p: eql %p\n", getcallerpc(&q), up->eql);
 	if(q->use.key == 0x55555555)
 		panic("eqlock: q %#p, key 5*\n", q);
 
@@ -58,6 +59,7 @@
 		up->notepending = 0;
 		error(Eintr);
 	}
+	up->eql = 0;
 }
 
 void
@@ -69,7 +71,8 @@
 		print("qlock: %#p: ilockdepth %d\n", getcallerpc(&q), m->ilockdepth);
 	if(up != nil && up->nlocks.ref)
 		print("qlock: %#p: nlocks %lud\n", getcallerpc(&q), up->nlocks.ref);
-
+	if(up != nil && up->eql)
+		print("qlock: %#p: eql %p\n", getcallerpc(&q), up->eql);
 	if(q->use.key == 0x55555555)
 		panic("qlock: q %#p, key 5*\n", q);
 	lock(&q->use);