From: Josh Triplett <josh@freedesktop.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Christopher Li <sparse@chrisli.org>,
Anton Altaparmakov <aia21@cam.ac.uk>,
linux-sparse@vger.kernel.org
Subject: Re: Another sparse warning...
Date: Tue, 13 Feb 2007 00:38:44 -0800 [thread overview]
Message-ID: <45D17914.8040608@freedesktop.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0702121947240.8424@woody.linux-foundation.org>
[-- Attachment #1: Type: text/plain, Size: 1498 bytes --]
Linus Torvalds wrote:
> On Mon, 12 Feb 2007, Christopher Li wrote:
>>> - it shows the *programmer* that the function is doing somethign
>>> "strange" (not really strange, but still: it's basically a fairly
>>> readable way that it's doing locking in a weird way).
>> Should the function declare in the header file has that as well?
>
> Yes.
>
>> When call one of those functions, it can know that function will change
>> context. That might be a way to solve the problem that some of the
>> spinlock function is not a inline function at all.
>
> I thought we did that already. I'm fairly sure I had this working at some
> point - exactly by having the calls just add up the (known) lock/unlock
> offsets.
On the other hand, the code currently does not check the context preconditions
of the callee; Sparse *could* check that any function requiring you to hold a
lock (have a context of 1) must only get called from a context in which you
hold that lock (have that context). Instead, Sparse only checks the context
change, rather than the incoming context value at the call site. It seems
trivial to add a check for context preconditions, and Linux could then have a
new annotation for __must_hold(lock) (usable on both functions and data), but
that check would also add numerous false positives caused by lack of
annotation, and that problem seems better solved by interprocedural analysis
than pervasive annotation.
Thoughts?
- Josh Triplett
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]
prev parent reply other threads:[~2007-02-13 8:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-12 10:23 Another sparse warning Anton Altaparmakov
2007-02-12 15:50 ` Linus Torvalds
2007-02-12 15:55 ` Anton Altaparmakov
2007-02-13 2:00 ` Christopher Li
2007-02-13 3:48 ` Linus Torvalds
2007-02-13 4:21 ` Christopher Li
2007-02-13 8:49 ` Josh Triplett
2007-02-13 8:38 ` Josh Triplett [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=45D17914.8040608@freedesktop.org \
--to=josh@freedesktop.org \
--cc=aia21@cam.ac.uk \
--cc=linux-sparse@vger.kernel.org \
--cc=sparse@chrisli.org \
--cc=torvalds@linux-foundation.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).