Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753040AbbDUJ3V (ORCPT ); Tue, 21 Apr 2015 05:29:21 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:7618 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750922AbbDUJ3Q (ORCPT ); Tue, 21 Apr 2015 05:29:16 -0400 Message-ID: <55361853.60506@huawei.com> Date: Tue, 21 Apr 2015 17:28:51 +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: Namhyung Kim CC: , , , , , , Subject: Re: [PATCH v6] perf: __kmod_path__parse: deal with kernel module names in '[]' correctly. References: <1429587190-208370-1-git-send-email-wangnan0@huawei.com> <20150421051649.GA1905@sejong> In-Reply-To: <20150421051649.GA1905@sejong> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.111.69.129] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2977 Lines: 74 On 2015/4/21 13:16, Namhyung Kim wrote: > Hi Wang, > > On Tue, Apr 21, 2015 at 03:33:10AM +0000, Wang Nan wrote: >> Before patch ba92732e9808df679ddf75c5ea1c0caae6d7dce2 ('perf kmaps: >> Check kmaps to make code more robust'), perf report and perf annotate >> will segfault if trace data contains kernel module information like >> this: >> >> # perf report -D -i ./perf.data >> ... >> 0 0 0x188 [0x50]: PERF_RECORD_MMAP -1/0: [0xffffffbff1018000(0xf068000) @ 0]: x [test_module] >> ... >> >> # perf report -i ./perf.data --objdump=/path/to/objdump --kallsyms=/path/to/kallsyms >> >> perf: Segmentation fault >> -------- backtrace -------- >> /path/to/perf[0x503478] >> /lib64/libc.so.6(+0x3545f)[0x7fb201f3745f] >> /path/to/perf[0x499b56] >> /path/to/perf(dso__load_kallsyms+0x13c)[0x49b56c] >> /path/to/perf(dso__load+0x72e)[0x49c21e] >> /path/to/perf(map__load+0x6e)[0x4ae9ee] >> /path/to/perf(thread__find_addr_map+0x24c)[0x47deec] >> /path/to/perf(perf_event__preprocess_sample+0x88)[0x47e238] >> /path/to/perf[0x43ad02] >> /path/to/perf[0x4b55bc] >> /path/to/perf(ordered_events__flush+0xca)[0x4b57ea] >> /path/to/perf[0x4b1a01] >> /path/to/perf(perf_session__process_events+0x3be)[0x4b428e] >> /path/to/perf(cmd_report+0xf11)[0x43bfc1] >> /path/to/perf[0x474702] >> /path/to/perf(main+0x5f5)[0x42de95] >> /lib64/libc.so.6(__libc_start_main+0xf4)[0x7fb201f23bd4] >> /path/to/perf[0x42dfc4] >> >> This is because __kmod_path__parse treats '[' leading names as kernel >> name instead of names of kernel module. If perf.data contains build >> information and the buildid of such modules can be found, the DSO of >> it will be treated as kernel, not kernel module. > > Sorry if I missed some prior discussion on it, but any chance to treat > them as modules instead of kernel binaries? > > Thanks, > Namhyung > > Sorry, I tried but failed to understand your question. What this patch do is to treat them as modules instead of kernel binaries (or binary? since kernel is a whole binary and kernel modules are DSOs). [SNIP] >> + /* path alloc_name alloc_ext kmod comp name ext */ >> + T("[test_module]", true , true , true, false, "[test_module]", NULL); >> + T("[test_module]", false , true , true, false, NULL , NULL); >> + T("[test_module]", true , false , true, false, "[test_module]", NULL); >> + T("[test_module]", false , false , true, false, NULL , NULL); >> + M("[test_module]", PERF_RECORD_MISC_CPUMODE_UNKNOWN, true); >> + M("[test_module]", PERF_RECORD_MISC_KERNEL, true); >> + M("[test_module]", PERF_RECORD_MISC_USER, false); Before this patch, these testcases will return kmod == false result. Thanks. -- 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/