Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3256201rwb; Mon, 15 Aug 2022 22:28:09 -0700 (PDT) X-Google-Smtp-Source: AA6agR5FpRSWcgdlyYW4PmOy0w6MrOfR8yQJVdkwgOn9+InLGvfXsRyXxsU9dkiU79F5G/vxZu7O X-Received: by 2002:a17:902:db06:b0:16f:16b7:69d0 with SMTP id m6-20020a170902db0600b0016f16b769d0mr20278014plx.145.1660627689255; Mon, 15 Aug 2022 22:28:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660627689; cv=none; d=google.com; s=arc-20160816; b=YMaWWI6rIAE7L02jkE+15dB2HrsbQDTm3Lfsohxe8fmYWxvJUEiHE1aT397uMXxduI wEFY/cTcWBSWNuN+uCOSIuBQxLbyvB/8DmFdI9VAa4Mbu/pnY8fRoHgbHG4JcG6CRbkc Z7nsCVgoljQdDJVfH9cXSX8l03zBOe55CbTFdrODIBEgQBBE8ZtCZDh9hK1S7sfvvQD5 09gMS8dlzmPjxK15OSQ9ySfzKtOWT2DiASZzGhLGxVikmv9yJby5CvCYx06PHv4KAo4v ogQUOvPaxM5mYAoxV9jRl+eDSw2XJOof3Shp1wuLjIkbbhKDepGNOaDE2K5NJoR4wguZ gTTA== 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=MeE/rI2WZTg1PMdUjnU/72C2Yzss9kgMp+Z9vAUZFac=; b=r1arNIiOPFbzZA4I4WnG/hNVzHuqb0oMOTJjuw3TtudFMkUAN3F/PVuLgQG36cubwi kKLMAST0O8XvZ2W7SwrtxoEzKmdpEoZAUszjYeAbjq+Ksp/Aa+THdeKaOkn/Rb85h7Gc hB4IuKftnoAX2ortoZ1q4zwY+A+LUb5cDg2OxBtb/idJMbxVCFbTeFLi5u1lCOC2XDn7 B7CQ41FILcrT9HwQ5bB1JfHa4yiJ+xbXUMbOA3O6uQ23wy6P1un6ZmubNVZh6AUWoc+m hczYfJOHtEYk5JY3hYKhNBh+zvuHFmDoDPy8hVDXrrDuQdzD8J1+K/CxxG8w1qL8iEqn mJqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UUWrEzwL; 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 h10-20020a63530a000000b0042814932da7si6702037pgb.403.2022.08.15.22.27.58; Mon, 15 Aug 2022 22:28:09 -0700 (PDT) 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=UUWrEzwL; 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 S232482AbiHPEtL (ORCPT + 99 others); Tue, 16 Aug 2022 00:49:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232674AbiHPEpp (ORCPT ); Tue, 16 Aug 2022 00:45:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C6F5AF0D9; Mon, 15 Aug 2022 13:42:38 -0700 (PDT) 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 20098B80EAD; Mon, 15 Aug 2022 20:42:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 694BFC433C1; Mon, 15 Aug 2022 20:42:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660596155; bh=1nxUEJqdGrmDbqMzj+vb/mQeqj5KZSqrH9pIU4WSL2s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UUWrEzwLcSz8QKeA3xG+KWWkXTXzLhxcBFwOGIeIVydEuX9xt/2cQbpVUBbPYXvYJ hBEdNWuQbA2Z3iUPEoMvr4JaLLwnLOMwbtFbXylgLx15rRkjzm3dTx4u8GjUWFELtZ uLnAXh9t714vYLac9LgJteRFpcNIlT3cNDx5riuM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adrian Hunter , Andi Kleen , Ian Rogers , Jiri Olsa , kvm@vger.kernel.org, Namhyung Kim , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 5.19 0973/1157] perf tools: Fix dso_id inode generation comparison Date: Mon, 15 Aug 2022 20:05:29 +0200 Message-Id: <20220815180518.640417587@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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: Adrian Hunter [ Upstream commit 68566a7cf56bf3148797c218ed45a9de078ef47c ] Synthesized MMAP events have zero ino_generation, so do not compare them to DSOs with a real ino_generation otherwise we end up with a DSO without a build id. Fixes: 0e3149f86b99ddab ("perf dso: Move dso_id from 'struct map' to 'struct dso'") Signed-off-by: Adrian Hunter Cc: Andi Kleen Cc: Ian Rogers Cc: Jiri Olsa Cc: kvm@vger.kernel.org Cc: Namhyung Kim Link: https://lore.kernel.org/r/20220711093218.10967-2-adrian.hunter@intel.com [ Added clarification to the comment from Ian + more detailed explanation from Adrian ] Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/util/dsos.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/dsos.c b/tools/perf/util/dsos.c index b97366f77bbf..2bd23e4cf19e 100644 --- a/tools/perf/util/dsos.c +++ b/tools/perf/util/dsos.c @@ -23,8 +23,19 @@ static int __dso_id__cmp(struct dso_id *a, struct dso_id *b) if (a->ino > b->ino) return -1; if (a->ino < b->ino) return 1; - if (a->ino_generation > b->ino_generation) return -1; - if (a->ino_generation < b->ino_generation) return 1; + /* + * Synthesized MMAP events have zero ino_generation, avoid comparing + * them with MMAP events with actual ino_generation. + * + * I found it harmful because the mismatch resulted in a new + * dso that did not have a build ID whereas the original dso did have a + * build ID. The build ID was essential because the object was not found + * otherwise. - Adrian + */ + if (a->ino_generation && b->ino_generation) { + if (a->ino_generation > b->ino_generation) return -1; + if (a->ino_generation < b->ino_generation) return 1; + } return 0; } -- 2.35.1