public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* Trying to acquire global lock from systemtap module
@ 2009-07-22 17:14 Anupama Chandwani
  2009-07-22 17:38 ` Jim Keniston
  0 siblings, 1 reply; 3+ messages in thread
From: Anupama Chandwani @ 2009-07-22 17:14 UTC (permalink / raw)
  To: systemtap

Hi,

In my probe handler, I want to scan the task list using for_each_process(p).
For this I need to hold a read_lock on tasklist_lock.

tasklist_lock is a global data structure of type rwlock_t, and I am setting the probe on copy_process (from kernel/fork.c where tasklist_lock is defined)
But I am not able to dereference this address. Also when I do a read_lock(&tasklist_lock), i get following error while inserting module.

Error inserting module 'module_name.ko' : Unknown symbol in module

And dmesg tells me that the unknown symbol is 'tasklist_lock'

Any pointers?

Cheers,
Anupama

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

* Re: Trying to acquire global lock from systemtap module
  2009-07-22 17:14 Trying to acquire global lock from systemtap module Anupama Chandwani
@ 2009-07-22 17:38 ` Jim Keniston
  2009-07-22 17:46   ` Anupama Chandwani
  0 siblings, 1 reply; 3+ messages in thread
From: Jim Keniston @ 2009-07-22 17:38 UTC (permalink / raw)
  To: Anupama Chandwani; +Cc: systemtap


On Wed, 2009-07-22 at 10:14 -0700, Anupama Chandwani wrote:
> Hi,
> 
> In my probe handler, I want to scan the task list using for_each_process(p).
> For this I need to hold a read_lock on tasklist_lock.
> 
> tasklist_lock is a global data structure of type rwlock_t, and I am setting the probe on copy_process (from kernel/fork.c where tasklist_lock is defined)
> But I am not able to dereference this address. Also when I do a read_lock(&tasklist_lock), i get following error while inserting module.
> 
> Error inserting module 'module_name.ko' : Unknown symbol in module
> 
> And dmesg tells me that the unknown symbol is 'tasklist_lock'
> 
> Any pointers?

tasklist_lock was unexported a while back.  But there's an alternative.
One effect of rcu_read_lock() is to prevent changes to the task list, so
wrapping your for_each_process() code in
rcu_read_lock()/rcu_read_unlock() should do the trick.  See, for
example, zap_threads() in fs/exec.c.

> 
> Cheers,
> Anupama

Jim

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

* RE: Trying to acquire global lock from systemtap module
  2009-07-22 17:38 ` Jim Keniston
@ 2009-07-22 17:46   ` Anupama Chandwani
  0 siblings, 0 replies; 3+ messages in thread
From: Anupama Chandwani @ 2009-07-22 17:46 UTC (permalink / raw)
  To: Jim Keniston; +Cc: systemtap, Krishna Raj Raja

Thanks Jim,

rcu_read_lock/unlock works perfectly.

Cheers,
Anupama

-----Original Message-----
From: Jim Keniston [mailto:jkenisto@us.ibm.com] 
Sent: Wednesday, July 22, 2009 10:38 AM
To: Anupama Chandwani
Cc: systemtap@sourceware.org
Subject: Re: Trying to acquire global lock from systemtap module


On Wed, 2009-07-22 at 10:14 -0700, Anupama Chandwani wrote:
> Hi,
> 
> In my probe handler, I want to scan the task list using for_each_process(p).
> For this I need to hold a read_lock on tasklist_lock.
> 
> tasklist_lock is a global data structure of type rwlock_t, and I am setting the probe on copy_process (from kernel/fork.c where tasklist_lock is defined)
> But I am not able to dereference this address. Also when I do a read_lock(&tasklist_lock), i get following error while inserting module.
> 
> Error inserting module 'module_name.ko' : Unknown symbol in module
> 
> And dmesg tells me that the unknown symbol is 'tasklist_lock'
> 
> Any pointers?

tasklist_lock was unexported a while back.  But there's an alternative.
One effect of rcu_read_lock() is to prevent changes to the task list, so
wrapping your for_each_process() code in
rcu_read_lock()/rcu_read_unlock() should do the trick.  See, for
example, zap_threads() in fs/exec.c.

> 
> Cheers,
> Anupama

Jim

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

end of thread, other threads:[~2009-07-22 17:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-22 17:14 Trying to acquire global lock from systemtap module Anupama Chandwani
2009-07-22 17:38 ` Jim Keniston
2009-07-22 17:46   ` Anupama Chandwani

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 read-only IMAP folder(s) and NNTP newsgroup(s).