Re: [RFC 1/3] add macros for new sparse features
From: Johannes Berg
Date: Fri Apr 11 2008 - 08:21:16 EST
> So, instead of
>
> /* always call with host_lock held */
> int foo(struct bar *b)
> {
>
> we could write
>
> int foo(struct bar *b) __requires(host_lock)
> {
>
> and let sparse check the call chains... or how is it used?
Yes.
> And what about dynamically allocated locks?
> E.g. b->lock
> Or struct host h* = container_of(b, struct host, m); with the necessity
> to hold h->lock...
I was looking at making sparse check that certain variable references
are under rcu, but it's not as easy. Also, the lock context is just an
arbitrary name, there's no way to actually link it to a certain variable
or so to differentiate between them. I think that's not really solvable
in sparse, look at the things lockdep has to do.
johannes
Attachment:
signature.asc
Description: This is a digitally signed message part