Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752692AbbKZBKj (ORCPT ); Wed, 25 Nov 2015 20:10:39 -0500 Received: from mail9.hitachi.co.jp ([133.145.228.44]:35754 "EHLO mail9.hitachi.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751501AbbKZBKh (ORCPT ); Wed, 25 Nov 2015 20:10:37 -0500 From: =?utf-8?B?5bmz5p2+6ZuF5bezIC8gSElSQU1BVFXvvIxNQVNBTUk=?= To: "'Wang Nan'" , "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 Thread-Topic: [PATCH] perf probe: Adjust dso->long_name for offline module Thread-Index: AQHRJ3VO1OG5xDciVU6KH7PqvREe6J6tfVfg Date: Thu, 26 Nov 2015 01:10:32 +0000 Message-ID: <50399556C9727B4D88A595C8584AAB3752631912@GSjpTKYDCembx32.service.hitachi.net> References: <1448451059-156220-1-git-send-email-wangnan0@huawei.com> In-Reply-To: <1448451059-156220-1-git-send-email-wangnan0@huawei.com> Accept-Language: ja-JP, en-US Content-Language: ja-JP X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.198.219.30] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id tAQ1AhkM000720 Content-Length: 1996 Lines: 51 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. If you'd like to use perf probe without debuginfo, make NO_DWARF=1 or strip the target binary. > # ./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. Thanks, ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?