Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3972694pxb; Tue, 25 Jan 2022 00:20:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJzrHee8o4CBxB7PnNKDW5HEH+Pk8Y2mwPdoT5Cuo4A+t5kRfv0pW2BH42eM1fUr+YF9h1a7 X-Received: by 2002:a17:907:971a:: with SMTP id jg26mr15516665ejc.571.1643098831899; Tue, 25 Jan 2022 00:20:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643098831; cv=none; d=google.com; s=arc-20160816; b=pb+y+5a9dg1alZ8HGwA6jhVWokrpkkjydVWpXhAzg3D+Y+pnXL0erwta3KJxjWKgDl P7+219/PFsshpWAtwPJ29izmCzr/kloKeklt6DTEY+EQvEQ7VZIvXh/myOP8GS5J0kTm DJA887TVcOyz2cunt7Ri7nrGw6E33DK+gQKANU8ItpK8bLARQJRVfCMmGgP3nCB443/N zcagyTkx4uunJxIGqPNkQQgA1v/2R51A45ujCuB/rkWlTHFM2OwDafv9bAf6ZiC+XFAA 9x9Ye+rz9tUZVEbBccbzBQm9G5D56jYeuosVwukx6YqzVT1nTxGQkgvGwUPqpokMrssU 2C+w== 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=vmvu69cfk+62YYg3Rg+084+IbiAZmuQgCIxljm9FQEk=; b=GNGPn7qY7nqOrgjZdpS8y7P246tFjNoWKpVigtjSDi3I01a0WEB+vr71xBJAtaSj4g guSc4iKWCgTwm4/4yxftd2Q3HMyG0vdc05f+ssW51PONW1jNY/TqND25pLcHGCPJKC8N LrWk9z555aYHNE6Ppdb9PD3fwO69E0kvsNjYZunEAdZBtGAD8CtYgjwq5ufloDW9/Nan uPL/cnQuv83SpfL6tafUNfps3CHluqTim5qr33upPK1QIu+OAF3uoQKrAMW/uC2TPlfR H8oBV2c76k2R5Q27L1snNz9kp700JkiMjFMiYHs/sSw8a2LK0tJwA7P3+X5Z4YS/eT06 sDKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gB1VINut; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i8si8850484ejo.309.2022.01.25.00.20.07; Tue, 25 Jan 2022 00:20:31 -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=@linuxfoundation.org header.s=korg header.b=gB1VINut; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3412158AbiAYAgA (ORCPT + 99 others); Mon, 24 Jan 2022 19:36:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2364552AbiAXXsc (ORCPT ); Mon, 24 Jan 2022 18:48:32 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 532DDC07E326; Mon, 24 Jan 2022 13:43:35 -0800 (PST) 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 1A95CB8121C; Mon, 24 Jan 2022 21:43:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 296D2C340E4; Mon, 24 Jan 2022 21:43:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060612; bh=mfblvG5kbnlq85+nsOP4KlAoMqaul5WTuSLJfi8bZrg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gB1VINutbeE6D++QOK0uQDfdN9+j3h0xYDCwvA5cBlWszvPhNbAX3P1JEsQjk3l+t l8ThK7MhrD0QILl0z8qV+JeZIBd9e0hXxGhKuoX9to6Nw4pbt/FYWwoyt30NCT8TcJ Nb04sQiPz6MN047TtBvvIofvdozt8j3YUnRM5K0M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ian Rogers , Alexander Shishkin , Andi Kleen , Jiri Olsa , John Garry , Mark Rutland , Namhyung Kim , Peter Zijlstra , Stephane Eranian , Arnaldo Carvalho de Melo Subject: [PATCH 5.16 1005/1039] perf metric: Fix metric_leader Date: Mon, 24 Jan 2022 19:46:34 +0100 Message-Id: <20220124184159.078107727@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ian Rogers commit d3e2bb4359f70c8b1d09a6f8e2f57240aab0da3f upstream. Multiple events may have a metric_leader to aggregate into. This happens for uncore events where, for example, uncore_imc is expanded into uncore_imc_0, uncore_imc_1, etc. Such events all have the same metric_id and should aggregate into the first event. The change introducing metric_ids had a bug where the metric_id was compared to itself, creating an always true condition. Correct this by comparing the event in the metric_evlist and the metric_leader. Fixes: ec5c5b3d2c21b3f3 ("perf metric: Encode and use metric-id as qualifier") Signed-off-by: Ian Rogers Cc: Alexander Shishkin Cc: Andi Kleen Cc: Jiri Olsa Cc: John Garry Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lore.kernel.org/lkml/20220115062852.1959424-1-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman --- tools/perf/util/metricgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/tools/perf/util/metricgroup.c +++ b/tools/perf/util/metricgroup.c @@ -314,7 +314,7 @@ static int setup_metric_events(struct ha */ metric_id = evsel__metric_id(ev); evlist__for_each_entry_continue(metric_evlist, ev) { - if (!strcmp(evsel__metric_id(metric_events[i]), metric_id)) + if (!strcmp(evsel__metric_id(ev), metric_id)) ev->metric_leader = metric_events[i]; } }