Received: by 10.192.165.148 with SMTP id m20csp2812295imm; Mon, 7 May 2018 01:23:02 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrZ9yneB1Z06BqntosHV2PQcTEpK+D/DwoVoqaOgRuBM1SDHOiMgFmXJM/rPaxj1Tl9RzKi X-Received: by 2002:a63:b008:: with SMTP id h8-v6mr29439079pgf.448.1525681382789; Mon, 07 May 2018 01:23:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525681382; cv=none; d=google.com; s=arc-20160816; b=Qupk58hKpB5Wsyh0PR7bQ8LtbtnkY0qCkwRdyJaJI8aeW5lF1jCpySMWYCTyqGs/iH FJUBiZtjYDFSgPUVQmzMIJAKnvmo5PH5oi3Sa/Z/p+9T6+I5yhKrrzWu3Tx/6bg60QZB Si8Ra4gk6BhQZC5uDHvOJUAsDp2I9kpftcoofkpNXxfC1ZliYdQ868hP2cW6euC8Xt3A yYHO7SUZf8pFGzaQuw/Foho2u34AIOZULXQCA1SkiPTptcMkzoee0fcypPRAghaFS0Gf DZcfIKzG9pxMP0LfQdX6jQSNeC6usDC5GtOv9qw3eSet0Qa8/QVf/06Ytl+lgjZeXfQ2 yB2A== 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 :references:cc:to:from:subject:arc-authentication-results; bh=r10y0JzsFcqd4j8xZ528aDcnKKZmtacM1pQNcLAdV34=; b=pPnf4/X7YxlGqVkCUSMmie2HR8m53ZPNWcvOoqWVcL1KHqqUOYU9sMfbkO3aASJ6Bt SLcM9FdEaVbSHLu3lA5ACt0ErCrnC/4ZfFqKdin4Iq2V424of4urVaincEUbRlZk+ORh 00k2xBBMZZwWQx90wA3gkmDlvlFxT8grbqkxoh2gk+MBHoGmZc+Me5hh/Kk9o/GdRRaD xI9PSfwxfztWXeh10/z/OytUpy3tEOtEeW16s9FKu90N1RbVg2rylO+2/y4WFSrEev+p GZChy4OsGZXstI/4Y+37KB24GKbQk9CphHrjymvpgwEIenBa0dWXHRFWZWoHlBlU2ntG WsdA== 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 m1-v6si17886981pgm.413.2018.05.07.01.22.48; Mon, 07 May 2018 01:23:02 -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 S1752112AbeEGIWH (ORCPT + 99 others); Mon, 7 May 2018 04:22:07 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:49992 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751988AbeEGIVf (ORCPT ); Mon, 7 May 2018 04:21:35 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w478JIub088783 for ; Mon, 7 May 2018 04:21:35 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0a-001b2d01.pphosted.com with ESMTP id 2htj5hau87-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 07 May 2018 04:21:35 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 7 May 2018 09:21:33 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 7 May 2018 09:21:26 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w478LQbS65994880; Mon, 7 May 2018 08:21:26 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 55347AE051; Mon, 7 May 2018 09:10:56 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C8EF0AE057; Mon, 7 May 2018 09:10:51 +0100 (BST) Received: from [9.124.31.85] (unknown [9.124.31.85]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 7 May 2018 09:10:51 +0100 (BST) Subject: Re: [PATCH v3 6/9] trace_uprobe: Support SDT markers having reference count (semaphore) From: Ravi Bangoria To: Masami Hiramatsu , oleg@redhat.com Cc: Ravi Bangoria , peterz@infradead.org, srikar@linux.vnet.ibm.com, rostedt@goodmis.org, 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, jolsa@redhat.com, kan.liang@intel.com, kjlx@templeofstupid.com, kstewart@linuxfoundation.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, milian.wolff@kdab.com, mingo@redhat.com, namhyung@kernel.org, naveen.n.rao@linux.vnet.ibm.com, pc@us.ibm.com, tglx@linutronix.de, yao.jin@linux.intel.com, fengguang.wu@intel.com, jglisse@redhat.com References: <20180417043244.7501-1-ravi.bangoria@linux.vnet.ibm.com> <20180417043244.7501-7-ravi.bangoria@linux.vnet.ibm.com> <20180504134816.8633a157dd036489d9b0f1db@kernel.org> <206e4a16-ae21-7da3-f752-853dc2f51947@linux.ibm.com> Date: Mon, 7 May 2018 13:51:21 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <206e4a16-ae21-7da3-f752-853dc2f51947@linux.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-TM-AS-GCONF: 00 x-cbid: 18050708-0044-0000-0000-0000054FD511 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050708-0045-0000-0000-000028910D76 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-05-07_02:,, 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=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805070086 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Masami, On 05/04/2018 07:51 PM, Ravi Bangoria wrote: > >>> +} >>> + >>> +static void sdt_increment_ref_ctr(struct trace_uprobe *tu) >>> +{ >>> + struct uprobe_map_info *info; >>> + >>> + uprobe_down_write_dup_mmap(); >>> + info = uprobe_build_map_info(tu->inode->i_mapping, >>> + tu->ref_ctr_offset, false); >>> + if (IS_ERR(info)) >>> + goto out; >>> + >>> + while (info) { >>> + down_write(&info->mm->mmap_sem); >>> + >>> + if (sdt_find_vma(tu, info->mm, info->vaddr)) >>> + sdt_update_ref_ctr(info->mm, info->vaddr, 1); >> Don't you have to handle the error to map pages here? > Correct.. I think, I've to feedback error code to probe_event_{enable|disable} > and handler failure there. I looked at this. Actually, It looks difficult to feedback errors to probe_event_{enable|disable}, esp. in the mmap() case. Is it fine if we just warn sdt_update_ref_ctr() failures in dmesg? I'm doing this in [PATCH 7]. (Though, it makes more sense to do that in [PATCH 6], will change it in next version). Any better ideas? BTW, same issue exists for normal uprobe. If uprobe_mmap() fails, there is no feedback to trace_uprobe and no warnigns in dmesg as well !! There was a patch by Naveen to warn such failures in dmesg but that didn't go in: https://lkml.org/lkml/2017/9/22/155 Also, I'll add a check in sdt_update_ref_ctr() to make sure reference counter never goes to negative incase increment fails but decrement succeeds. OTOH, if increment succeeds but decrement fails, the counter remains >0 but there is no harm as such, except we will execute some unnecessary code. Thanks, Ravi