From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752356AbbDBBQF (ORCPT ); Wed, 1 Apr 2015 21:16:05 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:61456 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750726AbbDBBQC (ORCPT ); Wed, 1 Apr 2015 21:16:02 -0400 Message-ID: <551C983A.3030300@huawei.com> Date: Thu, 2 Apr 2015 09:15:38 +0800 From: Wang Nan User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.0.1 MIME-Version: 1.0 To: Jiri Olsa CC: , , , , , , Subject: Re: [PATCH 3/4] perf tools: report: introduce --map-adjustment argument. References: <1427884395-241111-1-git-send-email-wangnan0@huawei.com> <1427884395-241111-4-git-send-email-wangnan0@huawei.com> <20150401132140.GC10820@krava.brq.redhat.com> In-Reply-To: <20150401132140.GC10820@krava.brq.redhat.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.111.69.129] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020204.551C9850.0126,ss=1,re=0.001,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: d6e2371c54010a6400037c5aa937bd09 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2015/4/1 21:21, Jiri Olsa wrote: > On Wed, Apr 01, 2015 at 10:33:14AM +0000, Wang Nan wrote: >> This patch introduces a --map-adjustment argument for perf report. The >> goal of this option is to deal with private dynamic loader used in some >> special program. >> > > SNIP > >> diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c >> index 051883a..dc9e91e 100644 >> --- a/tools/perf/util/machine.c >> +++ b/tools/perf/util/machine.c >> @@ -1155,21 +1155,291 @@ out_problem: >> return -1; >> } >> >> +/* >> + * Users are allowed to provide map adjustment setting for the case >> + * that an address range is actually privatly mapped but known to be >> + * ELF object file backended. Like this: >> + * >> + * |<- copied from libx.so ->| |<- copied from liby.so ->| >> + * |<-------------------- MMAP area --------------------->| >> + * >> + * When dealing with such mmap events, try to obey user adjustment. >> + * Such adjustment settings are not allowed overlapping. >> + * Adjustments won't be considered as valid code until real MMAP events >> + * take place. Therefore, users are allowed to provide adjustments which >> + * cover never mapped areas, like: >> + * >> + * |<- libx.so ->| |<- liby.so ->| >> + * |<-- MMAP area -->| >> + * >> + * This feature is useful when dealing with private dynamic linkers, >> + * which assemble code piece from different ELF objects. >> + * >> + * map_adj_list is an ordered linked list. Order of two adjustments is >> + * first defined by their pid, and then by their start address. >> + * Therefore, adjustments for specific pids are groupped together >> + * naturally. >> + */ >> +static LIST_HEAD(map_adj_list); > > we dont like global stuff ;-) > > I think this belongs to the machine object, which is created > within the perf_session__new, so after options parsing.. hum > Do you think such struct map_adj objects should better reside in thread objects? SNIP > > just curious.. how many --map-adjust entries do you normaly use? > maybe if it's bigger number then a) using rb_tree might be faster > and b) using some sort of config file could be better way for > input might be easier > The address and pid are dynamically allocated so I don't think static config file is a good way for input. I'll consider rb_tree in my next post. Thank you.