From: Johannes Berg <johannes@sipsolutions.net>
To: Bart Van Assche <bart.vanassche@gmail.com>
Cc: kernel list <linux-kernel@vger.kernel.org>,
Vladislav Bolkhovitin <vst@vlnb.net>,
Alexander Shishkin <alexander.shishckin@gmail.com>,
Geert Uytterhoeven <geert@linux-m68k.org>,
linux-sparse@vger.kernel.org
Subject: Re: A question about sparse: how to use __acquires() and __releases() correctly ?
Date: Thu, 04 Dec 2008 14:06:36 +0100 [thread overview]
Message-ID: <04bce30ee151e3f2638ef73388335cad@localhost> (raw)
In-Reply-To: <e2e108260812040412j1f3f353bv2834750dbe914c48@mail.gmail.com> (sfid-20081204_131259_634866_966B9D93)
On Thu, 4 Dec 2008 13:12:58 +0100, "Bart Van Assche"
<bart.vanassche@gmail.com> wrote:
> [ping]
>
> Is there anyone who can help me with the question below ?
>> void dev_seq_stop(struct seq_file *seq, void *v)
>> __releases(dev_base_lock)
>> {
>> read_unlock(&dev_base_lock);
>> }
>>
>> The command "make C=2 M=net/core" produces the following output for
>> the above function (using a sparse binary built from the sparse git
>> repository, last updated on August 26, 2008):
>>
>> net/core/dev.c:2579:2: warning: context problem in 'dev_seq_stop':
>> '_read_unlock' expected different context
>> net/core/dev.c:2579:2: context 'lock': wanted >= 1, got 0
I don't think sparse can properly handle this yet, at least not in a way
you'd expect it to. I've extended sparse to handle it, but the current git
tree has only a partial set of my changes applied, and the remaining ones
have been contested. (I still think my initial changes should be reverted
in the meantime)
>> My questions are as follows:
>> * Which argument type should be passed to __releases() -- a pointer to
>> a lock structure or the lock strucure itself ? In the header file
>> include/linux/spinlock_api_smp.h a pointer is passed to __acquires()
>> and __releases(), while other code (like the above) passes the lock
>> structure itself to the __acquires() and __releases() annotations.
sparse prett much ignores the first argument anyway, this isn't defined
yet.
>> * If the __releases() annotation is used correctly in net/core/dev.c,
>> why does sparse complain about a context problem ?
Maybe it is? I don't know off-hand.
johannes
parent reply other threads:[~2008-12-04 13:06 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <e2e108260812040412j1f3f353bv2834750dbe914c48@mail.gmail.com>]
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=04bce30ee151e3f2638ef73388335cad@localhost \
--to=johannes@sipsolutions.net \
--cc=alexander.shishckin@gmail.com \
--cc=bart.vanassche@gmail.com \
--cc=geert@linux-m68k.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sparse@vger.kernel.org \
--cc=vst@vlnb.net \
/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).