9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] minor kernel bug
@ 2014-06-05  0:56 Yoann Padioleau
  2014-06-05 11:19 ` erik quanstrom
  2014-06-05 11:21 ` erik quanstrom
  0 siblings, 2 replies; 3+ messages in thread
From: Yoann Padioleau @ 2014-06-05  0:56 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

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?





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] minor kernel bug
  2014-06-05  0:56 [9fans] minor kernel bug Yoann Padioleau
@ 2014-06-05 11:19 ` erik quanstrom
  2014-06-05 11:21 ` erik quanstrom
  1 sibling, 0 replies; 3+ messages in thread
From: erik quanstrom @ 2014-06-05 11:19 UTC (permalink / raw)
  To: 9fans

> 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?

ilock and unlock could assert(l->m->machno == m->machno).  but currently
you're right on both counts.

- erik



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] minor kernel bug
  2014-06-05  0:56 [9fans] minor kernel bug Yoann Padioleau
  2014-06-05 11:19 ` erik quanstrom
@ 2014-06-05 11:21 ` erik quanstrom
  1 sibling, 0 replies; 3+ messages in thread
From: erik quanstrom @ 2014-06-05 11:21 UTC (permalink / raw)
  To: 9fans

oh, but you missed a spot in lock.

- erik



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-06-05 11:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-05  0:56 [9fans] minor kernel bug Yoann Padioleau
2014-06-05 11:19 ` erik quanstrom
2014-06-05 11:21 ` erik quanstrom

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).