Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp6768614pxb; Wed, 17 Feb 2021 12:56:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJx3tbe7P+WBtYQXtoBSIrm/LY5YfV6Dt7qzOzn5qPLkijoQxYPy/FZdccVh/KONfzNpShBT X-Received: by 2002:a17:907:9495:: with SMTP id dm21mr786661ejc.462.1613595380672; Wed, 17 Feb 2021 12:56:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613595380; cv=none; d=google.com; s=arc-20160816; b=FQNzi6eSYlXig05BJCJJZFWH+ajWXJH4etWPe5YPMwAdNMx5x2JgKs+kkQtHo9PQDM Euya9yz6of/jahXUB6HLE4K0UHbl+9Gvn0ar3rllcjBkQkwu2DRR86c9yYckXK/DWNco Z91r+d/mtfpKKv3qJnY6V6+xhCl0WTLmCaT797hOcUifG2oiiY3NNXf+QE/5a1Qm4Nqu CjMA/gS4Wy5a6om8r/c3sKHmJndpBGOPJLtlQJNxt2dHySUvmTfgHLn6elwz1rHhfeLe cCZ+CE1SWrAKPbqULgl3jzFhEbsxUZBUTtFkYr2xE2ZxcUo2bWDuTX0x6ANnjVE0NApH mKMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=tQn5bHnddjrfkTBv2qNuwbly6baElQvSkjoPDC5boS8=; b=zgTjoyiAEZtZ+D6Xg29OnNvTJXPBGARemNdf5CHevNG05fj02c9PZ3J4cwlTStVMrv gBqx1kYtRuw7Jgb2qm5FfOdLnNEnP22du0ISkNPyNuvdBJSFC+H4RYEFsejLeL9Yp5cQ MSjeX7sL0M7h/UzPVYmnaKft3sq+e5O1o2pwCE6bmLqmnYiP7jJWctB1D1BNZe5Pj40L EFeedIHvawVye4p4fGB9/rjZHepJLYGDa11wA5ot3OxIE4FVFFMiYEbumCXoezqkzosg jP2N0eNE45kigcmbCAB3uzNHt6uoFy4teDeHvCMN9JYXNZGNrAws9QQxjwuuO+Z51Zj0 R9mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=C60iXVbl; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r13si2083348edd.388.2021.02.17.12.55.56; Wed, 17 Feb 2021 12:56:20 -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=@kernel.org header.s=k20201202 header.b=C60iXVbl; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234800AbhBQSUQ (ORCPT + 99 others); Wed, 17 Feb 2021 13:20:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:55244 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234802AbhBQSUL (ORCPT ); Wed, 17 Feb 2021 13:20:11 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1D04764DFF; Wed, 17 Feb 2021 18:19:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613585971; bh=YI0feRKi0HADFgtGGKnsDY6OxjSAOTUzUGmBggQklsc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=C60iXVbl2YEKNoduSi3hgGlTi2lHPLugweknDDwSsMunPnScI3ieeDHFWD2UP4T0J Qb6RyiXPZDngHoaV4+UhGVaK4N9lSPW07SvgLg38o3ZSxD1RWI/emvWY1G5qH7gsg3 07q/awsMe6OTV6IPaOPGru8bNLXIs8nPl7nkue/lp1aQLRsl4Vi1+jcEnvGmVTHYR+ ZgVYNUUgF8AZskA+FC0z71mLdF7X5yft73wGH1w+JkQ+u9SjQGBqwk147q4zjURLZ9 FnpSTSye0xnnpupEZRk/Bd8r4mEgD0Uy/SW/163p6Ac0k1F7DeUhqekXYLlzUIBSza ChQws5eNO62NA== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id D254B40CD9; Wed, 17 Feb 2021 15:19:28 -0300 (-03) Date: Wed, 17 Feb 2021 15:19:28 -0300 From: Arnaldo Carvalho de Melo To: Nicholas Fraser Cc: Jiri Olsa , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Namhyung Kim , Ian Rogers , "Frank Ch. Eigler" , Song Liu , Adrian Hunter , Kim Phillips , Tommi Rantala , Remi Bernon , linux-kernel@vger.kernel.org, Ulrich Czekalla , Huw Davies Subject: Re: [PATCH 1/4] perf buildid-cache: Don't skip 16-byte build-ids Message-ID: References: <597788e4-661d-633f-857c-3de700115d02@codeweavers.com> <7f5bc880-7724-643b-5344-c27c4de572ae@codeweavers.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7f5bc880-7724-643b-5344-c27c4de572ae@codeweavers.com> X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Tue, Feb 16, 2021 at 11:35:06AM -0500, Nicholas Fraser escreveu: > No problem, I've added a call to "perf buildid-cache -l" in check() to make > sure the added IDs are reported. The MD5 test fails without the previous > patch to allow 16-byte build-ids. > > Do you also want PE files tested by this test script? This would make the > script depend on a number of things: > > - We'd need to change "readelf" to something that can read the build-id of > PE files; > > - We'd need MinGW installed to build them on the fly the same as the ELF > test cases, although we could use tests/pe-file.exe instead which is > already included; > > - We'd need Wine to actually run it under perf record, which I'm sure you > don't want to depend on; We can check if wine is installed, if not, just emit a warning. I, for one, will install wine for this purpose. > - We'd need to detect whether perf was built with libbfd support. Easily > done by calling perf version --build-options but by this point the test > case is getting pretty out of hand for what it's supposed to test. Nope, at least a group of people need to be checking if this new code doesn't regress, and fix it if it does. > I'll send patches for this test without PE support. It still tests 16-byte > build-ids because it tests an MD5 ELF file. Let me know if you also want me > to add PE support to this script. We can make it optionally perform PE > tests if all of the necessary tools are installed but it would take some > pretty large changes to the script. > > Nick > > > On 2021-02-15 9:31 a.m., Jiri Olsa wrote: > > On Wed, Feb 10, 2021 at 02:17:25PM -0500, Nicholas Fraser wrote: > >> lsdir_bid_tail_filter() ignored any build-id that wasn't exactly 20 > >> bytes. This worked only for SHA-1 build-ids. The build-id for a PE file > >> is always a 16-byte GUID and ELF files can also have MD5 or UUID > >> build-ids. > >> > >> This fix changes the filter to allow build-ids between 16 and 20 bytes. > > > > hi, > > there's tests/shell/buildid.sh test for this, please add > > testcase for this.. looks like perf buildid-cacle -l will > > end up calling this function > > > > thanks, > > jirka > > > >> > >> Signed-off-by: Nicholas Fraser > >> --- > >> tools/perf/util/build-id.c | 5 +++-- > >> tools/perf/util/build-id.h | 4 +++- > >> 2 files changed, 6 insertions(+), 3 deletions(-) > >> > >> diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c > >> index 02df36b30ac5..e32e8f2ff3bd 100644 > >> --- a/tools/perf/util/build-id.c > >> +++ b/tools/perf/util/build-id.c > >> @@ -448,7 +448,8 @@ static bool lsdir_bid_tail_filter(const char *name __maybe_unused, > >> int i = 0; > >> while (isxdigit(d->d_name[i]) && i < SBUILD_ID_SIZE - 3) > >> i++; > >> - return (i == SBUILD_ID_SIZE - 3) && (d->d_name[i] == '\0'); > >> + return (i >= SBUILD_ID_MIN_SIZE - 3) && (i <= SBUILD_ID_SIZE - 3) && > >> + (d->d_name[i] == '\0'); > >> } > >> > >> struct strlist *build_id_cache__list_all(bool validonly) > >> @@ -490,7 +491,7 @@ struct strlist *build_id_cache__list_all(bool validonly) > >> } > >> strlist__for_each_entry(nd2, linklist) { > >> if (snprintf(sbuild_id, SBUILD_ID_SIZE, "%s%s", > >> - nd->s, nd2->s) != SBUILD_ID_SIZE - 1) > >> + nd->s, nd2->s) > SBUILD_ID_SIZE - 1) > >> goto err_out; > >> if (validonly && !build_id_cache__valid_id(sbuild_id)) > >> continue; > >> diff --git a/tools/perf/util/build-id.h b/tools/perf/util/build-id.h > >> index 02613f4b2c29..c19617151670 100644 > >> --- a/tools/perf/util/build-id.h > >> +++ b/tools/perf/util/build-id.h > >> @@ -2,8 +2,10 @@ > >> #ifndef PERF_BUILD_ID_H_ > >> #define PERF_BUILD_ID_H_ 1 > >> > >> -#define BUILD_ID_SIZE 20 > >> +#define BUILD_ID_SIZE 20 /* SHA-1 length in bytes */ > >> +#define BUILD_ID_MIN_SIZE 16 /* MD5/UUID/GUID length in bytes */ > >> #define SBUILD_ID_SIZE (BUILD_ID_SIZE * 2 + 1) > >> +#define SBUILD_ID_MIN_SIZE (BUILD_ID_MIN_SIZE * 2 + 1) > >> > >> #include "machine.h" > >> #include "tool.h" > >> -- > >> 2.30.0 > >> > > -- - Arnaldo