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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 43980C3DA5D for ; Mon, 15 Jul 2024 10:27:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:References:Cc:To:From:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=+YB6GyEske1j+4F/X1u+CO+rNqDoQgEE3OjwyzWAy9k=; b=hkmHvv/03SAAiYsCCn+RCIPL6/ 0z2/wPqOTfEpWGP3eBaZsI+k9Z6jPLXRWSidMWAv4lsKJMQHxsD+eXeXgFqNw/aXk+HRxslR0XqBP IeMU4+PS/FmSc+885g7EgcgqZbRFZty3bZjQCzZx4AQnaV/CwV9JHK4vDukf9OaDoWoGGiaTlFTlp hHtsCzfb75bnuCy7kDgwKRdgAEkbvoazp9dBuI5E8+fH335LCb9WVaF4yZSzy+mrxvZpvfZgfNL9g BeBfPYZn7N21MFth4TSvsYlf5bm5+eESb08Ezzegr9peV6CxaD2h6c0Eys4wm4emI5ps9Oz2W9fAn uP9jrl6Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTIvZ-00000006gz4-0AG1; Mon, 15 Jul 2024 10:27:29 +0000 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTIvF-00000006gv0-06i5 for linux-arm-kernel@lists.infradead.org; Mon, 15 Jul 2024 10:27:11 +0000 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-367ab76d5e1so1133565f8f.3 for ; Mon, 15 Jul 2024 03:27:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721039227; x=1721644027; darn=lists.infradead.org; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=+YB6GyEske1j+4F/X1u+CO+rNqDoQgEE3OjwyzWAy9k=; b=Wzs1yqr8GvO0Bx/IASKVl3QZDce4wBqZJeaqhGPaA7wjwlmvRR6TooJJUMPezScInH ikQm2OYJvdPyUcqC+O1mvJ2dyhUYLKajyIpjgLYg1DhJiW6o43KcAu31M4z2uQ3wL5sz yuGwn0mHBOUcxOyYUfk4964gCM98dfovJXeZn9izOl+krB6/l8issfUOdElig4HWXZEB 0dxbOTFKxTAxjBTCwLFe3bOqKwqp62Zg1lo/+m/op/QnK8Z/r2jSasUoQN35lT1djxUI Jtan1yPYmmvJkKkM0WwzD3LTcJgCQp+s/4N7cJftpKBAmDml46VUAAzeZweBWQViVeqX rkTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721039227; x=1721644027; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+YB6GyEske1j+4F/X1u+CO+rNqDoQgEE3OjwyzWAy9k=; b=BVXIgn6b7Zd5zJ024TmjHVd81W+t/PXLz7x1U69pKFiG+T1eU49Xu8HjIqp0M57IFo i9vjA15hbVjgYZuo5GPg9WZmS3TTt2y9NWgVxzeZKvJ6QpfyKE+hKOOPoYgBF8EJuM6j 2QI9obYoiJnkZxxJiRm7rH3s8cAZ1OoNZXtWV20TmsaWCaJ+b+Yt2id0XGOGLlCPg+oF xUEGABH7tI3LLCnRMFNoJ3qCj7ZhGkHrgFG7qP1ZhD6phyWnRhJ7UaymaKk5iNyUh8YW MKQXjhd/ieUezhzhh3HpKSto530VcbpsQ3aTWgDQ1n1RgvyhFA/sFJ7TXrPX25aXUW+v BWpw== X-Forwarded-Encrypted: i=1; AJvYcCVNND0ZLKIb23+rC4CXuYajGDxxUQJYxvpJKYwmmiwjmP0DkuXffE1VzE1+5eAEeUdVTnUGHav0SXITvM7zYwHZQ3MNiwowOFSTOlUmR8R7u/4PLtY= X-Gm-Message-State: AOJu0YzzP81qrjOjeYgj/g9MbVyl49u9kwufaIa7S+OsbM1a3zSKEx5i 3UymMvq5XrXG8vJ+/aSkhH/ed98mLTLwfLRmhQdoqSnBq7rs6Z611ovtgzQTxME= X-Google-Smtp-Source: AGHT+IFzeOMW994aFZZ6KhlY57Z3nO94Tx9Y3WX/O7j+SzIT09YBmXya/qnh018zd8sZP2VHnLZmaA== X-Received: by 2002:a5d:540c:0:b0:362:8ec2:53d6 with SMTP id ffacd0b85a97d-367cead91f0mr11986981f8f.61.1721039227157; Mon, 15 Jul 2024 03:27:07 -0700 (PDT) Received: from [192.168.1.3] ([89.47.253.130]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3680dabefa6sm5952666f8f.44.2024.07.15.03.27.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Jul 2024 03:27:06 -0700 (PDT) Message-ID: <5da9faa9-132c-4038-8b28-3b6e2fdeb1eb@linaro.org> Date: Mon, 15 Jul 2024 11:27:05 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH V3 00/10] perf tools: Fix test "perf probe of function from different CU" From: James Clark To: Chaitanya S Prakash , linux-perf-users@vger.kernel.org, Arnaldo Carvalho de Melo , Ian Rogers , Namhyung Kim Cc: anshuman.khandual@arm.com, Josh Poimboeuf , Suzuki K Poulose , Mike Leach , John Garry , Will Deacon , Leo Yan , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , Chenyuan Mi , Masami Hiramatsu , Ravi Bangoria , =?UTF-8?Q?Ahelenia_Ziemia=C5=84ska?= , Colin Ian King , Changbin Du , Kan Liang , Athira Rajeev , Tiezhu Yang , Alexey Dobriyan , =?UTF-8?Q?Georg_M=C3=BCller?= , Liam Howlett , bpf@vger.kernel.org, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Peter Zijlstra , Ingo Molnar References: <20240601125946.1741414-1-ChaitanyaS.Prakash@arm.com> <65aaf9bb-ab2c-4185-b5bb-22a717ac7e73@arm.com> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240715_032709_149520_3F0E046B X-CRM114-Status: GOOD ( 24.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 15/07/2024 10:34 am, James Clark wrote: > > > On 10/07/2024 8:39 am, Chaitanya S Prakash wrote: >> Gentle ping, are there any updates on the string clean up patch set? >> >> On 6/1/24 18:29, Chaitanya S Prakash wrote: >>> From: Chaitanya S Prakash >>> >>> Perf treated all files beginning with "/tmp/perf-" as a map file despite >>> them always ending in ".map", this caused the test "perf probe of >>> function from different CU" 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.10-rc1 mainline kernel, both on >>> arm64 and x86 platforms. >>> >>> Changes in V3: >>> >>> - Patch adding configs required by "perf probe of function from >>> different >>>    CU" was originally part of the series but has been merged in >>> 6.10-rc1. >>> https://github.com/torvalds/linux/commit/6b718ac6874c2233b8dec369a8a377d6c5b638e6 >>> >>> - Restructure patches according to the maintainer trees. >>> - Add explanation for why '| grep "foo"' is used. >>> - Fix build errors for when perf is built with LLVM=1. >>> >>> Changes in V2: >>> https://lore.kernel.org/all/20240408062230.1949882-1-ChaitanyaS.Prakash@arm.com/ >>> >>> - 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() >>> >>> Changes in V1: >>> https://lore.kernel.org/all/20240220042957.2022391-1-ChaitanyaS.Prakash@arm.com/ >>> >>> 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 (10): >>>    tools lib: adopt str_has_suffix() from bpftool/gen.c > > LGTM, > > Reviewed-by: James Clark Reviewed-by: James Clark Need to fix that... > > The below commit looked like it could be prone to an off by one error > but I debugged it to confirm that it's ok: > >>>    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 >>>    libsubcmd: Replace strstarts() usage with str_has_prefix() >>>    objtool: Replace strstarts() usage with str_has_prefix() >>>    perf tools: Replace strstarts() usage with str_has_prefix() >>>    tools lib: Remove strstarts() as all its usecases have been replaced >>>      by str_has_prefix() >>>    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                            | 48 +++++++++++++++++++ >>>   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 ++--- >>>   .../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                      |  3 +- >>>   39 files changed, 148 insertions(+), 117 deletions(-) >>> >>