From: "Bart Van Assche" <bart.vanassche@gmail.com>
To: "kernel list" <linux-kernel@vger.kernel.org>
Cc: "Vladislav Bolkhovitin" <vst@vlnb.net>,
"Alexander Shishkin" <alexander.shishckin@gmail.com>
Subject: A question about sparse: how to use __acquires() and __releases() correctly ?
Date: Tue, 2 Dec 2008 20:59:54 +0100 [thread overview]
Message-ID: <e2e108260812021159r31eb86a1v95d2cbdf7cfdae2d@mail.gmail.com> (raw)
Hello,
I'm helping to prepare the SCST source code for inclusion in the Linux
kernel by a.o. cleaning up sparse warnings. Although most of the SCST
source code has been annotated by this time it's still not clear to me
how to use __acquires() and __releases() correctly.
I will illustrate my questions via the following code from
net/core/dev.c, Linux kernel version 2.6.27.7:
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
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.
* If the __releases() annotation is used correctly in net/core/dev.c,
why does sparse complain about a context problem ?
Please keep me in CC -- I'm not subscribed to the LKML.
Bart.
next reply other threads:[~2008-12-02 20:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-02 19:59 Bart Van Assche [this message]
2008-12-04 12:12 ` Bart Van Assche
2008-12-04 13:06 ` Johannes Berg
2008-12-04 13:29 ` Eric Dumazet
2008-12-04 14:04 ` Bart Van Assche
2008-12-04 14:12 ` Eric Dumazet
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=e2e108260812021159r31eb86a1v95d2cbdf7cfdae2d@mail.gmail.com \
--to=bart.vanassche@gmail.com \
--cc=alexander.shishckin@gmail.com \
--cc=linux-kernel@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
Powered by JetHome