9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Lucio De Re <lucio@proxima.alt.za>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] That deadlock, again
Date: Thu, 18 Nov 2010 12:48:36 +0200	[thread overview]
Message-ID: <20101118104836.GB3464@fangle.proxima.alt.za> (raw)
In-Reply-To: <e5cc4388ae566a22a7dfcde72f7a78e8@gmx.de>

On Thu, Nov 18, 2010 at 10:20:33AM +0100, cinap_lenrek@gmx.de wrote:
>
> hm...  thinking about it...  does the kernel assume (maybe in early
> initialization) that calling qlock() without a proc is ok as long as
> it can make sure it will not be held by another proc?
>
That's a question for Bell Labs, I suppose, but that's precisely what I
believe.  There is no other explanation for the panic.  Moving the
up == 0 test earlier will invalidate this assumption and cause the panic
we have already seen.

The issue here is whether there is a situation where qlock() is
intentionally invoked where up == 0 (suggested by the positioning of the
up == 0 test _after_ setting the "locked" condition).  This is improbable,
though, and needs sorting out: whereas setting the lock can be done with
up == 0 - and we can also clear the lock - we cannot _fail_ to set the
lock, because then the absence of up will trigger a panic.

Now, we know that qlock() is called with up == 0, we have seen a panic
being generated by such a call.  Will it suffice to locate the invocation
and somehow deal with it, or should we make qlock() more robust and cause
it to reject a request from a space where up == 0?  Definitely, if qlock()
no longer allows invocations with up == 0 there will be simplifications
in its implementation.  For example, the line

	if(up != nil && up->nlocks.ref)
		print("qlock: %#p: nlocks %lud\n", getcallerpc(&q), up->nlocks.ref);

will no longer need the up != nil test.

But I'm convinced there's more here than meets the eye.  Unfortunately,
while I have a Plan 9 distribution at my fingertips, I'm not going to
try to fix this problem in a 9vx environment, I'll wait until I get home
to deal with the native stuff.  But one can speculate...

++L



  reply	other threads:[~2010-11-18 10:48 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-18  5:50 Lucio De Re
2010-11-18  5:53 ` erik quanstrom
2010-11-18  8:11   ` Lucio De Re
2010-11-18  8:35     ` cinap_lenrek
2010-11-18  9:20     ` cinap_lenrek
2010-11-18 10:48       ` Lucio De Re [this message]
2010-11-18 15:10         ` erik quanstrom
2010-11-18 16:46           ` erik quanstrom
2010-11-18 18:01             ` Lucio De Re
2010-11-18 18:29               ` C H Forsyth
2010-11-18 18:23                 ` Lucio De Re
2010-11-18 18:33                 ` Lucio De Re
2010-11-18 18:43               ` erik quanstrom
2010-11-18 18:54                 ` erik quanstrom
2010-11-18 19:01                 ` Lucio De Re
2010-11-18 19:27                   ` Lucio De Re
2010-11-18 18:03           ` Lucio De Re
2010-11-18  5:57 ` Lucio De Re
  -- strict thread matches above, loose matches on Subject: below --
2010-11-16  4:21 lucio
2010-11-16  4:40 ` erik quanstrom
2010-11-16  5:03   ` lucio
2010-11-16  5:11     ` cinap_lenrek
2010-11-16  5:18       ` lucio
2010-11-16  5:28         ` cinap_lenrek
2010-11-16  6:47           ` Lucio De Re
2010-11-16 13:53     ` erik quanstrom
2010-11-16 18:03       ` lucio
2010-11-17  4:08         ` Lucio De Re
2010-11-17  4:18           ` erik quanstrom
2010-11-17  4:37             ` Lucio De Re
2010-11-17  4:43               ` erik quanstrom
2010-11-17  5:22             ` cinap_lenrek
2010-11-17  6:45               ` Lucio De Re
2010-11-17  7:03                 ` Lucio De Re
2010-11-17  7:09                   ` erik quanstrom
2010-11-17  5:33             ` cinap_lenrek
2010-11-17  6:48               ` Lucio De Re
2010-11-17  7:03                 ` erik quanstrom
2010-11-17 14:40           ` Russ Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101118104836.GB3464@fangle.proxima.alt.za \
    --to=lucio@proxima.alt.za \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).