• Masami Hiramatsu's avatar
    perf probe: Trace a magic number if variable is not found · cb402730
    Masami Hiramatsu authored
    Trace a magic number as immediate value if the target variable is not
    found at some probe points which is based on one probe event.
    
    This feature is good for the case if you trace a source code line with
    some local variables, which is compiled into several instructions and
    some of the variables are optimized out on some instructions.
    
    Even if so, with this feature, perf probe trace a magic number instead
    of such disappeared variables and fold those probes on one event.
    
    E.g. without this patch:
    
      # perf probe -D "pud_page_vaddr pud"
      Failed to find 'pud' in this function.
      Failed to find 'pud' in this function.
      Failed to find 'pud' in this function.
      Failed to find 'pud' in this function.
      Failed to find 'pud' in this function.
      Failed to find 'pud' in this function.
      Failed to find 'pud' in this function.
      Failed to find 'pud' in this function.
      Failed to find 'pud' in this function.
      Failed to find 'pud' in this function.
      Failed to find 'pud' in this function.
      Failed to find 'pud' in this function.
      Failed to find 'pud' in this function.
      Failed to find 'pud' in this function.
      Failed to find 'pud' in this function.
      Failed to find 'pud' in this function.
      p:probe/pud_page_vaddr _text+23480787 pud=%ax:x64
      p:probe/pud_page_vaddr _text+23808453 pud=%bp:x64
      p:probe/pud_page_vaddr _text+23558082 pud=%ax:x64
      p:probe/pud_page_vaddr _text+328373 pud=%r8:x64
      p:probe/pud_page_vaddr _text+348448 pud=%bx:x64
      p:probe/pud_page_vaddr _text+23816818 pud=%bx:x64
    
    With this patch:
    
      # perf probe -D "pud_page_vaddr pud" | head
      spurious_kernel_fault is blacklisted function, skip it.
      vmalloc_fault is blacklisted function, skip it.
      p:probe/pud_page_vaddr _text+23480787 pud=%ax:x64
      p:probe/pud_page_vaddr _text+149051 pud=\deade12d:x64
      p:probe/pud_page_vaddr _text+23808453 pud=%bp:x64
      p:probe/pud_page_vaddr _text+315926 pud=\deade12d:x64
      p:probe/pud_page_vaddr _text+23807209 pud=\deade12d:x64
      p:probe/pud_page_vaddr _text+23557365 pud=%ax:x64
      p:probe/pud_page_vaddr _text+314097 pud=%di:x64
      p:probe/pud_page_vaddr _text+314015 pud=\deade12d:x64
      p:probe/pud_page_vaddr _text+313893 pud=\deade12d:x64
      p:probe/pud_page_vaddr _text+324083 pud=\deade12d:x64
    Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
    Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
    Cc: Tom Zanussi <tom.zanussi@linux.intel.com>
    Link: http://lore.kernel.org/lkml/157406476931.24476.6261475888681844285.stgit@devnote2Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    cb402730
probe-event.c 81.3 KB