Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758441Ab1COTls (ORCPT ); Tue, 15 Mar 2011 15:41:48 -0400 Received: from www.tglx.de ([62.245.132.106]:41491 "EHLO www.tglx.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757762Ab1COTlq (ORCPT ); Tue, 15 Mar 2011 15:41:46 -0400 Date: Tue, 15 Mar 2011 20:22:50 +0100 (CET) From: Thomas Gleixner To: Srikar Dronamraju cc: Peter Zijlstra , Ingo Molnar , Steven Rostedt , Linux-mm , Arnaldo Carvalho de Melo , Linus Torvalds , Masami Hiramatsu , Christoph Hellwig , Ananth N Mavinakayanahalli , Andi Kleen , Oleg Nesterov , Andrew Morton , Jim Keniston , Roland McGrath , SystemTap , LKML , "Paul E. McKenney" Subject: Re: [PATCH v2 2.6.38-rc8-tip 4/20] 4: uprobes: Adding and remove a uprobe in a rb tree. In-Reply-To: <20110315173041.GB24254@linux.vnet.ibm.com> Message-ID: References: <20110314133403.27435.7901.sendpatchset@localhost6.localdomain6> <20110314133444.27435.50684.sendpatchset@localhost6.localdomain6> <20110315173041.GB24254@linux.vnet.ibm.com> User-Agent: Alpine 2.00 (LFD 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1485 Lines: 40 On Tue, 15 Mar 2011, Srikar Dronamraju wrote: > * Thomas Gleixner [2011-03-15 14:38:33]: > > > +/* > > > + * Find a uprobe corresponding to a given inode:offset > > > + * Acquires treelock > > > + */ > > > +static struct uprobe *find_uprobe(struct inode * inode, loff_t offset) > > > +{ > > > + struct uprobe *uprobe; > > > + unsigned long flags; > > > + > > > + spin_lock_irqsave(&treelock, flags); > > > + uprobe = __find_uprobe(inode, offset, NULL); > > > + spin_unlock_irqrestore(&treelock, flags); > > > > What's the calling context ? Do we really need a spinlock here for > > walking the rb tree ? > > > > find_uprobe() gets called from unregister_uprobe and on probe hit from > uprobe_notify_resume. I am not sure if its a good idea to walk the tree > as and when the tree is changing either because of a insertion or > deletion of a probe. I know that you cannot walk the tree lockless except you would use some rcu based container for your probes. Though my question is more whether this needs to be a spinlock or if that could be replaced by a mutex. At least there is no reason to disable interrupts. You cannot trap into a probe from the thread in which you are installing/removing it. Thanks, tglx -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/