From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12597 invoked by alias); 22 Jul 2009 17:46:34 -0000 Received: (qmail 12587 invoked by uid 22791); 22 Jul 2009 17:46:34 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00 X-Spam-Check-By: sourceware.org Received: from smtp-outbound-2.vmware.com (HELO smtp-outbound-2.vmware.com) (65.115.85.73) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 22 Jul 2009 17:46:27 +0000 Received: from mailhost3.vmware.com (mailhost3.vmware.com [10.16.27.45]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id 7F09934006; Wed, 22 Jul 2009 10:46:26 -0700 (PDT) Received: from pa-exht01.vmware.com (pa-exht01.vmware.com [10.113.81.167]) by mailhost3.vmware.com (Postfix) with ESMTP id 642B3CD996; Wed, 22 Jul 2009 10:46:22 -0700 (PDT) Received: from EXCH-MBX-1.vmware.com ([10.113.81.173]) by pa-exht01.vmware.com ([10.113.81.167]) with mapi; Wed, 22 Jul 2009 10:46:18 -0700 From: Anupama Chandwani To: Jim Keniston CC: "systemtap@sourceware.org" , Krishna Raj Raja Date: Wed, 22 Jul 2009 17:46:00 -0000 Subject: RE: Trying to acquire global lock from systemtap module Message-ID: <806F700D7E08E9408413160B05EB666726BC45BBF8@EXCH-MBX-1.vmware.com> References: <806F700D7E08E9408413160B05EB666726BBC40519@EXCH-MBX-1.vmware.com> <1248284308.5203.32.camel@localhost.localdomain> In-Reply-To: <1248284308.5203.32.camel@localhost.localdomain> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2009-q3/txt/msg00186.txt.bz2 Thanks Jim, rcu_read_lock/unlock works perfectly. Cheers, Anupama -----Original Message----- From: Jim Keniston [mailto:jkenisto@us.ibm.com]=20 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, >=20 > 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. >=20 > tasklist_lock is a global data structure of type rwlock_t, and I am setti= ng the probe on copy_process (from kernel/fork.c where tasklist_lock is def= ined) > 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. >=20 > Error inserting module 'module_name.ko' : Unknown symbol in module >=20 > And dmesg tells me that the unknown symbol is 'tasklist_lock' >=20 > 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. >=20 > Cheers, > Anupama Jim