Re: [PATCH v4] perf tools: Fix build-id matching on vmlinux

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ingo and Arnaldo,

On Wed, 24 Sep 2014 09:33:56 +0200, Ingo Molnar wrote:
> * Namhyung Kim <namhyung@xxxxxxxxxx> wrote:
>> @@ -1062,8 +1063,26 @@ static int machine__process_kernel_mmap_event(struct machine *machine,
>>  		 * Should be there already, from the build-id table in
>>  		 * the header.
>>  		 */
>> -		struct dso *kernel = __dsos__findnew(&machine->kernel_dsos,
>> -						     kmmap_prefix);
>> +		struct dso *kernel = NULL;
>> +		struct dso *dso;
>> +
>> +		list_for_each_entry(dso, &machine->kernel_dsos, node) {
>> +			const char *suffix;
>> +			size_t len = strlen(dso->long_name);
>> +
>> +			if (WARN_ONCE(len <= 3, "Too short dso name"))
>> +				continue;
>> +
>> +			suffix = dso->long_name + len - 3;
>> +			if (strcmp(suffix, ".ko")) {
>> +				kernel = dso;
>> +				break;
>> +			}

I just noticed that the modules can be gzip'ed on some system
(e.g. Arch) so that it no longer has the ".ko" suffix.

  $ ls /lib/modules/`uname -r`/kernel/fs/btrfs/
  btrfs.ko.gz


Actually in this case, the dso->long_name cannot be set since when perf
record synthesizes module map events, it checks the ".ko" suffix
also. :/

And I also guess that if one loads a custom module not in a canonical
path, it again cannot find the long name (absolute path) of the module
and it results in no ".ko" suffix in the long name - so the check will
be broken too.


>> +		}
>> +
>> +		if (kernel == NULL)
>> +			kernel = __dsos__findnew(&machine->kernel_dsos,
>> +						 kmmap_prefix);
>
> Please don't break the line just to pacify checkpatch.pl. Other 
> than that:

For non string literals too?  Anyway in this case, it's already broken. :)


>
> Acked-by: Ingo Molnar <mingo@xxxxxxxxxx>

Thanks anyway! :)

Namhyung
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]