Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5827838pxb; Mon, 14 Feb 2022 08:31:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJxKXCuoD++HlWGzFNvijklZcTBtuNBUe5qcGTgOng/cvFa0anrLW3PTtVDuKmCaZaCsWGj+ X-Received: by 2002:a17:907:3e15:: with SMTP id hp21mr306644ejc.768.1644856274614; Mon, 14 Feb 2022 08:31:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644856274; cv=none; d=google.com; s=arc-20160816; b=hxlb/j9zt8LFQC+R48NO9N78/bFwBB4xL0Ag+NEmJeQNrfLiToJCRj3r/ZltTTSvQq /FYXdewBrXmDLCuhZc9bY8XdbUiGukDS94/OW4qonxs2QOxXJhLy3nmkorgsRzQ0+idX lllEKLTMk67OYN9FMykSlKVq5NnQ/Rz5/RjaT/mG7IBbesPZFJIQvZEKrqEp7J8a6xES yiY0e2OEyPS8ms9dUjlXe2snVrUOokdLAnKJ64h5nSwy0ICGKQlq7eVYF/W2K/onMPgs 8UrbLnKbFfdU6TUEHHfn6W/nC285gadssHLWxiBlJr/4l9i+wdeVAaT5XGVXoMNqqCYk goQA== 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=eCL02z1gJgOaJmNrGMa1OVNr1qZQ4OwOS7sOL5Wlfhc=; b=lF/HPT6J5OGtYmKRRhmAf7G7acL4/3E8Rgz2l5OvEqnTxbue+4HWAsdQpyCbA5XaeL 2nCmBRFLaX9DhyuX29669iM4YAucCQEGfs12uqvetW2V6RvJwIxThKWM3kJG6YQpFszU YJCAoVVi77FxpWloa3bkZT+0h57vAKHwIumme17jL4T/xzDdlESKMl1m2h86Nj8qClY3 DqnRZ7t5j1qdOEfHZtCFrScHqGl0K/Cm3rsWK0XuEuJeYG06nzssIEE4AsrnCm1wr5RM rJj83nXVM05JVWaS5VavtgmRQ9qws3lFZ9Xyu+ANwjzBNVfgWA0pRyyE7t2sPCN4Vap9 Hy3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yttdMwaH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dp7si20266528ejc.507.2022.02.14.08.30.50; Mon, 14 Feb 2022 08:31:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yttdMwaH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232552AbiBNJjd (ORCPT + 99 others); Mon, 14 Feb 2022 04:39:33 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:50010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244535AbiBNJgC (ORCPT ); Mon, 14 Feb 2022 04:36:02 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED30B1AD9D; Mon, 14 Feb 2022 01:33:53 -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 3526F60FFC; Mon, 14 Feb 2022 09:33:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A4F8C340E9; Mon, 14 Feb 2022 09:33:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644831200; bh=4RHKtD2d2DGhQCEoOtiljSMyW0D9xXcbs4ICzooPkGI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yttdMwaH1radMk10/gB5i8OWi2f7WaPgwInAJOLNrW8simP+KZslbKy//kvENidFg wtdgDAi/0HiXww1Pp4azFQr03HXbJY0T37LFBfl+f9/01fPBPU373iBenOj7KGrZg0 ZLCB1o13OlqWDZHRKGSuMMDYY7SVOABIWSKz1MpU= 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 4.19 21/49] perf probe: Fix ppc64 perf probe add events failed case Date: Mon, 14 Feb 2022 10:25:47 +0100 Message-Id: <20220214092448.997112587@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092448.285381753@linuxfoundation.org> References: <20220214092448.285381753@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 [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 @@ -2919,6 +2919,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) {