Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1155712lqe; Sun, 7 Apr 2024 23:23:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWBHgw3obZBi3ilj4Of0vPUXKvJLHQawxk4dbaM3OoDnFJoHKlP/9e/TX93iUkOAXr2TiQMvY97Pp2/tZnjCre42EFL9aHmPJHV5p2cBw== X-Google-Smtp-Source: AGHT+IELOwmBKOOGeEDAJZOVhE+EaXzbhCd/dIVWkPWHxARzF95CCMUUpzZxyh9w+RO0lFHF1q9l X-Received: by 2002:a05:620a:4724:b0:78d:6778:29c with SMTP id bs36-20020a05620a472400b0078d6778029cmr1461164qkb.49.1712557421682; Sun, 07 Apr 2024 23:23:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712557421; cv=pass; d=google.com; s=arc-20160816; b=o93s0Gl/tkMK6u5eviL35zXiTFozWgo1i5f8KPh067HmfES+qli0tJOfGfsIZzin4C hD3Z0DYThctUY2cCzKR9YeqUDhHsZBzIZVqjN48Q4HZYJVy8gMYstEI12aT+8FmfdjFk lynXo3Kp84Fijkalwa1ledFFI9PJLyIZ/XfAQs1Wxn2x1vV0p9fvQl+zEwQhLF+s/1Vc cjOR468fJokKAWhlZll+Lf1qj/mFW2PgsduqwFTyv3yWLhZZUqeB9GD7NNla5JE1m06l QdH3SR3o6tAd+dFKldsxUvvL+L91lAybxPaeEdz580ioPPId2dGrzG3ywqbF2Kd98wY/ iiCA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=s7Qb5EjE9FglCDNVp+5vnixImoS4Pcb1g4XbWEN0MzA=; fh=QA06vvGVV0qfIeWylXtJ7AlzHHCn9LUuaciNOyd1ymw=; b=QRXHo3Sa2qbBOgR0uf1VXaxzWRO10otoCIwwhtm5Zfx3AnumKU+qUdLxkPBrxdmyAj jc2f1H+2R32brvlc2UDo9Mg4B2A7ws4ZuOi5fIE4mDV5DnfVn1lK7pk5sNhYKf2ow/v5 iVwiI5Gji1smH5AGLsIH5vnEvKiYeHCRxz+OyevknORfbWwSk/F1jXZ9xQ1c7mzMLFOo lMMUKyZEVEGMIrL183I2QbNV+0JLcKT0tWirHKgssmtVqsLT4Yzf6JeLjc/zy28UXz7n C+PNWvmCLNb8ZR5qJtawDBWEbCDbIctrm3opIE+nmGj1E9vTUNcRb5bgVmw1M/WmTaDb uBXQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-134832-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-134832-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id v13-20020a05620a090d00b0078d628a2c71si2597666qkv.242.2024.04.07.23.23.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Apr 2024 23:23:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-134832-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-134832-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-134832-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 297311C214A5 for ; Mon, 8 Apr 2024 06:23:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5D5AE13AF2; Mon, 8 Apr 2024 06:23:29 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8C6B918C05; Mon, 8 Apr 2024 06:23:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712557408; cv=none; b=TAEwbkWOZPVWkvdUAXM6wSz8B5ujRERvaCz5q1ebHRmOHIxtjydTIPLkNX2GgnNtJVvP2ZIb3aJVHQ2pcAAyNSPqsa6ZSuzLh6Ie89LGRteFTirhU+y+Ps+OcIKOgtM2KV1qwbW/CYEKo/LkGbQLJkpdfuz6aZTVdmeaDOTAkJg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712557408; c=relaxed/simple; bh=MDilTp9RpE7g2rCJ/IYvSQbKWXU6/qfFiAgirnCRvWg=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=Qb/b4XiHOzl/VLrsX6M5XfeBpQfh+83/kNNPDlklZSAaYabwJGNpJ5VirpeKfs+8vZUPoFXEXgwZVZzWZJKVtK9vvmgr92KUdwOHiYI9aQpl6R7EZUSNRzid288F+yJ4jjB31ZODTIe3565Lvp+aqoYQIE376PahkEa05fz9/PQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 24E181007; Sun, 7 Apr 2024 23:23:50 -0700 (PDT) Received: from a079740.arm.com (unknown [10.163.54.109]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 72EB73F6C4; Sun, 7 Apr 2024 23:23:01 -0700 (PDT) From: Chaitanya S Prakash To: linux-perf-users@vger.kernel.org Cc: anshuman.khandual@arm.com, james.clark@arm.com, Chaitanya S Prakash , Josh Poimboeuf , Peter Zijlstra , Suzuki K Poulose , Mike Leach , John Garry , Will Deacon , Leo Yan , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Chenyuan Mi , Masami Hiramatsu , Ravi Bangoria , =?UTF-8?q?Ahelenia=20Ziemia=C5=84ska?= , Colin Ian King , Changbin Du , Kan Liang , Athira Rajeev , Tiezhu Yang , Alexey Dobriyan , =?UTF-8?q?Georg=20M=C3=BCller?= , Liam Howlett , bpf@vger.kernel.org, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 0/8] perf tools: Fix test "perf probe of function from different CU" Date: Mon, 8 Apr 2024 11:52:22 +0530 Message-Id: <20240408062230.1949882-1-ChaitanyaS.Prakash@arm.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Chaitanya S Prakash Defconfig doesn't provide all the necessary configs required for the test "perf probe of function from different CU" to run successfully on all platforms. Therefore the required configs have been added to config fragments to resolve this issue. On further investigation it was seen that the Perf treated all files beginning with "/tmp/perf-" as a map file despite them always ending in ".map", this caused the test to fail when Perf was built with NO_DWARF=1. As the file was parsed as a map file, the probe...--funcs command output garbage values instead of listing the functions in the binary. After fixing the issue an additional check to test the output of the probe...--funcs command has been added. Additionally, various functions within the codebase have been refactored and restructured. The definition of str_has_suffix() has been adopted from tools/bpf/bpftool/gen.c and added to tools/lib/string.c in an attempt to make the function more generic. The implementation has been retained but the return values have been modified to resemble that of str_has_prefix(), i.e., return strlen(suffix) on success and 0 on failure. In light of the new addition, "ends_with()", a locally defined function used for checking if a string had a given suffix has been deleted and str_has_suffix() has replaced its usage. A call to strtailcmp() has also been replaced as str_has_suffix() seemed more suited for that particular use case. Finally str_has_prefix() is adopted from the kernel and is added to tools/lib/string.c, following which strstarts() is deleted and its use has been replaced with str_has_prefix(). This patch series has been tested on 6.9-rc2 mainline kernel, both on arm64 and x86 platforms. Changes in V2: - Add str_has_suffix() and str_has_prefix() to tools/lib/string.c - Delete ends_with() and replace its usage with str_has_suffix() - Replace an instance of strtailcmp() with str_has_suffix() - Delete strstarts() from tools/include/linux/string.h and replace its usage with str_has_prefix() Cc: Josh Poimboeuf Cc: Peter Zijlstra Cc: Suzuki K Poulose Cc: Mike Leach Cc: James Clark Cc: John Garry Cc: Will Deacon Cc: Leo Yan Cc: Ingo Molnar Cc: Arnaldo Carvalho de Melo Cc: Namhyung Kim Cc: Mark Rutland Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Ian Rogers Cc: Adrian Hunter Cc: Chenyuan Mi Cc: Masami Hiramatsu Cc: Ravi Bangoria Cc: Ahelenia Ziemiańska Cc: Colin Ian King Cc: Changbin Du Cc: Kan Liang Cc: Athira Rajeev Cc: Tiezhu Yang Cc: Alexey Dobriyan Cc: Georg Müller Cc: Liam Howlett Cc: bpf@vger.kernel.org Cc: coresight@lists.linaro.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: linux-perf-users@vger.kernel.org Chaitanya S Prakash (8): tools lib: adopt str_has_suffix() from bpftool/gen.c perf util: Delete ends_with() and replace its use with str_has_suffix() perf util: Replace an instance of strtailcmp() by str_has_suffix() tools lib: Adopt str_has_prefix() from kernel tools: Delete strstarts() and replace its usage with str_has_prefix() perf tools: Enable configs required for test_uprobe_from_different_cu.sh perf tools: Only treat files as map files when they have the extension .map perf test: Check output of the probe ... --funcs command tools/include/linux/string.h | 12 ++---- tools/lib/string.c | 42 +++++++++++++++++++ tools/lib/subcmd/help.c | 2 +- tools/lib/subcmd/parse-options.c | 18 ++++---- tools/objtool/check.c | 2 +- tools/perf/arch/arm/util/pmu.c | 4 +- tools/perf/arch/x86/annotate/instructions.c | 14 +++---- tools/perf/arch/x86/util/env.c | 2 +- tools/perf/builtin-c2c.c | 4 +- tools/perf/builtin-config.c | 2 +- tools/perf/builtin-daemon.c | 2 +- tools/perf/builtin-ftrace.c | 2 +- tools/perf/builtin-help.c | 6 +-- tools/perf/builtin-kmem.c | 2 +- tools/perf/builtin-kvm.c | 14 +++---- tools/perf/builtin-kwork.c | 10 ++--- tools/perf/builtin-lock.c | 6 +-- tools/perf/builtin-mem.c | 4 +- tools/perf/builtin-sched.c | 6 +-- tools/perf/builtin-script.c | 30 ++++--------- tools/perf/builtin-stat.c | 4 +- tools/perf/builtin-timechart.c | 2 +- tools/perf/builtin-trace.c | 6 +-- tools/perf/perf.c | 12 +++--- tools/perf/tests/config-fragments/config | 3 ++ .../shell/test_uprobe_from_different_cu.sh | 2 +- tools/perf/tests/symbols.c | 2 +- tools/perf/ui/browser.c | 2 +- tools/perf/ui/browsers/scripts.c | 2 +- tools/perf/ui/stdio/hist.c | 2 +- tools/perf/util/amd-sample-raw.c | 4 +- tools/perf/util/annotate.c | 2 +- tools/perf/util/callchain.c | 2 +- tools/perf/util/config.c | 12 +++--- tools/perf/util/map.c | 8 ++-- tools/perf/util/pmus.c | 2 +- tools/perf/util/probe-event.c | 2 +- tools/perf/util/sample-raw.c | 2 +- tools/perf/util/symbol-elf.c | 4 +- tools/perf/util/symbol.c | 4 +- 40 files changed, 146 insertions(+), 117 deletions(-) -- 2.30.2