public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Anupama Chandwani <achandwani@vmware.com>
To: Jim Keniston <jkenisto@us.ibm.com>
Cc: "systemtap@sourceware.org" <systemtap@sourceware.org>,
	Krishna Raj Raja 	<krraja@vmware.com>
Subject: RE: Trying to acquire global lock from systemtap module
Date: Wed, 22 Jul 2009 17:46:00 -0000	[thread overview]
Message-ID: <806F700D7E08E9408413160B05EB666726BC45BBF8@EXCH-MBX-1.vmware.com> (raw)
In-Reply-To: <1248284308.5203.32.camel@localhost.localdomain>

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

      reply	other threads:[~2009-07-22 17:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-22 17:14 Anupama Chandwani
2009-07-22 17:38 ` Jim Keniston
2009-07-22 17:46   ` Anupama Chandwani [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=806F700D7E08E9408413160B05EB666726BC45BBF8@EXCH-MBX-1.vmware.com \
    --to=achandwani@vmware.com \
    --cc=jkenisto@us.ibm.com \
    --cc=krraja@vmware.com \
    --cc=systemtap@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).