Received: by 10.213.65.68 with SMTP id h4csp1051902imn; Wed, 14 Mar 2018 08:12:00 -0700 (PDT) X-Google-Smtp-Source: AG47ELtzDJaziCBMyNjoZueQ2IRwn/OZtuRXJEX2ddejkbH6EVXjdJkw1W9lYBsNzysTdK9ckAKM X-Received: by 10.101.77.13 with SMTP id i13mr53536pgt.70.1521040320513; Wed, 14 Mar 2018 08:12:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521040320; cv=none; d=google.com; s=arc-20160816; b=O1A2a2pyuPmUFEuDfGM921nHVqq6qXqzoWi6eYcwLIyT3e7dTbsICRZ0cT98gZ3jdG 9Cc3/P+5bKiYwQ/sqsI/8Fw/6HtrKBEjl7iDGNJDIee4aGa1T7OK8trQHCa4mIsoixqy UKT4RiT6xPTgi9wbcpsGR/vQpU4FcH1k6z29obiuJAa7iHITh+IBy4+7QMLZW//t9id/ Ko8lXh/5Q8/nJ/lIFGgfFefEInpZJqv9kXCm7vTusoZ39UNc3hbxL82vOLBbFNwoWTZW 9ZMa4JZZXn5y06dbr2R6fKDhSgNb43tNOPMabfg2Q5Xwt9iqUgLX0rORFte32bb8rAkC 6Brw== 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=bGF2rDxQ06JOZ4hcrEC6ZxOcGT8sJvL4xJ8Lqa8TR2c=; b=p55RIXNgTsCwW1J+4gECiBtw3SZIK0oif+VTrI4dCWsyjt0GcY7Dff+l4EDvR/wI+Z 0flL8xyioZAGZDAhHPS4wzDIL3Ofe0z9qeDEwvuiQ1V7EsN0QCCLlrEjNng8V5BZl2A5 ZcKIs6BHmjiJ0uyM8j1qtu/N7aNZ6dOn+zXY92sqlN5+IJXlvgeaOslkrg+iDkxzNlpp xxHIevCNqhYB9BsdKfzFmaj2tG2CEMC9m2t91V3ajvO8D7MHVpwtOZVgpb/AfNW8f5tJ JZNRDea1jYtX4oqgZ3PBdAU1T9tlEnXonIICTl9k+e/etVfg1q4T82cv2bI2Z315OCsL MD4Q== 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 s11-v6si2112974plj.701.2018.03.14.08.11.45; Wed, 14 Mar 2018 08:12:00 -0700 (PDT) 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 S1752217AbeCNPK3 (ORCPT + 99 others); Wed, 14 Mar 2018 11:10:29 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:52112 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751959AbeCNPKZ (ORCPT ); Wed, 14 Mar 2018 11:10:25 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w2EF9Q07107105 for ; Wed, 14 Mar 2018 11:10:25 -0400 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0b-001b2d01.pphosted.com with ESMTP id 2gq5awjqms-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Wed, 14 Mar 2018 11:10:24 -0400 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 14 Mar 2018 15:10:21 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 14 Mar 2018 15:10:12 -0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w2EFAC0954395102; Wed, 14 Mar 2018 15:10:12 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B11725204B; Wed, 14 Mar 2018 14:01:42 +0000 (GMT) Received: from [9.77.194.179] (unknown [9.77.194.179]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 78B055203F; Wed, 14 Mar 2018 14:01:30 +0000 (GMT) Subject: Re: [PATCH 5/8] trace_uprobe: Support SDT markers having reference count (semaphore) To: Masami Hiramatsu Cc: oleg@redhat.com, peterz@infradead.org, srikar@linux.vnet.ibm.com, acme@kernel.org, ananth@linux.vnet.ibm.com, akpm@linux-foundation.org, alexander.shishkin@linux.intel.com, alexis.berlemont@gmail.com, corbet@lwn.net, dan.j.williams@intel.com, gregkh@linuxfoundation.org, huawei.libin@huawei.com, hughd@google.com, jack@suse.cz, jglisse@redhat.com, jolsa@redhat.com, kan.liang@intel.com, kirill.shutemov@linux.intel.com, kjlx@templeofstupid.com, kstewart@linuxfoundation.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, mhocko@suse.com, milian.wolff@kdab.com, mingo@redhat.com, namhyung@kernel.org, naveen.n.rao@linux.vnet.ibm.com, pc@us.ibm.com, pombredanne@nexb.com, rostedt@goodmis.org, tglx@linutronix.de, tmricht@linux.vnet.ibm.com, willy@infradead.org, yao.jin@linux.intel.com, fengguang.wu@intel.com, Ravi Bangoria References: <20180313125603.19819-1-ravi.bangoria@linux.vnet.ibm.com> <20180313125603.19819-6-ravi.bangoria@linux.vnet.ibm.com> <20180314224809.5ee4c8834bb366faa398e342@kernel.org> From: Ravi Bangoria Date: Wed, 14 Mar 2018 20:42:24 +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: <20180314224809.5ee4c8834bb366faa398e342@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-TM-AS-GCONF: 00 x-cbid: 18031415-0008-0000-0000-000004DD6B61 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18031415-0009-0000-0000-00001E70707E Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-03-14_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 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803140171 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Masami, On 03/14/2018 07:18 PM, Masami Hiramatsu wrote: > Hi Ravi, > > On Tue, 13 Mar 2018 18:26:00 +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. In case the overhead is more, execution of it can be >> ommited 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 trace_uprobe, leaving core >> uprobe infrastructure as is, except one new callback from uprobe_mmap() >> to trace_uprobe. >> >> trace_uprobe definition with reference counter will now be: >> >> :[(ref_ctr_offset)] > Would you mean > :() > ? > > or use "[]" for delimiter? [] indicates optional field. > Since, > >> @@ -454,6 +458,26 @@ static int create_trace_uprobe(int argc, char **argv) >> goto fail_address_parse; >> } >> >> + /* Parse reference counter offset if specified. */ >> + rctr = strchr(arg, '('); > This seems you choose "()" for delimiter. Correct. >> + if (rctr) { >> + rctr_end = strchr(arg, ')'); > rctr_end = strchr(rctr, ')'); > > ? since we are sure rctr != NULL. Yes. we can use rctr instead of arg. >> + if (rctr > rctr_end || *(rctr_end + 1) != 0) { >> + ret = -EINVAL; >> + pr_info("Invalid reference counter offset.\n"); >> + goto fail_address_parse; >> + } > > Also > >> + >> + *rctr++ = 0; >> + *rctr_end = 0; > Please consider to use '\0' for nul; Sure. Will change it. Thanks for the review :) Ravi