[ovs-dev] new GCC and sparse warnings on v2.6.36

Jesse Gross jesse at nicira.com
Wed Dec 29 20:05:35 UTC 2010


On Wed, Dec 29, 2010 at 2:19 PM, Ben Pfaff <blp at nicira.com> wrote:
> With v2.6.36 and "master" I'm getting new sparse warnings.  I'm happy to
> ignore these if they go away in v2.6.37 (haven't tried it):
>
>  CHECK   /home/blp/db/_build/datapath/linux-2.6/dp_notify.c
>  CC [M]  /home/blp/db/_build/datapath/linux-2.6/dp_notify.o
> /home/blp/db/_build/datapath/linux-2.6/datapath.c:99:16: warning: incorrect type in argument 1 (different modifiers)
> /home/blp/db/_build/datapath/linux-2.6/datapath.c:99:16:    expected struct lockdep_map *lock
> /home/blp/db/_build/datapath/linux-2.6/datapath.c:99:16:    got struct lockdep_map const *<noident>
> /home/blp/db/_build/datapath/linux-2.6/datapath.c:106:16: warning: incorrect type in argument 1 (different modifiers)
> /home/blp/db/_build/datapath/linux-2.6/datapath.c:106:16:    expected struct lockdep_map *lock
> /home/blp/db/_build/datapath/linux-2.6/datapath.c:106:16:    got struct lockdep_map const *<noident>
>
> But I'm also getting new GCC warnings that I don't like very much:
>
>  CC [M]  /home/blp/db/_build/datapath/linux-2.6/dp_sysfs_dp.o
>  CHECK   /home/blp/db/_build/datapath/linux-2.6/dp_sysfs_if.c
> /home/blp/db/_build/datapath/linux-2.6/datapath.c: In function 'get_table_protected':
> /home/blp/db/_build/datapath/linux-2.6/datapath.c:99: warning: passing argument 1 of 'lock_is_held' discards qualifiers from pointer target type
> include/linux/lockdep.h:313: note: expected 'struct lockdep_map *' but argument is of type 'const struct lockdep_map *'
> /home/blp/db/_build/datapath/linux-2.6/datapath.c: In function 'get_vport_protected':
> /home/blp/db/_build/datapath/linux-2.6/datapath.c:106: warning: passing argument 1 of 'lock_is_held' discards qualifiers from pointer target type
> include/linux/lockdep.h:313: note: expected 'struct lockdep_map *' but argument is of type 'const struct lockdep_map *'
>  CC [M]  /home/blp/db/_build/datapath/linux-2.6/dp_sysfs_if.o
>  CHECK   /home/blp/db/_build/datapath/linux-2.6/flow.c
>  CC [M]  /home/blp/db/_build/datapath/linux-2.6/flow.o
>  CHECK   /home/blp/db/_build/datapath/linux-2.6/loop_counter.c

Both the sparse and GCC warnings are the same thing.  They're not
kernel version specific - I just missed them since I run sparse on one
machine and lockdep on another and each only has a kernel configured
for the appropriate checks.  It's just some overzealous use of const,
so I'll send out a patch for that with the other fixes.

>
> The following is one that I got before and am happy to continue ignoring:
>
> /home/blp/db/_build/datapath/linux-2.6/loop_counter.c:35:8: warning: symbol 'loop_counters' was not declared. Should it be static?
>  CC [M]  /home/blp/db/_build/datapath/linux-2.6/loop_counter.o

This one is because you have CONFIG_DEBUG_FORCE_WEAK_PER_CPU set.
With that option the macro defines a bunch of other variables before
the actual percpu one.  The first one grabs the static, leaving the
actual loop_counter variable without it.  I don't think there is
anything that we can do about this (other than not use this form of
percpu declaration, which does not seem like the right solution).

I had to turn off tracing because it was generating a bunch of RCU
sparse errors but other than that (and the lockdep thing that you
mentioned above) I get a clean bill of health.  Do you see anything
else?




More information about the dev mailing list