This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Trying to acquire global lock from systemtap module
- From: Jim Keniston <jkenisto at us dot ibm dot com>
- To: Anupama Chandwani <achandwani at vmware dot com>
- Cc: "systemtap at sourceware dot org" <systemtap at sourceware dot org>
- Date: Wed, 22 Jul 2009 10:38:28 -0700
- Subject: Re: Trying to acquire global lock from systemtap module
- References: <806F700D7E08E9408413160B05EB666726BBC40519@EXCH-MBX-1.vmware.com>
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