Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752695AbbKZB35 (ORCPT ); Wed, 25 Nov 2015 20:29:57 -0500 Received: from szxga02-in.huawei.com ([119.145.14.65]:59225 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751349AbbKZB3z (ORCPT ); Wed, 25 Nov 2015 20:29:55 -0500 Message-ID: <5656607C.40907@huawei.com> Date: Thu, 26 Nov 2015 09:29:32 +0800 From: "Wangnan (F)" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: =?UTF-8?B?5bmz5p2+6ZuF5bezIC8gSElSQU1BVFXvvIxNQVNBTUk=?= , "acme@kernel.org" CC: "linux-perf-users@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Arnaldo Carvalho de Melo" , Namhyung Kim , Zefan Li , "pi3orama@163.com" Subject: Re: [PATCH] perf probe: Adjust dso->long_name for offline module References: <1448451059-156220-1-git-send-email-wangnan0@huawei.com> <50399556C9727B4D88A595C8584AAB3752631912@GSjpTKYDCembx32.service.hitachi.net> In-Reply-To: <50399556C9727B4D88A595C8584AAB3752631912@GSjpTKYDCembx32.service.hitachi.net> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.111.66.109] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020204.5656608A.0068,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 9eaa1640a3b0b2df49bd5be7c3bc2b45 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2419 Lines: 63 On 2015/11/26 9:10, 平松雅巳 / HIRAMATU,MASAMI wrote: > From: Wang Nan [mailto:wangnan0@huawei.com] >> If libelf unable to open debuginfo for an offline module but the ko has >> symtab, something unexpected may happen. >> >> # rm -rf ~/.debug/ >> # mv /usr/lib64/elfutils/libebl_x86_64.so{,.bak} > Please do give more possible usecase. removing libebl is crazy, > and broken environment. It is a real problem we met, where perf itself is statically linked and copied to target platform. > If you'd like to use perf probe without debuginfo, make NO_DWARF=1 or > strip the target binary. Can't simply stripping the target binary because the symtab would also be stipped out. >> # ./perf probe -m /home/wangnan/kmodule/mymodule.ko my_func >> [mymodule] with build id 326ab42550ef3d24944f53c817533728367effeb not found, continuing without symbols >> Failed to find symbol my_func in /home/wangnan/kmodule/mymodule.ko >> Error: Failed to add events >> # ./perf buildid-cache -a ./mymodule.ko >> # ./perf probe -m /home/wangnan/kmodule/mymodule.ko my_func >> Added new event: >> probe:my_func (on my_func in /home/wangnan/kmodule/mymodule.ko) >> >> You can now use it in all perf tools, such as: >> >> perf record -e probe:my_func -aR sleep 1 >> >> In the above example, probe fails if it isn't in buildid-cache. However, >> user would expect it success in both case because perf is able to find >> probe points actually. >> >> The problem is because perf won't utilize module's full path if it >> failed to open debuginfo. In >> convert_to_probe_trace_events -> >> find_probe_trace_events_from_map -> >> get_target_map -> >> kernel_get_module_map -> >> machine__findnew_module_map -> >> map_groups__find_by_name >> >> map_groups__find_by_name() is able to find the map of that module, but >> this information is found from /proc/modules before it knows the real >> path of the offline module. Therefore, the map->dso->long_name is >> set to something like '[mymodule]', which prevents dso__load() find >> the real path of the module file. > Hmm, if so, it should be fixed in map or machine, not in probe-event.c. Will do in next version. Thank you. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/