b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] "wrong count at exit" after spin_lock/_unlock pair
@ 2010-10-28 10:03 Sven Eckelmann
  0 siblings, 0 replies; only message in thread
From: Sven Eckelmann @ 2010-10-28 10:03 UTC (permalink / raw)
  To: linux-sparse; +Cc: b.a.t.m.a.n

[-- Attachment #1: Type: Text/Plain, Size: 2501 bytes --]

Hi,

I use sparse (cgcc) with different kernel versions to do some quick checks on 
the batman-adv kernel module. I noticed that my change from UP to SMP kernel 
generated some 'weird' warnings regarding a 'context imbalance' which I 
couldn't find, but went away when switching from spin_(un)lock to 
spin_(un)lock_bh - something which doesn't make sense in my mind.

I am not quite sure if this is linux-headers or sparse related - so I try to 
post it here first. I choose 2.6.32 because it is the latest long stable 
kernel and will be used in by Debian Squeeze.

My current test was done like that (on debian squeeze i386):
-----------------------------------------------------------
$ cd $MY_v2.6.32
$ make mrproper
$ make allnoconfig
$ grep -v 'CONFIG_MODULES is not set' .config > .config.tmp; mv .config.tmp \
 .config
$ grep -v 'CONFIG_NET is not set' .config > .config.tmp; mv .config.tmp \
 .config
$ grep -v 'CONFIG_SMP is not set' .config > .config.tmp; mv .config.tmp \
 .config
$ grep -v 'CONFIG_MODULE_UNLOAD is not set' .config > .config.tmp; mv \
 .config.tmp .config
$ echo 'CONFIG_MODULES=y' >> .config
$ echo 'CONFIG_NET=y' >> .config
$ echo 'CONFIG_SMP=y' >> .config
$ echo 'CONFIG_MODULE_UNLOAD=y' >> .config
$ echo 'xy'|make menuconfig
$ make prepare
$ make modules


$ mkdir test
$ cd test
$ cat << EOF > Makefile
obj-m += test.o
test-y += main.o
EOF
$ cat << EOF > main.c
#include <linux/module.h>
#include <linux/spinlock.h>

static DEFINE_SPINLOCK(testlock);

static int __init test_init(void)
{
        spin_lock(&testlock);
        spin_unlock(&testlock);
        return 0;
}

static void __exit test_exit(void)
{
}

module_init(test_init);
module_exit(test_exit);
EOF


$ make CC=cgcc -C $MY_v2.6.32/linux-next M=$(pwd) modules          
make: Entering directory `$MY_v2.6.32'
  CC [M]  $MY_v2.6.32/testmodule/main.o
$MY_v2.6.32/test/main.c:6:19: warning: context imbalance in 'test_init' - 
wrong count at exit
  LD [M]  $MY_v2.6.32/test/test.o
  Building modules, stage 2.
  MODPOST 1 modules
  LD [M]  $MY_v2.6.32/test/test.ko
make: Leaving directory `$MY_v2.6.32'
-----------------------------------------------------------

The sparse version was v0.4.3. It was obtained from git and and build using 
the current Debian squeeze tools provided by build-essential. It was run from 
the build dir by specifying it in $PATH

$ export PATH=$MY_SPARSE_CHECKOUT:$PATH

Best regards,
	Sven

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-10-28 10:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-28 10:03 [B.A.T.M.A.N.] "wrong count at exit" after spin_lock/_unlock pair Sven Eckelmann

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).