From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EA87C4321D for ; Wed, 22 Aug 2018 12:39:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 199D0214FF for ; Wed, 22 Aug 2018 12:39:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 199D0214FF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.vnet.ibm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728673AbeHVQEm (ORCPT ); Wed, 22 Aug 2018 12:04:42 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:43818 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727777AbeHVQEm (ORCPT ); Wed, 22 Aug 2018 12:04:42 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w7MCYFaZ009611 for ; Wed, 22 Aug 2018 08:39:56 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2m168bca3w-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 22 Aug 2018 08:39:56 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 22 Aug 2018 13:39:53 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 22 Aug 2018 13:39:47 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w7MCdlDb45875328 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 22 Aug 2018 12:39:47 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C40B611C052; Wed, 22 Aug 2018 15:39:46 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F202911C04A; Wed, 22 Aug 2018 15:39:43 +0100 (BST) Received: from linux.vnet.ibm.com (unknown [9.40.192.68]) by d06av25.portsmouth.uk.ibm.com (Postfix) with SMTP; Wed, 22 Aug 2018 15:39:43 +0100 (BST) Date: Wed, 22 Aug 2018 05:39:43 -0700 From: Srikar Dronamraju To: Ravi Bangoria Cc: oleg@redhat.com, rostedt@goodmis.org, mhiramat@kernel.org, liu.song.a23@gmail.com, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, alexander.shishkin@linux.intel.com, jolsa@redhat.com, namhyung@kernel.org, linux-kernel@vger.kernel.org, ananth@linux.vnet.ibm.com, alexis.berlemont@gmail.com, naveen.n.rao@linux.vnet.ibm.com, linux-arm-kernel@lists.infradead.org, linux-mips@linux-mips.org, linux@armlinux.org.uk, ralf@linux-mips.org, paul.burton@mips.com Subject: Re: [PATCH v9 1/4] Uprobes: Support SDT markers having reference count (semaphore) Reply-To: Srikar Dronamraju References: <20180820044250.11659-1-ravi.bangoria@linux.ibm.com> <20180820044250.11659-2-ravi.bangoria@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20180820044250.11659-2-ravi.bangoria@linux.ibm.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-TM-AS-GCONF: 00 x-cbid: 18082212-0012-0000-0000-0000029D2669 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18082212-0013-0000-0000-000020D069D6 Message-Id: <20180822123943.GD2080@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-08-22_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1808220129 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Ravi Bangoria [2018-08-20 10:12:47]: > Userspace Statically Defined Tracepoints[1] are dtrace style markers > inside userspace applications. Applications like PostgreSQL, MySQL, > Pthread, Perl, Python, Java, Ruby, Node.js, libvirt, QEMU, glib etc > have these markers embedded in them. 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. In case the overhead is more, execution of it can be > omitted by runtime if() condition when no one is tracing on the marker: > > if (reference_counter > 0) { > Execute marker instructions; > } > > Default value of reference counter is 0. Tracer has to increment the > reference counter before tracing on a marker and decrement it when > done with the tracing. > > Implement the reference counter logic in core uprobe. User will be > able to use it from trace_uprobe as well as from kernel module. New > trace_uprobe definition with reference counter will now be: > > :[(ref_ctr_offset)] > > where ref_ctr_offset is an optional field. For kernel module, new > variant of uprobe_register() has been introduced: > > uprobe_register_refctr(inode, offset, ref_ctr_offset, consumer) > > No new variant for uprobe_unregister() because it's assumed to have > only one reference counter for one uprobe. > > [1] https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation > > Note: 'reference counter' is called as 'semaphore' in original Dtrace > (or Systemtap, bcc and even in ELF) documentation and code. But the > term 'semaphore' is misleading in this context. This is just a counter > used to hold number of tracers tracing on a marker. This is not really > used for any synchronization. So we are calling it a 'reference counter' > in kernel / perf code. > Acked-by: Srikar Dronamraju > Signed-off-by: Ravi Bangoria > Reviewed-by: Masami Hiramatsu > [Only trace_uprobe.c] > Reviewed-by: Oleg Nesterov > ---