From: "Christopher Li" <sparse@chrisli.org>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: Josh Triplett <josh@freedesktop.org>,
Philipp Reisner <philipp.reisner@linbit.com>,
linux-sparse@vger.kernel.org,
Harvey Harrison <harvey.harrison@gmail.com>
Subject: Re: [PATCH 6/9 v2] check context expressions as expressions
Date: Wed, 10 Sep 2008 12:21:30 -0700 [thread overview]
Message-ID: <70318cbf0809101221n53dd06c2x19c68a1df336cb35@mail.gmail.com> (raw)
In-Reply-To: <1221032003.12266.4.camel@johannes.berg>
On Wed, Sep 10, 2008 at 12:33 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> +static int ident_equal(struct ident *ident1, struct ident *ident2)
> +{
> + if (ident1 == ident2)
> + return 1;
> + if (!ident1 || !ident2)
> + return 0;
> +
> + return ident1->len == ident2->len &&
> + !strncmp(ident1->name, ident2->name, ident1->len);
> +}
Nah, you pretty should never need to do that.
Ident equal should just need to compare ident1 == ident2.
All ident has been hashed. Same ident, should show up
as same pointer. Doing strncmp again is unnecessary.
I feel that this patch is adding too much hack to the
sparse front end. At the very least, can you
just change __context__ parsing to accept symbol expression
and the let the checking back end to do the code motions
stuff?
I haven't study the new context checking very carefully.
I actually prefer the Linus's old simple context checking.
Yes, that does not distinguish which symbols taking the lock.
But other than that it is working and counting the number
correctly. And, it is very simple.
The new context checking seems able to do more features.
But it has too many sore spots. I vote for back it out.
Instead of keep adding more hacks to fix up the problem. I
think we should step back and ask ourselves what do we really
want to achieve.
The fundamental problem I saw here is that, sparse does not
support cross function checking. There is no good way to save
some analyzed result for some function and used it later by other
function. That is why we actually have to put __context__
around so many functions. The __context__ describe what
these functions in forms of source code annotation. There is
only so much we can do with source code annotations.
I am not saying that annotation is not useful. I agree source
code annotation helps on the source code reading. But it
shouldn't limit checker only use the annotations. The checker
should be able to draw intelligent conclusions, by looking the
the function source code itself.
e.g. Why do we have to annotate foo_lock(&bar->lock) will take a lock
on &bar->lock? The checker should be able to find out foo_lock() just
callers some lower level locking functions. For example, let say if we
can force foo to be inlined into the caller even foo is not declared as
inline. Then there is no need to annotate foo itself. The caller see
exactly what foo does.
So, I think we should implement cross functions checking capability
systematically rather than putting more hacks on source code
annotation. The writer patch I send out earlier is one step towards it.
I will write up more detail proposal.
Chris
next prev parent reply other threads:[~2008-09-10 19:21 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-29 8:54 [PATCH 0/9] context tracking updates Johannes Berg
2008-05-29 8:54 ` [PATCH 1/9] add test for acquire/release Johannes Berg
2008-05-29 8:54 ` [PATCH 2/9] add __exact_context__ Johannes Berg
2008-05-29 8:54 ` [PATCH 3/9] allow context() attribute on variables Johannes Berg
2008-05-29 8:54 ` [PATCH 4/9] evaluate/expand context expressions Johannes Berg
2008-05-29 8:54 ` [PATCH 5/9] revert the conditional_context patch Johannes Berg
2008-05-29 8:54 ` [PATCH 6/9] check context expressions as expressions Johannes Berg
2008-09-10 7:33 ` [PATCH 6/9 v2] " Johannes Berg
2008-09-10 19:21 ` Christopher Li [this message]
2008-09-10 21:34 ` Johannes Berg
2008-09-11 0:15 ` Christopher Li
2008-05-29 8:54 ` [PATCH 7/9] test conditional result locking Johannes Berg
2008-05-29 8:54 ` [PATCH 8/9] show required context in instruction output Johannes Berg
2008-05-29 8:54 ` [PATCH 9/9] check inlines explicitly Johannes Berg
2008-05-29 23:14 ` [PATCH 9/9 v2] " Johannes Berg
2008-05-29 23:20 ` Harvey Harrison
2008-05-29 22:12 ` [PATCH 0/9] context tracking updates Harvey Harrison
2008-05-29 22:35 ` Harvey Harrison
2008-05-29 22:45 ` Johannes Berg
2008-05-29 22:47 ` Harvey Harrison
2008-05-29 22:51 ` Harvey Harrison
2008-05-29 22:54 ` Johannes Berg
2008-05-29 23:03 ` Pavel Roskin
2008-05-29 23:06 ` Johannes Berg
2008-05-29 23:15 ` Johannes Berg
2008-05-29 23:04 ` Johannes Berg
2008-07-20 12:30 ` Johannes Berg
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=70318cbf0809101221n53dd06c2x19c68a1df336cb35@mail.gmail.com \
--to=sparse@chrisli.org \
--cc=harvey.harrison@gmail.com \
--cc=johannes@sipsolutions.net \
--cc=josh@freedesktop.org \
--cc=linux-sparse@vger.kernel.org \
--cc=philipp.reisner@linbit.com \
/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).