• Zechuan Chen's avatar
    perf probe: Fix ppc64 'perf probe add events failed' case · 4624f199
    Zechuan Chen authored
    Because of commit bf794bf5 ("powerpc/kprobes: Fix kallsyms
    lookup across powerpc ABIv1 and ABIv2"), in ppc64 ABIv1, our perf
    command eliminates the need to use the prefix "." at the symbol name.
    
    But when the command "perf probe -a schedule" is executed on ppc64
    ABIv1, it obtains two symbol address information through /proc/kallsyms,
    for example:
    
      cat /proc/kallsyms | grep -w schedule
      c000000000657020 T .schedule
      c000000000d4fdb8 D schedule
    
    The symbol "D schedule" is not a function symbol, and perf will print:
    "p:probe/schedule _text+13958584"Failed to write event: Invalid argument
    
    Therefore, when searching symbols from map and adding probe point for
    them, a symbol type check is added. If the type of symbol is not a
    function, skip it.
    
    Fixes: bf794bf5 ("powerpc/kprobes: Fix kallsyms lookup across powerpc ABIv1 and ABIv2")
    Signed-off-by: default avatarZechuan Chen <chenzechuan1@huawei.com>
    Acked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Jianlin Lv <Jianlin.Lv@arm.com>
    Cc: Jin Yao <yao.jin@linux.intel.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Michael Ellerman <mpe@ellerman.id.au>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
    Cc: Yang Jihong <yangjihong1@huawei.com>
    Link: https://lore.kernel.org/r/20211228111338.218602-1-chenzechuan1@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    4624f199
probe-event.c 86.8 KB