public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: kernel-janitors@vger.kernel.org
Subject: Re: busy loops in kernel
Date: Sun, 22 Jan 2012 06:09:36 +0000	[thread overview]
Message-ID: <alpine.DEB.2.02.1201220702240.2189@hadrien> (raw)
In-Reply-To: <CAFTXME+fNAqqZjO4oRmbwt2cFbaDgbLW9gg94tzJvF4bwy7DtQ@mail.gmail.com>



On Sat, 21 Jan 2012, Asim wrote:

> Yeah - these are not the strongest parts of the analyses. Lately, as
> we have added more busses, interprocedural analyses and supported
> newer kernels, we've seen more problems. In the first example, CIL(our
> underlying analysis language) cannot distinguish between for and while
> loops. To distinguish for loops and to eliminate certain class of
> timers, we try to detect for loops and counters by searching for
> integers that increment/decrement by 1. Here, it increments by 25, and
> it is not caught as a for loop. Then, the intermediate code generated
> for this is :
>
> #line 185
>    tmp___7 = readl((void const volatile   *)(mem + i));
> #line 185
>    if (tmp___7 = 305419896U) {
> #line 185
>      tmp___8 = readl((void const volatile   *)((mem + i) + 4));
> #line 185
>      if (tmp___8 = 878082066U) {
> #line 185
>        tmp___9 = readl((void const volatile   *)((mem + i) + 8));
> #line 185
>        if (tmp___9 = 1450709556U) {
> #line 185
>          tmp___10 = readl((void const volatile   *)((mem + i) + 12));
> #line 185
>          if (tmp___10 = 2014458966U) {
> #line 189
>            return ((struct ivtv_mailbox  volatile  *)((mem + i) + 16));
>          }
>
>
> Here it detects, that the exit condition is dependent on a read from
> device, and marks this loop as a suspect.

There exists an exit condition that has this property, but isn't there 
only a problem if this is the only exit condition?  Or is the code 
obfuscated by CIL such that the normal exit cannot be detected?

> Apart from random
> increments, we also face problems with casts used while detecting loop
> exit conditions/for loops. Second one is a bug in how i2c_transfer
> function is handled (i2c bus was added sometime this year). I've fixed
> it and will update results shorty...
>
> As I mentioned in my previous email, I would perhaps give priority to
> the simpler examples that are plenty..

Are they ordered by increasing complexity?  I didn't start at the top.  In 
any case the false positive rate seems to be much higher than 5%.  So you 
might get better results by removing the false positives first.  Also, you 
might want to send the reports to the specific maintainers (you can use 
get_maintainer.pl to get a list for each file).  I'm not sure that the 
people who read the kernel janitors list would have the expertise to both 
be sure that there is a real problem and choose the desired solution.  But 
if there is a real problem, the maintainer will probably react quickly.

julia

  parent reply	other threads:[~2012-01-22  6:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-18  4:15 busy loops in kernel Asim
2012-01-18  4:55 ` Greg Dietsche
2012-01-18  7:37 ` Dan Carpenter
2012-01-18  7:39 ` Dan Carpenter
2012-01-18 17:45 ` Asim
2012-01-18 17:48 ` Asim
2012-01-21 17:33 ` Asim
2012-01-21 19:04 ` Julia Lawall
2012-01-21 20:46 ` Asim
2012-01-21 20:50 ` Julia Lawall
2012-01-21 22:32 ` Asim
2012-01-22  6:09 ` Julia Lawall [this message]
2012-01-22 12:17 ` Bernd Petrovitsch

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.02.1201220702240.2189@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=kernel-janitors@vger.kernel.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