linuxlinux-kerneloprofile

Oprofile warning "could not check that the binary file"


We do profiling kernel modules with Oprofile and there is a warning in the opreport as follow

warning: could not check that the binary file /lib/modules/2.6.32-191.el6.x86_64/kernel/fs/ext4/ext4.ko has not been modified since the profile was taken. Results may be inaccurate.
1591    samples % symbol name
1592    1622 9.8381 ext4_iget
1593    1591 9.6500 ext4_find_entry
1594    1231 7.4665 __ext4_get_inode_loc
1595    783 4.7492 ext4_ext_get_blocks
1596    752 4.5612 ext4_check_dir_entry
1597    644 3.9061 ext4_mark_iloc_dirty
1598    583 3.5361 ext4_get_blocks
1599    583 3.5361 ext4_xattr_get

May anyone please explain what is the warning, does it impact the accuracy of the oprofile output and is there anyway to avoid this warning?

Any suggestions are appreciated. Thank a lot!

Add more information: In daemon/opd_mangling.c

if (!sf->kernel)
    binary = find_cookie(sf->cookie);
else
    binary = sf->kernel->name;
...
fill_header(odb_get_data(file), counter,
        sf->anon ? sf->anon->start : 0, last_start,
        !!sf->kernel, last ? !!last->kernel : 0,
        spu_profile, sf->embedded_offset,
        binary ? op_get_mtime(binary) : 0);

For kernel module file, the sf->kernel->name is the kernel module name, so the fill header will always fill mtime with 0 and generate the unwanted warning


Solution

  • This failure indicates that a stat of the file in question failed. Do an strace -e stat to see the specific failure mode.

    time_t op_get_mtime(char const * file)
    {
        struct stat st;
    
        if (stat(file, &st))
            return 0;
    
        return st.st_mtime;
    }
    ...
        if (!header.mtime) {
            // FIXME: header.mtime for JIT sample files is 0. The problem could be that
            //        in opd_mangling.c:opd_open_sample_file() the call of fill_header()
            //        think that the JIT sample file is not a binary file.
            if (is_jit_sample(file)) {
                cverb << vbfd << "warning: could not check that the binary file "
                      << file << " has not been modified since "
                      "the profile was taken. Results may be inaccurate.\n";
    

    does it impact the accuracy of the oprofile output and is there anyway to avoid this warning?

    Yes, it impacts the output in that it has no opportunity to warn you whether "the last modified time of the binary file does not match that of the sample file...". As long as you're certain what you measured then matches which binary is installed now, the warning you're seeing is harmless.