Re: sparse context tags

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

 



On Mon, 2007-03-12 at 17:32 -0700, Christopher Li wrote:

> That is because sparse can't distinguish which lock is
> acquired. It is actually hard to get that information.
> Even though the expression is the same, the actual lock
> might be different.
> 
> e.g.
> 
> redlock(foo->redlock);
> foo = bar;
> redunlock (foo->redlock);

Just an idea.  The Linux "runtime locking correctness validator" (see
Documentation/lockdep-design.txt in the Linux sources) distinguishes
between lock classes.

Sparse could use a similar approach.  I think it would not catch your
example, but it would catch a more realistic case when one lock is
acquired and another is released even by the same function with the same
attributes:

lock(foo->redlock);
lock(foo->bluelock);
unlock(foo->redlock);
unlock(foo->bluelock);

Lock class could be just a unique reference to a place where the lock
was declared.  That would put some limitations on what a lock could be
(an address of a variable or a field), but I think it's OK.

-- 
Regards,
Pavel Roskin

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

[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