second try. first was applied incorrectly do to incorrect environment used for patch remove spls from ilocks and test against nil rather than using 0 or !. Reference: /n/atom/patch/applied2013/fssplinilock Date: Tue Sep 3 19:12:07 CES 2013 Signed-off-by: quanstro@quanstro.net --- /sys/src/fs/port/sub.c Tue Sep 3 19:10:47 2013 +++ /sys/src/fs/port/sub.c Tue Sep 3 19:10:47 2013 @@ -1086,7 +1086,6 @@ User *p; void *a; int i, c; - long s; if(q == nil) panic("recv null q"); @@ -1095,7 +1094,16 @@ c = q->count; if(c > 0) { if(ret == 0){ - iunlock(q); + /* since we consume nothing, wake up next guy */ + p = q->rhead; + if(p != nil) { + q->rhead = p->qnext; + if(q->rhead == nil) + q->rtail = nil; + iunlock(q); + ready(p); + }else + iunlock(q); return 0; } i = q->loc; @@ -1122,10 +1130,8 @@ else p->qnext = u; q->rtail = u; - s = splhi(); u->qnext = 0; u->state = Recving; - splx(s); iunlock(q); sched(); } @@ -1136,7 +1142,6 @@ { User *p; int i, c; - long s; if(q == 0) panic("send null q %#p", getcallerpc(q)); @@ -1158,10 +1163,10 @@ q->args[i] = a; q->count = c+1; p = q->rhead; - if(p) { + if(p != nil) { q->rhead = p->qnext; - if(q->rhead == 0) - q->rtail = 0; + if(q->rhead == nil) + q->rtail = nil; iunlock(q); ready(p); }else @@ -1176,10 +1181,8 @@ else p->qnext = u; q->wtail = u; - s = splhi(); u->qnext = 0; u->state = Sending; - splx(s); iunlock(q); sched(); } --- /sys/src/fs/port/proc.c Tue Sep 3 19:10:47 2013 +++ /sys/src/fs/port/proc.c Tue Sep 3 19:10:47 2013 @@ -130,7 +130,7 @@ void ready(User *p) { - int s; + Mpl s; if(p->state == Ready){ print("ready Ready\n"); @@ -259,7 +259,7 @@ */ p = r->p; if(p) - print("double sleep pid %d/%#p\n", u->pid, getcallerpc(&r)); + print("double sleep pid %d/%#p %d\n", u->pid, getcallerpc(&r), p->pid); u->state = Wakeme; r->p = u; @@ -321,13 +321,13 @@ wakeup(Rendez *r) { User *p; - int s; + Mpl s; s = splhi(); lock(r); p = r->p; - if(p) { - r->p = 0; + if(p != nil) { + r->p = nil; if(p->state != Wakeme) panic("wakeup: not Wakeme"); ready(p);