linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: David Brownell <david-b@pacbell.net>
Cc: linux-sparse@vger.kernel.org
Subject: Re: sparse context warning problem ...
Date: Wed, 14 May 2008 16:06:16 +0200	[thread overview]
Message-ID: <1210773976.29705.4.camel@johannes.berg> (raw)
In-Reply-To: <200805140658.04018.david-b@pacbell.net>

[-- Attachment #1: Type: text/plain, Size: 1745 bytes --]


> I used the OHCI example because it was a clear and readily
> available/reproducible example of how this is a regression;
> but I came across the problem with a different driver.  In
> that driver, I just made sure that the strings were now
> identical ... and the failures still came up with "sparse".
> 
> That's on a UP build.  (Albeit with PREEMPT and all the
> debug options available ... since I'm debugging!)

I guess you get the spinlock_api_up.h version when building w/o SMP and
w/o CONFIG_DEBUG_SPINLOCK, but it doesn't really matter. The mismatch is
there one way or another.

> Yeah, well the lock being acquired or released *IS* "ohci->lock",
> but the spinlock calls don't take the lock, they take pointers
> to it!
> 
> If you were to argue that understanding pointers like that is a
> lot to demand of "sparse", I might agree.  But that won't change
> the fact that locks themselves are not pointers to locks.  ;)

Well, yes, but for purposes of comparing the expression it would be a
lot simpler to change the code since otherwise sparse would have to be
aware of whether a function takes a pointer to a lock or not. I don't
see why one couldn't use the context tracking stuff for something not
passed via pointers when the callee doesn't need to take/modify the
context.

> > Ultimately, this whole problem comes from the fact that sparse accepted
> > adding an expression, documented it, but never complained if they
> > slightly mismatched as above.
> 
> This still doesn't quite add up, though...

?

Take this to an old sparse:

__acquire(FOO);
__release(BAR);

and it will not complain about a context violation. My patches attempt
to change that, with fallouts.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

  reply	other threads:[~2008-05-14 14:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-11  0:24 sparse context warning problem David Brownell
2008-05-11  0:40 ` Johannes Berg
2008-05-11  3:18   ` David Brownell
2008-05-11  9:46     ` Johannes Berg
2008-05-13 21:52   ` Johannes Berg
2008-05-14 13:58     ` David Brownell
2008-05-14 14:06       ` Johannes Berg [this message]
2008-05-29  8:47       ` Johannes Berg
2008-05-29  9:39         ` David Brownell
2008-05-29  9:54           ` 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=1210773976.29705.4.camel@johannes.berg \
    --to=johannes@sipsolutions.net \
    --cc=david-b@pacbell.net \
    --cc=linux-sparse@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;
as well as URLs for NNTP newsgroup(s).