LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* what is spinlock depth
@ 2011-01-31 20:27 Sri Ram Vemulpali
  2011-01-31 21:06 ` Jiri Slaby
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Sri Ram Vemulpali @ 2011-01-31 20:27 UTC (permalink / raw)
  To: Kernel-newbies, linux-kernel-mail

Hi all,

I am reading spinlock code and looking at struct raw_spinlock. I found
struct lockdep_map as member.
which is defined as

struct lockdep_map {
       struct lock_class_key           *key;
       struct lock_class               *class_cache[NR_LOCKDEP_CACHING_CLASSES];
       const char                      *name;
#ifdef CONFIG_LOCK_STAT
       int                             cpu;
      unsigned long                   ip;
#endif
};

Can anyone help me explain, how this struct helps the spinlock. Why do
we need lockdepth.
Thanks for help in advance.
-- 
Regards,
Sri.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: what is spinlock depth
  2011-01-31 20:27 what is spinlock depth Sri Ram Vemulpali
@ 2011-01-31 21:06 ` Jiri Slaby
  2011-02-01  5:15 ` Rajat Sharma
  2011-02-01  6:40 ` WANG Cong
  2 siblings, 0 replies; 4+ messages in thread
From: Jiri Slaby @ 2011-01-31 21:06 UTC (permalink / raw)
  To: Sri Ram Vemulpali; +Cc: Kernel-newbies, linux-kernel-mail

On 01/31/2011 09:27 PM, Sri Ram Vemulpali wrote:
> Hi all,
> 
> I am reading spinlock code and looking at struct raw_spinlock. I found
> struct lockdep_map as member.
> which is defined as
> 
> struct lockdep_map {
>        struct lock_class_key           *key;
>        struct lock_class               *class_cache[NR_LOCKDEP_CACHING_CLASSES];
>        const char                      *name;
> #ifdef CONFIG_LOCK_STAT
>        int                             cpu;
>       unsigned long                   ip;
> #endif
> };
> 
> Can anyone help me explain, how this struct helps the spinlock. Why do
> we need lockdepth.

It's not dep-th, but dep-endency. It's a debugging technique to
dynamically check for locking correctness. See more details in
Documentation/lockdep-design.txt.

-- 
js

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: what is spinlock depth
  2011-01-31 20:27 what is spinlock depth Sri Ram Vemulpali
  2011-01-31 21:06 ` Jiri Slaby
@ 2011-02-01  5:15 ` Rajat Sharma
  2011-02-01  6:40 ` WANG Cong
  2 siblings, 0 replies; 4+ messages in thread
From: Rajat Sharma @ 2011-02-01  5:15 UTC (permalink / raw)
  To: Sri Ram Vemulpali; +Cc: Kernel-newbies, linux-kernel-mail

lockdep finds out dependency in locking order at runtime. More on this
in kernel documentation linux/Documentation/lockdep-design.txt

Rajat

On Tue, Feb 1, 2011 at 1:57 AM, Sri Ram Vemulpali
<sri.ram.gmu06@gmail.com> wrote:
> Hi all,
>
> I am reading spinlock code and looking at struct raw_spinlock. I found
> struct lockdep_map as member.
> which is defined as
>
> struct lockdep_map {
>       struct lock_class_key           *key;
>       struct lock_class               *class_cache[NR_LOCKDEP_CACHING_CLASSES];
>       const char                      *name;
> #ifdef CONFIG_LOCK_STAT
>       int                             cpu;
>      unsigned long                   ip;
> #endif
> };
>
> Can anyone help me explain, how this struct helps the spinlock. Why do
> we need lockdepth.
> Thanks for help in advance.
> --
> Regards,
> Sri.
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: what is spinlock depth
  2011-01-31 20:27 what is spinlock depth Sri Ram Vemulpali
  2011-01-31 21:06 ` Jiri Slaby
  2011-02-01  5:15 ` Rajat Sharma
@ 2011-02-01  6:40 ` WANG Cong
  2 siblings, 0 replies; 4+ messages in thread
From: WANG Cong @ 2011-02-01  6:40 UTC (permalink / raw)
  To: linux-kernel; +Cc: kernelnewbies

On Mon, 31 Jan 2011 15:27:08 -0500, Sri Ram Vemulpali wrote:

> Hi all,
> 
> I am reading spinlock code and looking at struct raw_spinlock. I found
> struct lockdep_map as member.
...
> Can anyone help me explain, how this struct helps the spinlock. Why do
> we need lockdepth.

Here "lockdep" is short for Lock Dependence, not Lock Depth.

We do have lock depth things, e.g. ->lock_depth of struct task_struct,
which means the nested level of BKL. But spinlock can't be nested.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-02-01  6:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-31 20:27 what is spinlock depth Sri Ram Vemulpali
2011-01-31 21:06 ` Jiri Slaby
2011-02-01  5:15 ` Rajat Sharma
2011-02-01  6:40 ` WANG Cong

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