From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31573 invoked by alias); 26 Jan 2011 15:10:21 -0000 Received: (qmail 31563 invoked by uid 22791); 26 Jan 2011 15:10:19 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,TW_JL,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from e2.ny.us.ibm.com (HELO e2.ny.us.ibm.com) (32.97.182.142) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 26 Jan 2011 15:10:14 +0000 Received: from d01dlp02.pok.ibm.com (d01dlp02.pok.ibm.com [9.56.224.85]) by e2.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id p0QEqNVZ010915 for ; Wed, 26 Jan 2011 09:52:36 -0500 Received: from d01relay03.pok.ibm.com (d01relay03.pok.ibm.com [9.56.227.235]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id 9F8624DE8B09 for ; Wed, 26 Jan 2011 10:03:10 -0500 (EST) Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay03.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p0QF6WdK342878 for ; Wed, 26 Jan 2011 10:06:32 -0500 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p0QF6Sso011209 for ; Wed, 26 Jan 2011 13:06:31 -0200 Received: from linux.vnet.ibm.com ([9.124.31.43]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id p0QF6NCN010774; Wed, 26 Jan 2011 13:06:24 -0200 Date: Wed, 26 Jan 2011 15:10:00 -0000 From: Srikar Dronamraju To: Peter Zijlstra Cc: Ingo Molnar , Steven Rostedt , Linux-mm , Arnaldo Carvalho de Melo , Linus Torvalds , Ananth N Mavinakayanahalli , Christoph Hellwig , Masami Hiramatsu , Oleg Nesterov , LKML , SystemTap , Jim Keniston , Frederic Weisbecker , Andi Kleen , Andrew Morton , "Paul E. McKenney" Subject: Re: [RFC] [PATCH 2.6.37-rc5-tip 8/20] 8: uprobes: mmap and fork hooks. Message-ID: <20110126145955.GJ19725@linux.vnet.ibm.com> Reply-To: Srikar Dronamraju References: <20101216095714.23751.52601.sendpatchset@localhost6.localdomain6> <20101216095848.23751.73144.sendpatchset@localhost6.localdomain6> <1295957739.28776.717.camel@laptop> <20110126090346.GH19725@linux.vnet.ibm.com> <1296037239.28776.1149.camel@laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1296037239.28776.1149.camel@laptop> User-Agent: Mutt/1.5.20 (2009-06-14) X-Content-Scanned: Fidelis XPS MAILER X-IsSubscribed: yes 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: 2011-q1/txt/msg00133.txt.bz2 * Peter Zijlstra [2011-01-26 11:20:39]: > On Wed, 2011-01-26 at 14:33 +0530, Srikar Dronamraju wrote: > > > > > > I actually dont like to release the write_lock and then reacquire it. > > write_opcode, which is called thro install_uprobe, i.e to insert the > > actual breakpoint instruction takes a read lock on the mmap_sem. > > Hence uprobe_mmap gets called in context with write lock on mmap_sem > > held, I had to release it before calling install_uprobe. > > Ah, right, so that's going to give you a head-ache ;-) > > The moment you release this mmap_sem, the map you're going to install > the probe point in can go away. > > The only way to make this work seems to start by holding the mmap_sem > for writing and make a breakpoint install function that assumes its > taken and doesn't try to acquire it again. > Yes, this can be done. I would have to do something like this in register_uprobe(). list_for_each_entry_safe(mm, tmpmm, &tmp_list, uprobes_list) { down_read(&mm->map_sem); if (!install_uprobe(mm, uprobe)) ret = 0; up_read(&mm->map_sem); list_del(&mm->uprobes_list); mmput(mm); } Agree that this is much better than what we have now.