Received: by 10.223.185.116 with SMTP id b49csp4792931wrg; Wed, 7 Mar 2018 00:45:27 -0800 (PST) X-Google-Smtp-Source: AG47ELsGiNtMM/HZAjjRoj1Io0yRzZTWwzErFCyhMzPPJNPzKkOupdyOO3Q4/HapyYMApQpiZdgK X-Received: by 10.101.64.197 with SMTP id u5mr17722885pgp.23.1520412327487; Wed, 07 Mar 2018 00:45:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520412327; cv=none; d=google.com; s=arc-20160816; b=dOx6S+37j58TvFo1jnTndlhfdcI7q+V43ych7evTnPoU3ZvjDsJLOfFDj9FwNOgR6+ Novi8rxoi7GuPsZ2waJF/n5o//Mm+kEGz4Z6vE9VMXzE2oJ2hfpurI74kko0iuE8+hsL n4rxMJfjQiPfViXpceHvrbYAxZvmTjdc4oxkE+n/ZCmaEOv/HcQptp/DDfBsJmKzWVcU ocxZJHPHMXnxCH5aq12MkRawfK05Y0l3IBbMokbGu4GCfucevetaTtExK0T1S2jkr2yb vn3EiEqJaXPHuoerL1ZaH1EqNpZhLdZxAz+qf1zJOQwPgI+0CfjngPC43QOXw0xpx7WE 10QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :from:references:cc:to:subject:arc-authentication-results; bh=S/5hOJDtcTa47ewAp/XRdr0ElO4WaX6/XPYazvBwHaA=; b=pkgVL6xM7mJ7vabSIGAM4XkovU4LXlCtoMqKdyQ/VLP9YT6J93xiNeBNWsqDHwTGBf 2RlN936A+nYiwxxyY5kMfJ3pLv3ZyNX1YjMplM1I1+1BlO7GmL14YXA/d5l9ASHjM09m 7U8WjKstrRwtJwCd/yDyipAbOGoxTj00DMmNJ7NXEEsN8FBhATm+bHiWpUL2xnD2wEEG 31iGh5j3KmZENJpYSq6gRH5UdN0wSS2kkNcFUoPXdb49J3KrJBBG8YsihjMDfCwzlrSU LP01hfpBDSX+mfFgzoPEVhUI8f5nrMYgvp1Ln7k15kDq9R0C0n0nkvRrW8CTwq0J5ZOT BOeQ== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q2-v6si12535445plh.499.2018.03.07.00.45.13; Wed, 07 Mar 2018 00:45:27 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932905AbeCGIoE (ORCPT + 99 others); Wed, 7 Mar 2018 03:44:04 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:34338 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751125AbeCGIoD (ORCPT ); Wed, 7 Mar 2018 03:44:03 -0500 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w278hoJ9005367 for ; Wed, 7 Mar 2018 03:44:03 -0500 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gjac2wmtb-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Wed, 07 Mar 2018 03:44:02 -0500 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 7 Mar 2018 08:44:00 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 7 Mar 2018 08:43:57 -0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w278hvgK63963168; Wed, 7 Mar 2018 08:43:57 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0775852047; Wed, 7 Mar 2018 07:35:35 +0000 (GMT) Received: from [9.124.31.112] (unknown [9.124.31.112]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 70F325203F; Wed, 7 Mar 2018 07:35:32 +0000 (GMT) Subject: Re: [RFC 3/4] trace_uprobe: Support SDT markers having semaphore To: Peter Zijlstra 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, Ravi Bangoria References: <20180228075345.674-1-ravi.bangoria@linux.vnet.ibm.com> <20180228075345.674-4-ravi.bangoria@linux.vnet.ibm.com> <20180306115921.GD25201@hirez.programming.kicks-ass.net> From: Ravi Bangoria Date: Wed, 7 Mar 2018 14:16:13 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180306115921.GD25201@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-TM-AS-GCONF: 00 x-cbid: 18030708-0020-0000-0000-000003FFB6EE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18030708-0021-0000-0000-00004293F74F Message-Id: <3a0f9efd-158e-08ba-ae01-38391f580133@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-03-07_03:,, 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 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803070102 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/06/2018 05:29 PM, Peter Zijlstra wrote: > 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. I totally agree with you. But it's not me who named it semaphore :) Please refer to "Semaphore Handling" section at: https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation We can surly name it differently in the kernel code and document it properly in the Documents/tracing/ > 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. > Userspace jump-label is a good idea but... Semaphore logic has already became a kinda ABI now. Tools like bcc, gdb, systemtap etc. flip the semaphore while probing the marker. Thanks, Ravi