Skip to content
Snippets Groups Projects
  • Guodong Xu's avatar
    In GCC10.2 suffix '.isra.0' was appended to 'finish_task_switch' · 00b72fd8
    Guodong Xu authored
    When buildiing kernel with GCC10 [2] in Debian on an Arm64 machine, it was
    found the new "inter-procedural optimization improvements" [1] makes symbol
    name 'finish_task_switch' changed to 'finish_task_switch.isra.0'.
    
    Details:
    The results, when built with gcc 9.3:
    nm ../linux.buildout/kernel/sched/core.o | grep finish_task_switch
    0000000000001288 t finish_task_switch
    
    However, when built with gcc 10.2:
    nm ../linux.buildout/kernel/sched/core.o | grep finish_task_switch
    00000000000012d0 t finish_task_switch.isra.0
    
    The same symbols (with xxx.isra.0 or without, respectively of course) also
    appear in final file 'System.map' and in '/proc/kallsyms' when booting. This
    negatively impact the tracing tools commonly used in kernel debugging, such
    as bcc tools offcputime and runqlat. They hardcode 'finish_task_switch'
    (without the .isra.0 suffix) into their scripts.
    
    This patch fix the issue by changing the hardcoded 'finish_task_switch' string
    to a python regular expression pattern who can match both the traditional form
    'finish_task_switch' and the new gcc10 form 'finish_task_switch.isra.0'
    (with single digit at the end). attach_kprobe()'s input parameter 'event_re'
    is used for this type of pattern matching.
    
    [1] https://gcc.gnu.org/gcc-10/changes.html
    
    
    [2] ARCH=arm64 make Image
    
    Signed-off-by: default avatarGuodong Xu <guodong.xu@linaro.org>
    00b72fd8