Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3022194rwb; Mon, 15 Aug 2022 16:19:41 -0700 (PDT) X-Google-Smtp-Source: AA6agR7gPlmS64zNgRZa3lSnAJxyYUhffEaQOEyzY6kf9PQfq96x+eXkp+5XsTzDrQG8u8viBEeR X-Received: by 2002:a17:90b:4f49:b0:1f5:c7c:b565 with SMTP id pj9-20020a17090b4f4900b001f50c7cb565mr31428630pjb.32.1660605581049; Mon, 15 Aug 2022 16:19:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605581; cv=none; d=google.com; s=arc-20160816; b=Z6dDqgvjTGYuYoYU0XqWMcILxK2Vb0edOmCSFOiOKFaNSrlhcRIDXjHGnrb0+9dpy7 7IISK8uzrkw95dcYpPT4OqgQden2zKDjTWRI4DEkQLBbloZmfOT/BWXG0fDqCD0EIfcG JQyNEXRL4f9m3zJWf8rRp8811t5hYCM6ar/jQO3WaAcDr8+CINnl3+1C32dVxARWdCsi CBfLxxduHK0VWl9yn8bz5CKMZfI2W2jWTv258dg71EZuh4hnTmwobqN7vu3F1cqvIYX5 j64w5kV80p4Y6xXGe+wc/B6FY7oyUN0aFsjbHU3p5ebevTbwt7MljNnd8k5X/gjM+gNc jAbw== 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=tNUvCCdNOoiQSaVzpILDuViNkB+COO+0sejrZOmUOHeFORulH7BFSfENRxoZ3Qmg32 NJEj058PcNExoHkAlFghpTGvslEVXttrq41WPiPZiI3ZNCpVEI7aNPpIaJOjbpkRHaXq mD6f0aIARyQNd7bZgLG2g49FAuk++LRXo2xZHcXx/alCGQjwOL0ppVHYE7JlC0ZYKVFc NtvKcX/Di0nXNFYZymtrmlyZbGhkMNvSEHxx860+QRVtaXtrmrXC3SO5N36Hbctyn58E 3w4wno+d0NUa9igMwYw1Xz3NzbIdZm0Wozq3MetxhFfSehnB3yEmt+1zNC9jnGO7yeZ9 P+Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=op7xY8D1; 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 c16-20020a056a000ad000b0052c7510851esi13874689pfl.30.2022.08.15.16.19.30; Mon, 15 Aug 2022 16:19:41 -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=op7xY8D1; 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 S1351523AbiHOWou (ORCPT + 99 others); Mon, 15 Aug 2022 18:44:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350628AbiHOWkE (ORCPT ); Mon, 15 Aug 2022 18:40:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC2CED92; Mon, 15 Aug 2022 12:51:44 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 8810A6122B; Mon, 15 Aug 2022 19:51:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 752E1C433D6; Mon, 15 Aug 2022 19:51:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593103; bh=1nxUEJqdGrmDbqMzj+vb/mQeqj5KZSqrH9pIU4WSL2s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=op7xY8D1OoI7mSRj9cJhgPMy8CY4Ss9vDeKTNFe3ngP/lGcQ8V2/iAmPDZ3CpSU0y D5dscJFFbTihqR6Ucqccti1RTrhpzL68FHVXz0ZlL4+U6V0F+3loPI6H+a08gSb+PM ojNWWRc+wnUMSSRI6sdC042qyCrm1uKZcA0Cj8WI= 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.18 0896/1095] perf tools: Fix dso_id inode generation comparison Date: Mon, 15 Aug 2022 20:04:55 +0200 Message-Id: <20220815180506.372132821@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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