Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3667508pxb; Mon, 24 Jan 2022 14:54:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJxRoeNferGgYz1w48F8zCGTHfU7tcjfymyFlEc8UZJGc3UoR8uLuRSL+UOeLSyTIGT7Fafh X-Received: by 2002:a17:902:e88a:b0:14b:3aa4:4d17 with SMTP id w10-20020a170902e88a00b0014b3aa44d17mr9566044plg.160.1643064840470; Mon, 24 Jan 2022 14:54:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643064840; cv=none; d=google.com; s=arc-20160816; b=Sj4frQtsavFyrZDfZ8AOj4CxjCI7A/Ooe3r+rzWLUC6A/dhAE7VXtkCK3WU5MFhPYR n91KsO25WKN7VStObLjyRRbRAVjuFwgnS5XwkoZg0YIY2k+FjlnOcmoHGBnBzY3hw2Xq B0reQJPD/Njk52XEEj0K3rCq7AKhvyOsWbcWyxfY7iffTm9MwhUsFvMwTNL9DxxeoJdX RpGD5HPGWAx5G+EmKehRj7MMuRR3VJEyquoPN3YKzIsE4HkNEH2CiNcClScfsyzAEXAl RC1o9PJawW8yjC5pxiTFwCFEjom5byxML5DEGuxTRIQlT84T+GXfWB0qw4MBJd3TZUON nntA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NTjhmGhW/O2n0ZAcGheSjX/UxNYpVk2PNk7X8cTqJRw=; b=S7D1qFd6SqJLEA4PJwo9/kxWnFgXU1D33cmWWbzC1/XmO40ucLADVdhNDoTOp4zsCO 0iasvhGMjIuPnAngzLC+8IoZdwGn9dIJMUbQvCYxDjESYQgxBsPxBXfMtbjig4uhuXDf 2bVzN36+NBK7eTxoSlUbfmAvoiIMqmxdBm7APiNXkj43crMX/1rCaEEitzsSGzw9ACDO FL9PK0ivjF1toX+BHy387/5rF2yhwTTF+c5aIvIH3IxzN/PvT1loEyIx/uKeByy4ybzC WVOXi+P1GOcm6lpGK8qYbMR839qlIUkySPnR7X03AcHvrC7pRHcuIDuQTNg2YD69IZlT QAaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=O9krJI8x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h71si13959851pgc.72.2022.01.24.14.53.48; Mon, 24 Jan 2022 14:54:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=O9krJI8x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1839110AbiAXWtw (ORCPT + 99 others); Mon, 24 Jan 2022 17:49:52 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52952 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445206AbiAXVng (ORCPT ); Mon, 24 Jan 2022 16:43:36 -0500 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 ams.source.kernel.org (Postfix) with ESMTPS id 1F4E3B8119E; Mon, 24 Jan 2022 21:43:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23521C340E4; Mon, 24 Jan 2022 21:43:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060609; bh=xi4KJIaJwSCkynoxCcarqiM8KPP5W/cAYIZDLYrFnBo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O9krJI8xsM2S5QNE6Aw2IuCATZOgoMbs8wBe7VSujvoGSQ+DD7gJDVKP1wHauRJId WUN6Up3OIB6mFG1Wo21dSyGU+aCH2HGhMchR8vkYuvVa1L4vohi1mTd8d+fwY6+U/x KhGqXLo+KqHs0tts/WNorz0G32PJff+/rPf29Qd0= 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 Subject: [PATCH 5.16 1004/1039] perf probe: Fix ppc64 perf probe add events failed case Date: Mon, 24 Jan 2022 19:46:33 +0100 Message-Id: <20220124184159.039062305@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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: linux-kernel@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 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 @@ -3083,6 +3083,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; + /* There can be duplicated symbols in the map */ for (i = 0; i < j; i++) if (sym->start == syms[i]->start) {