Re: [PATCH 1/3] make sparse keep its promise about context tracking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> I also use it to check a recusive lock mechanism. 
> 
> The sematics of what I implemented is:
> You simply use the __attribute__((context(ctx,in,out))) to
> annotate the context changes of functions.

Yeah, mostly because that's how the man page documents it :)

> to annotate a variable, struct/union member or a function that
> a certain locking primitive is required for accessing it, you
> do it by 
> 
> __attribute__((require_context(ctx,min,max,"type")))
> 
> ctx ... the expression that describes the locking primitive
> min ... the minimum of locks required of that locking primitive
> max ... the maximum allowed of locks of that locking primitive.
> type .. read, write, rdwr or call for the access type.
> 
> So you can express you need to hold this and that locking 
> primitive to write to something. But an other locking
> primitive might be sufficient for reading that something.
> 
> The annotation for a variable foo protected by a recursive lock
> bar would be:
> 
> int foo __attribute__((require_context(bar,1,99999,"rdwr")))

Ah. Makes sense as well, though now you can't do something like "require
context count two and decrement by one", can you? Or do you just do that
by combining the various attributes?

Anyhow, I don't really care which patch gets chosen.

Though, how can you actually track multiple contexts within a single
function if you have just a "struct expression *context_expr" for each
basic block? I guess I should just try your code :)

johannes

johannes

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux