[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <51F82D64.5060609@intel.com>
Date: Wed, 31 Jul 2013 00:17:24 +0300
From: Adrian Hunter <adrian.hunter@...el.com>
To: Namhyung Kim <namhyung@...nel.org>
CC: Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
linux-kernel@...r.kernel.org, David Ahern <dsahern@...il.com>,
Frederic Weisbecker <fweisbec@...il.com>,
Jiri Olsa <jolsa@...hat.com>, Mike Galbraith <efault@....de>,
Paul Mackerras <paulus@...ba.org>,
Peter Zijlstra <peterz@...radead.org>,
Stephane Eranian <eranian@...gle.com>,
Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCH 8/9] perf tools: add kcore to the object code reading
test
On 30/07/2013 8:24 a.m., Namhyung Kim wrote:
> On Thu, 25 Jul 2013 17:01:29 +0300, Adrian Hunter wrote:
>> Make the "object code reading" test attempt to read from
>> kcore.
>>
>> The test uses objdump which struggles with kcore. i.e.
>> doesn't always work, sometimes takes a long time.
>> The test has been made to work around those issues.
>>
> [SNIP]
>
>> - if (al.map->dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS) {
>> + if (al.map->dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS&&
>> + !dso__is_kcore(al.map->dso)) {
>
> I was confused. So this means that the symbols came from the kallsyms
> but actual binary data came from the kcore, right?
Yes
>
>
>> pr_debug("Unexpected kernel address - skipping\n");
>> return 0;
>> }
>
> [SNIP]
>> +
>> + /* 2nd time through we just try kcore */
>> + if (try_kcore&& !have_kcore)
>> + return TEST_CODE_READING_NO_KCORE;
>> +
>> + /* No point getting kernel events if there is no kernel object */
>> + if (!have_vmlinux&& !have_kcore)
>> excl_kernel = true;
>>
>> threads = thread_map__new_by_tid(pid);
>> @@ -457,8 +502,12 @@ static int do_test_code_reading(void)
>> if (ret< 0)
>> goto out_err;
>>
>> - if (!have_vmlinux)
>> + if (!have_vmlinux&& !have_kcore&& !try_kcore)
>> + err = TEST_CODE_READING_NO_KERNEL_OBJ;
>> + else if (!have_vmlinux&& !try_kcore)
>> err = TEST_CODE_READING_NO_VMLINUX;
>> + else if (!have_kcore&& try_kcore)
>> + err = TEST_CODE_READING_NO_KCORE;
>
> It seems that the above line is not reachable since we already bailed
> out the second test if we don't have kcore.
Fixed in V2
>
>
>> else if (excl_kernel)
>> err = TEST_CODE_READING_NO_ACCESS;
>> else
>> @@ -485,7 +534,9 @@ int test__code_reading(void)
>> {
>> int ret;
>>
>> - ret = do_test_code_reading();
>> + ret = do_test_code_reading(false);
>> + if (!ret)
>
> Shouldn't it be
>
> if (ret)
No. Zero is returned if vmlinux is found and the kernel is not
excluded. In all other cases, there is no point trying kcore.
Note if vmlinux is not found, then kcore will be tried the first
time around.
> ?
>
> Thanks,
> Namhyung
>
>
>> + ret = do_test_code_reading(true);
>>
>> switch (ret) {
>> case TEST_CODE_READING_OK:
>> @@ -493,9 +544,15 @@ int test__code_reading(void)
>> case TEST_CODE_READING_NO_VMLINUX:
>> fprintf(stderr, " (no vmlinux)");
>> return 0;
>> + case TEST_CODE_READING_NO_KCORE:
>> + fprintf(stderr, " (no kcore)");
>> + return 0;
>> case TEST_CODE_READING_NO_ACCESS:
>> fprintf(stderr, " (no access)");
>> return 0;
>> + case TEST_CODE_READING_NO_KERNEL_OBJ:
>> + fprintf(stderr, " (no kernel obj)");
>> + return 0;
>> default:
>> return -1;
>> };
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists