From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757240AbcHBSbJ (ORCPT ); Tue, 2 Aug 2016 14:31:09 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:56530 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757081AbcHBS1R (ORCPT ); Tue, 2 Aug 2016 14:27:17 -0400 X-IBM-Helo: d23dlp01.au.ibm.com X-IBM-MailFrom: hbathini@linux.vnet.ibm.com X-IBM-RcptTo: linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH v2 2/3] tracefs: add instances support for uprobe events To: Steven Rostedt References: <146965470618.23765.7329786743211962695.stgit@hbathini.in.ibm.com> <146965485827.23765.14920656474693831799.stgit@hbathini.in.ibm.com> <20160801174546.0453ab85@gandalf.local.home> <17cdf475-e663-2ade-d69f-91440d654e98@linux.vnet.ibm.com> Cc: daniel@iogearbox.net, peterz@infradead.org, linux-kernel@vger.kernel.org, acme@kernel.org, alexander.shishkin@linux.intel.com, mingo@redhat.com, paulus@samba.org, ebiederm@xmission.com, kernel@kyup.com, viro@zeniv.linux.org.uk, aravinda@linux.vnet.ibm.com, ananth@in.ibm.com From: Hari Bathini Date: Tue, 2 Aug 2016 23:02:27 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <17cdf475-e663-2ade-d69f-91440d654e98@linux.vnet.ibm.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16080217-0040-0000-0000-000001C83230 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16080217-0041-0000-0000-00000A3179CA Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-08-02_12:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1608020177 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday 02 August 2016 10:57 PM, Hari Bathini wrote: > Hi Steve, > > > Thanks for the review > > > On Tuesday 02 August 2016 03:15 AM, Steven Rostedt wrote: >> On Thu, 28 Jul 2016 02:57:38 +0530 >> Hari Bathini wrote: >> >>> If a uprobe event is set on a library function, and if a similar uprobe >>> event trace is needed for a container, a duplicate is created leaving >>> the uprobe list with multiple entries of the same function: >>> >>> $ perf probe --list >>> probe_libc:malloc (on 0x80490 in /lib64/libc.so.6) >>> probe_libc:malloc_1 (on __libc_malloc in /lib64/libc.so.6) >>> $ >>> >>> This can soon get out of hand if multiple containers want to probe the >>> same function/address in their libraries. This patch tries to >>> resolve this >>> by adding uprobe event trace files to every new instance. Currently, >>> perf >>> tool can leverage this by using --debugfs-dir option - something like >>> (assuming instance dir name is 'tracing'): >>> >>> $ perf --debugfs-dir=$MOUNT_PNT/instances probe /lib64/libc.so.6 >>> malloc >>> $ >>> $ >>> $ perf --debugfs-dir=$MOUNT_PNT/instances probe --list >>> probe_libc:malloc (on __libc_malloc in /lib64/libc.so.6) >>> $ >>> >>> New uprobe events can be added to the uprobe_events file under the >>> instance >>> directory and the profile information for these events will be >>> available in >>> uprobe_profile file in the same instance directory. >> Hmm, this does change the behavior of normal instances. >> >> # cd /sys/kernel/debug/tracing >> # echo 'p /bin/bash:0x41adf0' > uprobe_events >> # ls events/uprobes >> enable filter p_bash_0x41adf0 >> >> # mkdir instances/foo >> # ls instances/foo/events/uprobes >> ls: cannot access instances/foo/events/uprobes: No such file or >> directory >> >> Usually, instances will have the same events as the top level >> directory. This will make uprobes, and only uprobes different. I'm not >> sure if this is a bad thing or not, I'll have to think about it more. > > Hmmm. I think making uprobes an exception is worth considering. > >> But what would it take to have this only differ for containers, and not >> normal instances? > > With the current approach, instances created in instances directory and > the ones created with newinstance mount option (patch 3 of 3) are > similar. > Each instance corresponds to a trace_array structure. > An alternate approach I could think of is something like below: > > struct trace_instance { > struct trace_array tr; > struct mutex uprobe_lock; > struct list_head uprobe_list; > /* any other new data specific to a mount instance */ > }; > > where a mountable instance is more than a trace array. > This may need addition of new flags for trace array saying > whether it is a global trace or directory instance or mountable instance. > Also, the helper functions that add/remove events need to be tweaked > accordingly. > .. and the mountable instance can be used for containers without change in behavior for directory instances.. Thanks Hari > > Thanks > Hari