From: Julia Lawall <julia.lawall@lip6.fr>
To: Nicholas Mc Guire <der.herr@hofr.at>
Cc: Gilles Muller <Gilles.Muller@lip6.fr>,
Nicolas Palix <nicolas.palix@imag.fr>,
Michal Marek <mmarek@suse.cz>,
Andreas Platschek <platschek@ict.tuwien.ac.at>,
cocci@systeme.lip6.fr, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/3 RFC] Coccinelle: completion API checking
Date: Fri, 2 Jan 2015 12:46:15 +0100 (CET) [thread overview]
Message-ID: <alpine.DEB.2.10.1501021241550.2558@hadrien> (raw)
In-Reply-To: <1420192752-4889-1-git-send-email-der.herr@hofr.at>
On Fri, 2 Jan 2015, Nicholas Mc Guire wrote:
>
> This little set of semantic patches is for partially checking the
> completion API. It seems to be working correctly and has not yet
> produced any false-positive.
>
> The cases being detected are:
>
> 1/3 - duplicate init_completions.
> 2/3 - incorrect static initialization of completion on stack.
> 3/3 - re-initialization of completion with init_completion() rather
> than reinit_completion().
>
> semantic patch findings files confirmed
> duplicate_init_completion.cocci 2 2 2
> false_declare_completion.cocci 6 5 3
> false_init_compltion.cocci 9 6 5
>
> Note: false_declare_completion.cocci runs extremely slow on my system
> roughly a factor 10 slower than the other two - not clear why.
The problem is the use of <... ...>. That is good because it allows
DECLARE_COMPLETION not to appear on some execution paths, but it is not so
good because it allows DECLARE_COMPLETION to appear on no execution paths
at all. So the semantic patch is considered to be relevant to every file,
and every file has to be parsed, which takes a lot of time.
To fix the problem, you can first check whether the call actually exists
in each function:
@pre_e exists@
identifier f;
declarer name DECLARE_COMPLETION;
@@
f(...) {
<+...
DECLARE_COMPLETION(...);
...+>
}
Then only run the second rules on functions for which pre_e is satisfied.
That is, in the rule e, instead of putting identifier f, you can put
identifier pre_e.f. You can do the same in the rule ep. Ep is already
looking for the existence of an execution path, so for ep you could also
just replace the <... ...> by <+... ...+> instead of relying on pre_e.
julia
prev parent reply other threads:[~2015-01-02 11:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-02 9:59 Nicholas Mc Guire
2015-01-02 9:59 ` [PATCH 1/3 RFC] Coccinelle: drop unecessary duplicated init_compltion calls Nicholas Mc Guire
2015-01-02 9:59 ` [PATCH 2/3 RFC] Coccinelle: check for incorrect DECLARE_COMPLETION use Nicholas Mc Guire
2015-01-02 9:59 ` [PATCH 3/3 RFC] Coccinelle: incorrect use of multiple init_completion Nicholas Mc Guire
2015-01-02 11:46 ` Julia Lawall [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=alpine.DEB.2.10.1501021241550.2558@hadrien \
--to=julia.lawall@lip6.fr \
--cc=Gilles.Muller@lip6.fr \
--cc=cocci@systeme.lip6.fr \
--cc=der.herr@hofr.at \
--cc=linux-kernel@vger.kernel.org \
--cc=mmarek@suse.cz \
--cc=nicolas.palix@imag.fr \
--cc=platschek@ict.tuwien.ac.at \
/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
all inboxes | Powered by JetHome®