Received: by 10.223.185.116 with SMTP id b49csp3722439wrg; Tue, 6 Mar 2018 04:01:30 -0800 (PST) X-Google-Smtp-Source: AG47ELsjw887XAZthVTeKlhROzY0BNppfkcHP4cvtfWoLCJEJEBTMSb2DkmLAO3CjCynmzDcY+de X-Received: by 10.98.247.9 with SMTP id h9mr18769439pfi.212.1520337690170; Tue, 06 Mar 2018 04:01:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520337690; cv=none; d=google.com; s=arc-20160816; b=RTGpqOweS3TYg0ltH/3V5FSPCTer86DUtgeXit2zWeRZYwYqNS3QSYAxrFyGDZD22/ iCZsHTjaOiUVVOyMhLwNhIKGe6FHXlVH/qe9TGkkCGZ0DZPad3zL3rEgtlyJwHqOuJme K3nr6pJ2W8w9q7ZYGAdQHqZfkIBc1unwpq2KIZB7s8rRw7Zc+qGViHr9qtKlSgCjhj/j +c+B8QNHGZ5B/0mY/Bbdt+PMWAVaz8mtYjpKOh8IzhU5/XdFJQnS10iTJd0PzVX6THzl NrFnVvK22kx+odbWX1ZF4Y4Qd3u6O8EolAPA1QNHpY4Rq1xq2Yy0O//pFFrHqMGmc7EU m3Mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=GmkQYgTC4tBbJaVaU53T7F7iALODW0Wn00QA6qk7pVI=; b=HNG6L64ZMgcWCL6PyoyHlPsnAMOCqO/Ye8D3UddTeMC8SVISQMoEsuLv22qn38DlfE Hd3oKpVmHiphoS3lPk5DTjWay5tGxrhOZeUTR2p5lo/P3jfdz3mXtIrWqzlq6TjFg6Gb KNmhGcMkR92HoSSo8N0lh1ysIpUDCZby+aAapbKgPuXpOvchU5e1YDHzI9k2rTh+Jg2A zXgumyiiZM/XPdbRmQ+WNXHjqV27RHna6x0sLBa2J2p4GCkMTrNxqe4C5DXVq2Dm28wU nvu1eiYYNkK4XsoWYbQQJ8XYQwKT8eNLKwET4CxF+cKzb0GuJgD1VKB1cPVzxBnSbrAB BUQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=Z4FoARNl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d10si9800515pgu.703.2018.03.06.04.01.16; Tue, 06 Mar 2018 04:01:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=Z4FoARNl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753564AbeCFL7u (ORCPT + 99 others); Tue, 6 Mar 2018 06:59:50 -0500 Received: from merlin.infradead.org ([205.233.59.134]:33304 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753332AbeCFL7d (ORCPT ); Tue, 6 Mar 2018 06:59:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=GmkQYgTC4tBbJaVaU53T7F7iALODW0Wn00QA6qk7pVI=; b=Z4FoARNlrfrMAKdjUjH92/3zu ooWGaHUh/nBNd+tz5H0e2izWwF/OdzVb3QcAaHFcPqgoqZz8ZgrzFAwEgHztToXjg81BXA4vD51/o 6wNDZxc3Y0LT/r0TScyJqy1c/ULtKjMR8i0TlA0hMdaL5xgvzmF62jo0mIQO73PiIDgm3nbcs+vIm RzIBaAE9cAJ32OIvYZGZkH7i1hjH68E+++/VOar+70Sro+a50amNa7kPDQGtk688Pg3Fr3kK/b9v2 hI0b6XFPRg5RaoSByxbofNzTeYOg/7M9gAJiXhTl6vFgKs0HP9o+ZT8oyQtCl+y8r15ujcByChmKN O38GZ8eFw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.89 #1 (Red Hat Linux)) id 1etBFc-0000v3-QP; Tue, 06 Mar 2018 11:59:25 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 6DC15201EF2AB; Tue, 6 Mar 2018 12:59:21 +0100 (CET) Date: Tue, 6 Mar 2018 12:59:21 +0100 From: Peter Zijlstra To: Ravi Bangoria Cc: mingo@redhat.com, acme@kernel.org, alexander.shishkin@linux.intel.com, jolsa@redhat.com, namhyung@kernel.org, linux-kernel@vger.kernel.org, rostedt@goodmis.org, mhiramat@kernel.org, ananth@linux.vnet.ibm.com, naveen.n.rao@linux.vnet.ibm.com, srikar@linux.vnet.ibm.com, oleg@redhat.com Subject: Re: [RFC 3/4] trace_uprobe: Support SDT markers having semaphore Message-ID: <20180306115921.GD25201@hirez.programming.kicks-ass.net> References: <20180228075345.674-1-ravi.bangoria@linux.vnet.ibm.com> <20180228075345.674-4-ravi.bangoria@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180228075345.674-4-ravi.bangoria@linux.vnet.ibm.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 28, 2018 at 01:23:44PM +0530, Ravi Bangoria wrote: > Userspace Statically Defined Tracepoints[1] are dtrace style markers > inside userspace applications. These markers are added by developer at > important places in the code. Each marker source expands to a single > nop instruction in the compiled code but there may be additional > overhead for computing the marker arguments which expands to couple of > instructions. If this computaion is quite more, execution of it can be > ommited by runtime if() condition when no one is tracing on the marker: > > if (semaphore > 0) { > Execute marker instructions; > } > > Default value of semaphore is 0. Tracer has to increment the semaphore > before recording on a marker and decrement it at the end of tracing. > > Implement the semaphore flip logic in trace_uprobe, leaving core uprobe > infrastructure as is, except one new callback from uprobe_mmap() to > trace_uprobe. W.T.H. is that called a semaphore? afaict its just a usage-counter. There is no blocking, no releasing, nothing that would make it an actual semaphore. So please, remove all mention of semaphore from this code, because it, most emphatically, is not one. Also, would it not be much better to do userspace jump-labels for this? That completely avoids the dynamic branch at the SDT site.