Hi, Here is a patch for tasklock.c:
int lock(Lock *l) { int i; ulong pc; pc = getcallerpc(&l); lockstats.locks++; if(up) inccnt(&up->nlocks); /* prevent being scheded */ if(tas(&l->key) == 0){ if(up) up->lastlock = l; l->pc = pc; l->p = up; l->isilock = 0; + l->m = MACHP(m->machno); ... return 0; } we do that in ilock() and canlock() so it's a bug I think to not do it also in lock(). The field is only used in iprintcanlock which use canlock(), not lock(), so this if fine, but for consistency it would be better to also do it in lock() no?