From nobody Fri Dec 19 22:02:04 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6B71B20FAA1; Sun, 24 Mar 2024 23:08:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711321683; cv=none; b=q/BULNpHhJCrWNr1Oj32qiGrgNulA8XmUnxANL7Yhs5ZU9YsNX5IquRSsemFvBtPq6otW7GlNsySHU2tCbXcQEqgaTisfCwvd0/+866682fnFrE9fdUcABm6dT+V1zj3zYkU/5G4etyI3dS10xxitN2+Yetlm4mYaFy3vcwTbb0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711321683; c=relaxed/simple; bh=WpXy2LNVlErVoZaptWzqLxI6KmqPSeSQU3Pgz6DJJ3k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bSx+H3mx3vNTGHZU8eQO7CYz3jnZhkafv/wh2/pLBwco45QcY9CtgJAuCtVzZzuWkIrf0V40E+Xq3O1N1qddVfvq+PyYHA+SH5jHr3NYL+JkdZQAPdY4osOs3i/cC6W2djMp+D3OiJaQ0YxiKQvw+isQVDuKYatBmOCQ1laDb2U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Tgs9rIzV; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Tgs9rIzV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D913BC433C7; Sun, 24 Mar 2024 23:08:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711321682; bh=WpXy2LNVlErVoZaptWzqLxI6KmqPSeSQU3Pgz6DJJ3k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tgs9rIzVWGkjsqVWbUttmzL6xJZ8PeSNvAMJ1ucteQEHiQNBPKlaw3/frLA0z6EGV q3t903BLng+02ELoCCvfmQpVEoq1Lx1RjOOiNuAjzM15vwqPw8KW6/Om7UGqQptiwc x2ghdDszbUlxmBdEA6DeNoNa86NB2Ii7RDBWAPjkPhKCjVJrf46m7f8XbnAvsmLIRs z5Xk9x/lqqX7OwpUYUqodn5OnoVV23c9ykZ+UMCOaPNrf4Zzt0mNxBrDYVQ0lkR5eR H9539C3RS3CPpcIwtqJzlYqCjoZbKtC963DksEtNcsRJrO8G+UEjHpAPm4IjKpX/Gb Ypbniv72XBNDg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ian Rogers , Kan Liang , K Prateek Nayak , James Clark , Kaige Ye , John Garry , Namhyung Kim , Sasha Levin Subject: [PATCH 6.6 410/638] perf metric: Don't remove scale from counts Date: Sun, 24 Mar 2024 18:57:27 -0400 Message-ID: <20240324230116.1348576-411-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324230116.1348576-1-sashal@kernel.org> References: <20240324230116.1348576-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ian Rogers [ Upstream commit 6d6be5eb45b423a37d746d3ee0fd0c78f76ead9f ] Counts were switched from the scaled saved value form to the aggregated count to avoid double accounting. When this happened the removing of scaling for a count should have been removed, however, it wasn't and this wasn't observed as it normally doesn't matter because a counter's scale is 1. A problem was observed with RAPL events that are scaled. Fixes: 37cc8ad77cf8 ("perf metric: Directly use counts rather than saved_va= lue") Signed-off-by: Ian Rogers Reviewed-by: Kan Liang Cc: K Prateek Nayak Cc: James Clark Cc: Kaige Ye Cc: John Garry Signed-off-by: Namhyung Kim Link: https://lore.kernel.org/r/20240209204947.3873294-5-irogers@google.com Signed-off-by: Sasha Levin --- tools/perf/util/stat-shadow.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c index e31426167852a..cf573ff3fa84f 100644 --- a/tools/perf/util/stat-shadow.c +++ b/tools/perf/util/stat-shadow.c @@ -414,12 +414,7 @@ static int prepare_metric(struct evsel **metric_events, val =3D NAN; source_count =3D 0; } else { - /* - * If an event was scaled during stat gathering, - * reverse the scale before computing the - * metric. - */ - val =3D aggr->counts.val * (1.0 / metric_events[i]->scale); + val =3D aggr->counts.val; source_count =3D evsel__source_count(metric_events[i]); } } --=20 2.43.0