Steve French | 19 Aug 23:45
Gravatar

context imbalance false positive sparse warnings

Just building one directory of the kernel (./fs/*.c), ie "make bzImage
C=1" generates more than 200 sparse warnings similar to
       warning: context imbalance in 'set_task_ioprio': wrong count at exit

Even the simplest use cases throw this error e.g. fs/super.c line 162-164:

static void put_super(struct super_block *sb)
{
       spin_lock(&sb_lock);
       __put_super(sb);
       spin_unlock(&sb_lock);
}

It doesn't look like sparse has been fixed in a few months, unless the
sparse tool repository has moved from the
    /pub/scm / devel/sparse/sparse.git
directory on git.kernel.org

Is there a way to turn just this warning off (the thousands of context
imbalance messages generated by the kernel build make it harder to see
real errors which sparse could catch)?

--

-- 
Thanks,

Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
(Continue reading)

Stalin Kenny | 20 Aug 00:00

Re: context imbalance false positive sparse warnings

> Even the simplest use cases throw this error e.g. fs/super.c line 162-164:
>
> static void put_super(struct super_block *sb)
> {
>       spin_lock(&sb_lock);
>       __put_super(sb);
>       spin_unlock(&sb_lock);
> }

What is the sparse error when you call this function ?

On 8/19/08, Steve French <smfrench <at> gmail.com> wrote:
> Just building one directory of the kernel (./fs/*.c), ie "make bzImage
> C=1" generates more than 200 sparse warnings similar to
>       warning: context imbalance in 'set_task_ioprio': wrong count at exit
>
> Even the simplest use cases throw this error e.g. fs/super.c line 162-164:
>
> static void put_super(struct super_block *sb)
> {
>       spin_lock(&sb_lock);
>       __put_super(sb);
>       spin_unlock(&sb_lock);
> }
>
>
> It doesn't look like sparse has been fixed in a few months, unless the
> sparse tool repository has moved from the
>    /pub/scm / devel/sparse/sparse.git
> directory on git.kernel.org
(Continue reading)

Steve French | 20 Aug 00:22
Gravatar

Re: context imbalance false positive sparse warnings

On Tue, Aug 19, 2008 at 5:00 PM, Stalin Kenny <stalinlinux <at> gmail.com> wrote:
>> Even the simplest use cases throw this error e.g. fs/super.c line 162-164:
>>
>> static void put_super(struct super_block *sb)
>> {
>>       spin_lock(&sb_lock);
>>       __put_super(sb);
>>       spin_unlock(&sb_lock);
>> }
>
> What is the sparse error when you call this function ?
CHECK   fs/super.c
fs/super.c:164:2: warning: context imbalance in 'put_super': wrong count at exit
fs/super.c:164:2:    context 'lock': wanted 0, got 1

>
> On 8/19/08, Steve French <smfrench <at> gmail.com> wrote:
>> Just building one directory of the kernel (./fs/*.c), ie "make bzImage
>> C=1" generates more than 200 sparse warnings similar to
>>       warning: context imbalance in 'set_task_ioprio': wrong count at exit
>>
>> Even the simplest use cases throw this error e.g. fs/super.c line 162-164:
>>
>> static void put_super(struct super_block *sb)
>> {
>>       spin_lock(&sb_lock);
>>       __put_super(sb);
>>       spin_unlock(&sb_lock);
>> }
>>
(Continue reading)

Harvey Harrison | 20 Aug 00:26

Re: context imbalance false positive sparse warnings

On Tue, 2008-08-19 at 17:22 -0500, Steve French wrote:
> On Tue, Aug 19, 2008 at 5:00 PM, Stalin Kenny <stalinlinux <at> gmail.com> wrote:
> >> Even the simplest use cases throw this error e.g. fs/super.c line 162-164:
> >>
> >> static void put_super(struct super_block *sb)
> >> {
> >>       spin_lock(&sb_lock);
> >>       __put_super(sb);
> >>       spin_unlock(&sb_lock);
> >> }
> >
> > What is the sparse error when you call this function ?
> CHECK   fs/super.c
> fs/super.c:164:2: warning: context imbalance in 'put_super': wrong count at exit
> fs/super.c:164:2:    context 'lock': wanted 0, got 1
> 
> 

Johannes Berg had a 9-patch series that improved this somewhat, but they had
some bugs in them (crashes).  But I've been running with them anyway as they
do improve cases like this significantly.

Harvey

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

(Continue reading)

Johannes Berg | 10 Sep 09:47
Favicon

Re: context imbalance false positive sparse warnings

On Tue, 2008-08-19 at 15:26 -0700, Harvey Harrison wrote:
> On Tue, 2008-08-19 at 17:22 -0500, Steve French wrote:
> > On Tue, Aug 19, 2008 at 5:00 PM, Stalin Kenny <stalinlinux <at> gmail.com> wrote:
> > >> Even the simplest use cases throw this error e.g. fs/super.c line 162-164:
> > >>
> > >> static void put_super(struct super_block *sb)
> > >> {
> > >>       spin_lock(&sb_lock);
> > >>       __put_super(sb);
> > >>       spin_unlock(&sb_lock);
> > >> }
> > >
> > > What is the sparse error when you call this function ?
> > CHECK   fs/super.c
> > fs/super.c:164:2: warning: context imbalance in 'put_super': wrong count at exit
> > fs/super.c:164:2:    context 'lock': wanted 0, got 1
> > 
> > 
> 
> Johannes Berg had a 9-patch series that improved this somewhat, but they had
> some bugs in them (crashes).  But I've been running with them anyway as they
> do improve cases like this significantly.

I've just sent out a fixed version and with it I get no errors on
fs/super.c when I apply this small fixup:

diff --git a/fs/super.c b/fs/super.c
index e931ae9..6810845 100644
--- a/fs/super.c
+++ b/fs/super.c
(Continue reading)


Gmane