From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4710C433FE for ; Mon, 14 Feb 2022 09:42:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244641AbiBNJmQ (ORCPT ); Mon, 14 Feb 2022 04:42:16 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:33982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244983AbiBNJlC (ORCPT ); Mon, 14 Feb 2022 04:41:02 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1A891ADA7; Mon, 14 Feb 2022 01:36:39 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6F59C60F87; Mon, 14 Feb 2022 09:36:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3ADFC340E9; Mon, 14 Feb 2022 09:36:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644831398; bh=DqHdHTwGY9ECVd1fMS2r5aNiB2rMUb0e+u093JFxsMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AR28315Os6kCn+pJKlfrmCum4wEky9MEhmxP+RVZE7SA3eRJ2kMCOCaYolk898sNu SSCLY283JOqJ75c+O1NnBcyLJNqmOZZ65pgFOtCgym/tzBUpvK9ROjtpFKWPoxE0pH Kp0mURiBmETBKNiekjGDj/WqomIgKUXY4PGPcg/8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zechuan Chen , Masami Hiramatsu , Alexander Shishkin , Ingo Molnar , Jianlin Lv , Jin Yao , Jiri Olsa , Mark Rutland , Michael Ellerman , Namhyung Kim , "Naveen N. Rao" , Peter Zijlstra , Ravi Bangoria , Yang Jihong , Arnaldo Carvalho de Melo , Sudip Mukherjee Subject: [PATCH 5.4 34/71] perf probe: Fix ppc64 perf probe add events failed case Date: Mon, 14 Feb 2022 10:26:02 +0100 Message-Id: <20220214092453.167162721@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092452.020713240@linuxfoundation.org> References: <20220214092452.020713240@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Zechuan Chen commit 4624f199327a704dd1069aca1c3cadb8f2a28c6f upstream. Because of commit bf794bf52a80c627 ("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: bf794bf52a80c627 ("powerpc/kprobes: Fix kallsyms lookup across powerpc ABIv1 and ABIv2") Signed-off-by: Zechuan Chen Acked-by: Masami Hiramatsu Cc: Alexander Shishkin Cc: Ingo Molnar Cc: Jianlin Lv Cc: Jin Yao Cc: Jiri Olsa Cc: Mark Rutland Cc: Michael Ellerman Cc: Namhyung Kim Cc: Naveen N. Rao Cc: Peter Zijlstra Cc: Ravi Bangoria Cc: Yang Jihong Link: https://lore.kernel.org/r/20211228111338.218602-1-chenzechuan1@huawei.com Signed-off-by: Arnaldo Carvalho de Melo [sudip: adjust context] Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- tools/perf/util/probe-event.c | 3 +++ 1 file changed, 3 insertions(+) --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -2954,6 +2954,9 @@ static int find_probe_trace_events_from_ for (j = 0; j < num_matched_functions; j++) { sym = syms[j]; + if (sym->type != STT_FUNC) + continue; + tev = (*tevs) + ret; tp = &tev->point; if (ret == num_matched_functions) {