• Namhyung Kim's avatar
    perf annotate-data: Add stack operation pseudo type · 7a54f1d8
    Namhyung Kim authored
    A typical function prologue and epilogue include multiple stack
    operations to save and restore the current value of registers.
    On x86, it looks like below:
    
      push  r15
      push  r14
      push  r13
      push  r12
    
      ...
    
      pop   r12
      pop   r13
      pop   r14
      pop   r15
      ret
    
    As these all touches the stack memory region, chances are high that they
    appear in a memory profile data.  But these are not used for any real
    purpose yet so it'd return no types.
    
    One of my profile type shows that non neglible portion of data came from
    the stack operations.  It also seems GCC generates more stack operations
    than clang.
    
    Annotate Instruction stats
    total 264, ok 169 (64.0%), bad 95 (36.0%)
    
        Name      :  Good   Bad
      -----------------------------------------------------------
        movq      :    49    27
        movl      :    24     9
        popq      :     0    19   <-- here
        cmpl      :    17     2
        addq      :    14     1
        cmpq      :    12     2
        cmpxchgl  :     3     7
    
    Instead of dealing them as unknown, let's create a seperate pseudo type
    to represent those stack operations separately.
    Reviewed-by: default avatarIan Rogers <irogers@google.com>
    Cc: Stephane Eranian <eranian@google.com>
    Cc: Masami Hiramatsu <mhiramat@kernel.org>
    Link: https://lore.kernel.org/r/20240117062657.985479-5-namhyung@kernel.orgSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
    7a54f1d8
annotate-data.h 3.76 KB