linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Roskin <proski@gnu.org>
To: Christopher Li <sparse@chrisli.org>
Cc: Russ Cox <rsc@swtch.com>, linux-sparse@vger.kernel.org
Subject: Re: sparse context tags
Date: Mon, 12 Mar 2007 21:31:06 -0400	[thread overview]
Message-ID: <1173749466.13436.32.camel@dv> (raw)
In-Reply-To: <20070313003234.GA4640@chrisli.org>

On Mon, 2007-03-12 at 17:32 -0700, Christopher Li wrote:

> That is because sparse can't distinguish which lock is
> acquired. It is actually hard to get that information.
> Even though the expression is the same, the actual lock
> might be different.
> 
> e.g.
> 
> redlock(foo->redlock);
> foo = bar;
> redunlock (foo->redlock);

Just an idea.  The Linux "runtime locking correctness validator" (see
Documentation/lockdep-design.txt in the Linux sources) distinguishes
between lock classes.

Sparse could use a similar approach.  I think it would not catch your
example, but it would catch a more realistic case when one lock is
acquired and another is released even by the same function with the same
attributes:

lock(foo->redlock);
lock(foo->bluelock);
unlock(foo->redlock);
unlock(foo->bluelock);

Lock class could be just a unique reference to a place where the lock
was declared.  That would put some limitations on what a lock could be
(an address of a variable or a field), but I think it's OK.

-- 
Regards,
Pavel Roskin

      reply	other threads:[~2007-03-13  1:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-12 22:37 sparse context tags Russ Cox
2007-03-13  0:32 ` Christopher Li
2007-03-13  1:31   ` Pavel Roskin [this message]

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=1173749466.13436.32.camel@dv \
    --to=proski@gnu.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=rsc@swtch.com \
    --cc=sparse@chrisli.org \
    /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).