Received: by 10.223.185.116 with SMTP id b49csp6119743wrg; Wed, 28 Feb 2018 04:26:35 -0800 (PST) X-Google-Smtp-Source: AH8x227fYI/JaRg8oUzze7GoFcvEm2TjEe1mAuwV2/EcxK4y8NiXw4HBcbbMSAvETCWRlIYGxvji X-Received: by 2002:a17:902:61:: with SMTP id 88-v6mr18250889pla.428.1519820795395; Wed, 28 Feb 2018 04:26:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519820795; cv=none; d=google.com; s=arc-20160816; b=WA5FdjZ3nH5DuBtS7gFlvMLPHOoRAWQ/SzzFRNtZ4lG99KELwjZWsNFHDHUKlmcDVI pkO6pzQdiJJHAi3mh3lNPA9NV1z5sZFTKydpiw7WvdpY7q6vq3SPjCEMl2c/wsqBItnw lkw6ZIb5KRz10bbbhLrqOwQRUJ075bL3T5ONqFdh/XiBKgO5z58KxhHX+YiHvQ3WWXql Yl1hYyYrlcJNPdKo/Zn48Tf2M3lb7dCQVBs9xGLy4fKoFbM4XciPaNuGT3EcWhUX/rZv 5dX3lEeECsF6hpQs0inMZw1i7wDSdSuvS4vUfKASi0J3lcWxY+j4rg2+v7UgLiKJdwQR CUOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:subject:cc:to :from:date:arc-authentication-results; bh=Pjso8zPmFBL2/h9rKIs6FcsZxHFIvOjy/YypPrnfkJA=; b=FFSPGKtJcR1IeWbQcKWuZSNk+QtSTv6oLaGIvpG4mMuGgiMsqkyNDsAm0+IQjC/7CX nld09JfNsv+/P3+aA3hkN6JKwn7jrV5QgmdpAwSrB4XxafkyJNLj7U94QHtT9JVzvPi6 tnrqiWlI1PuFzTS4Z8Vra/44cVNc9cbOjaHcNPaioHtvF3InScmiYbNXXdpSiQA5cLOG fv3hxjaWyaxFCbKmPP3l/SShvc1LkGJ2XkvEJ/JCyHnfVwEqOmytt3fub9R5xe1GhBq2 hU7m3l5zIEA3BzFZw3jx4l1qkRZn4R9G2YsI5D8BSB/o20uYEetmEZdkEiy9BNHplVJa /Jtw== 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 c14si1143884pfn.313.2018.02.28.04.26.20; Wed, 28 Feb 2018 04:26:35 -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 S1752420AbeB1MYq (ORCPT + 99 others); Wed, 28 Feb 2018 07:24:46 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:35682 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752229AbeB1MYp (ORCPT ); Wed, 28 Feb 2018 07:24:45 -0500 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w1SCO4j9091109 for ; Wed, 28 Feb 2018 07:24:44 -0500 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0b-001b2d01.pphosted.com with ESMTP id 2gdv7s0g7r-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 28 Feb 2018 07:24:44 -0500 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 28 Feb 2018 12:24:42 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 28 Feb 2018 12:24:37 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w1SCObIQ58851478; Wed, 28 Feb 2018 12:24:37 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A02994C04A; Wed, 28 Feb 2018 12:18:06 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8EF1D4C046; Wed, 28 Feb 2018 12:18:04 +0000 (GMT) Received: from linux.vnet.ibm.com (unknown [9.40.192.68]) by d06av22.portsmouth.uk.ibm.com (Postfix) with SMTP; Wed, 28 Feb 2018 12:18:04 +0000 (GMT) Date: Wed, 28 Feb 2018 04:24:40 -0800 From: Srikar Dronamraju To: Ravi Bangoria Cc: 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, rostedt@goodmis.org, mhiramat@kernel.org, ananth@linux.vnet.ibm.com, naveen.n.rao@linux.vnet.ibm.com, oleg@redhat.com Subject: Re: [RFC 2/4] Uprobe: Export few functions / data structures Reply-To: Srikar Dronamraju References: <20180228075345.674-1-ravi.bangoria@linux.vnet.ibm.com> <20180228075345.674-3-ravi.bangoria@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20180228075345.674-3-ravi.bangoria@linux.vnet.ibm.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-TM-AS-GCONF: 00 x-cbid: 18022812-0016-0000-0000-0000052ACB02 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18022812-0017-0000-0000-00002866FC9C Message-Id: <20180228122440.GC63063@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-02-28_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 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-1802280150 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > @@ -149,6 +155,11 @@ struct uprobes_state { > extern bool arch_uprobe_ignore(struct arch_uprobe *aup, struct pt_regs *regs); > extern void arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr, > void *src, unsigned long len); > +unsigned long offset_to_vaddr(struct vm_area_struct *vma, loff_t offset); > +void copy_from_page(struct page *page, unsigned long vaddr, void *dst, int len); > +void copy_to_page(struct page *page, unsigned long vaddr, const void *src, int len); > +struct uprobe_map_info *free_uprobe_map_info(struct uprobe_map_info *info); > + > #else /* !CONFIG_UPROBES */ If we have to export the above, we might have to work with mm maintainers and see if we can move them there. > -static inline struct uprobe_map_info * > -free_uprobe_map_info(struct uprobe_map_info *info) > +struct uprobe_map_info *free_uprobe_map_info(struct uprobe_map_info *info) > { > struct uprobe_map_info *next = info->next; > kfree(info); > return next; > } > > -static struct uprobe_map_info * > -build_uprobe_map_info(struct address_space *mapping, loff_t offset, > - bool is_register) > +struct uprobe_map_info *build_uprobe_map_info(struct address_space *mapping, > + loff_t offset, bool is_register) > { > unsigned long pgoff = offset >> PAGE_SHIFT; > struct vm_area_struct *vma; Instead of exporting, did you look at extending the uprobe consumer with ops. i.e if the consumer detects that a probe is a semaphore and exports a set of callbacks which can them be called from uprobe insertion/deletion time. With such a thing, incrementing/decrementing the semaphore and the insertion/deletion of the breakpoint can be done at one shot. No?