From: "Gorka Guardiola" <paurea@gmail.com>
To: "Fans of the OS Plan 9 from Bell Labs" <9fans@9fans.net>
Subject: Re: [9fans] ilock funny?
Date: Thu, 29 May 2008 15:40:50 +0200 [thread overview]
Message-ID: <599f06db0805290640r7d8b7f8ajc413748a22508eac@mail.gmail.com> (raw)
In-Reply-To: <c15da790f17dd290f2a12308293e124f@quanstro.net>
On Thu, May 29, 2008 at 3:34 AM, erik quanstrom <quanstro@quanstro.net> wrote:
> in this situation there are 128 kernel procs that all
> increment the same counter with some code
> that looks like so:
>
> void
> incref(void)
> {
> ilock(&somelock);
> someval++;
> iunlock(&somelock);
> }
>
> (i realize there are probablly better ways to do this.)
> there is a similar function to decrease the value.
> other than this, there are no references to somelock.
>
> what i'm seeing is a panic with someval = 5. (gathered
> from the fact that someval is stored immediately after
> the somelock and is dumped with dumplockmem())
> and the panic message:
What you say simply cannot happen if your code was correct (the one
you are not showing us :-)).
isilock is a variable set by the lock to tainted as ilock instead of lock.
Having isilock=1 onlys happen After the lock has been acquired by someone.
The lock is checked with a tas() which I assume works because everything
is based on it.
My guess is that you have the lock uninitialized (key is not what it should be),
so key has a bogus value and that is where your problems start.
Zeroing the lock before using it should do the trick.
HTH.
--
- curiosity sKilled the cat
next prev parent reply other threads:[~2008-05-29 13:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-29 1:34 erik quanstrom
2008-05-29 13:40 ` Gorka Guardiola [this message]
2008-05-29 14:01 ` erik quanstrom
2008-05-29 18:47 ` Gorka Guardiola
2008-05-29 13:59 ` Russ Cox
2008-05-29 14:00 ` erik quanstrom
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=599f06db0805290640r7d8b7f8ajc413748a22508eac@mail.gmail.com \
--to=paurea@gmail.com \
--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).