M alphapc/dat.h => alphapc/dat.h +1 -0
@@ 33,6 33,7 @@ struct Lock
Proc *p;
ulong pid;
ushort isilock;
+ ulong glare;
};
struct Label
M carrera/dat.h => carrera/dat.h +1 -0
@@ 29,6 29,7 @@ struct Lock
ulong pc;
Proc *p;
ushort isilock;
+ ulong glare;
};
struct Label
M ip/tcp.c => ip/tcp.c +5 -3
@@ 1971,7 1971,7 @@ void
addreseq(Tcpctl *tcb, Tcp *seg, Block *bp, ushort length)
{
Reseq *rp, *rp1;
- int i;
+ int i, x;
rp = malloc(sizeof(Reseq));
if(rp == nil){
@@ 1991,9 1991,9 @@ addreseq(Tcpctl *tcb, Tcp *seg, Block *bp, ushort length)
return;
}
+ length = 0;
for(i = 0;; i++) {
- if(i > 100)
- print("very long tcp resequence queue\n");
+ length += rp1->length;
if(rp1->next == nil || seq_lt(seg->seq, rp1->next->seg.seq)) {
rp->next = rp1->next;
rp1->next = rp;
@@ 2001,6 2001,8 @@ addreseq(Tcpctl *tcb, Tcp *seg, Block *bp, ushort length)
}
rp1 = rp1->next;
}
+ if(i > 100)
+ print("very long tcp resequence queue: %d\n", length);
}
void
M mpc/dat.h => mpc/dat.h +1 -0
@@ 30,6 30,7 @@ struct Lock
ulong sr;
Proc *p;
ushort isilock;
+ ulong glare;
};
struct Label
M pc/dat.h => pc/dat.h +1 -0
@@ 28,6 28,7 @@ struct Lock
ulong pc;
Proc *p;
ushort isilock;
+ ulong glare;
};
struct Label
M port/lib.h => port/lib.h +1 -0
@@ 16,6 16,7 @@ extern void *memchr(void*, int, long);
*/
extern char *strcat(char*, char*);
extern char *strchr(char*, char);
+extern char *strrchr(char*, char);
extern int strcmp(char*, char*);
extern char *strcpy(char*, char*);
extern char *strncat(char*, char*, long);
M port/print.c => port/print.c +0 -1
@@ 3,7 3,6 @@
enum
{
- SIZE = 1024,
IDIGIT = 30,
MAXCONV = 40,
FDIGIT = 30,
M port/taslock.c => port/taslock.c +4 -0
@@ 102,6 102,10 @@ lockstats.locks++;
}
lockstats.glare++;
+if(l->glare++ > 10000){
+print("glare %lux\n", l);
+l->glare = 0;
+}
cansched = up != nil && up->state == Running;
if(cansched){
oldpri = up->priority;
M port/tod.c => port/tod.c +20 -17
@@ 98,42 98,45 @@ todget(vlong *ticksp)
vlong ticks, diff;
ulong t;
- ilock(&tod);
-
if(tod.hz == 0)
ticks = fastticks((uvlong*)&tod.hz);
else
ticks = fastticks(nil);
diff = ticks - tod.last;
- // add in correction
- if(tod.sstart != tod.send){
- t = MACHP(0)->ticks;
- if(t >= tod.send)
- t = tod.send;
- tod.off = tod.off + tod.delta*(t - tod.sstart);
- tod.sstart = t;
- }
-
// convert to epoch
x = (diff * tod.multiplier) >> 31;
x = x + tod.off;
- // protect against overflows
- if(diff > tod.hz){
- tod.last = ticks;
- tod.off = x;
+ if(m->machno == 0){
+ ilock(&tod);
+
+ // add in correction
+ if(tod.sstart != tod.send){
+ t = MACHP(0)->ticks;
+ if(t >= tod.send)
+ t = tod.send;
+ tod.off = tod.off + tod.delta*(t - tod.sstart);
+ tod.sstart = t;
+ }
+
+ // protect against overflows
+ if(diff > tod.hz){
+ tod.last = ticks;
+ tod.off = x;
+ }
+ iunlock(&tod);
}
// time can't go backwards
if(x < tod.lasttime)
x = tod.lasttime;
- tod.lasttime = x;
+ else
+ tod.lasttime = x;
if(ticksp != nil)
*ticksp = ticks;
- iunlock(&tod);
return x;
}