[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e2e108260812040412j1f3f353bv2834750dbe914c48@mail.gmail.com>
Date: Thu, 4 Dec 2008 13:12:58 +0100
From: "Bart Van Assche" <bart.vanassche@...il.com>
To: "kernel list" <linux-kernel@...r.kernel.org>
Cc: "Vladislav Bolkhovitin" <vst@...b.net>,
"Alexander Shishkin" <alexander.shishckin@...il.com>,
"Johannes Berg" <johannes@...solutions.net>,
"Geert Uytterhoeven" <geert@...ux-m68k.org>
Subject: Re: A question about sparse: how to use __acquires() and __releases() correctly ?
[ping]
Is there anyone who can help me with the question below ?
Thanks,
Bart.
On Tue, Dec 2, 2008 at 8:59 PM, Bart Van Assche
<bart.vanassche@...il.com> wrote:
> 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.
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists