Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2387452lqp; Sun, 24 Mar 2024 17:11:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV2BvdEmJ9sxwKnRtASOvu6HFPw+vRHtPUmPnE8gaAogLPC/7XkPk7G10qpdAvBzKueUzjBNM2vAOMuL8wI7mULfjytlByxAr3pjpHR+A== X-Google-Smtp-Source: AGHT+IFjt62yqME5VtGWJXkTg1ayNR9R2Ej0tDP+pDTXqxI+KyOp4BAoznibApGWBkQ+HPYgTkuN X-Received: by 2002:a05:6a21:3293:b0:1a3:638f:4fbe with SMTP id yt19-20020a056a21329300b001a3638f4fbemr5372009pzb.42.1711325460754; Sun, 24 Mar 2024 17:11:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711325460; cv=pass; d=google.com; s=arc-20160816; b=0ZZ1PeGlrg8zXZqrN9AbbTry5cA3E2U4NylezHZtZN5se20YFdvP/81i2Y8At6tloq JY9EyiPTyqDT3aJ1k6r8YuSijILMfbvC7v5jDLvlDFbWRpRxVTF6WufsokvbU8DO84pM CiV+bxmSS/yYBOJazeF8itHvBD5QYCMYC452o+al/+bdttdlC3Wl7KMFwMA1zVXM7HD7 i5eUqb3q8qY3PKqkdAa8R76dVkwcWrbVye7AxognXxP8VA6w3h5h8eIYVFFV2ntnjr43 vt4YEmF9x/K8YyGJ+H4wCplbDJMBsqrvx3MPBXRk29w9sCAz+kxVZbkN914Rj1FP9E9L 0MNg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=a65lPhg3yxrdRku5SfJHyUdvKHVeYT6ZBhhLcmOZAfw=; fh=Fc1ZoZ1vTp7JxUZvOdwuMH0+wZ16tuMxS8CO2DXLMx0=; b=PHSZlDUZ+aWekTMfMV76r/VluaW56bvcSA1UjhR+gZOhPFS7W/asV7JSot7daccwNb hI6f3bBpjxeIMni2p/R4XpkBFof4+0/ubSVX3AfoEArbyNBFeLi8NnMuhE5vytWB0VGl rlL/8uCizN75ucLOtBWN0fmKtMUxzbQIn6EwVWOA4m7XMZ6dOZInBrkB+9UjJH1rPDir hGiy6Rgh87GeoyBrzmFqNhCM2a6KyTYC5yYkjwhu6FwBMlvXKDjsIhTr/nZB4B67w/qy /7Yu2ho+HOj90tbJiU1LZTTm8K7X9HWxEUHGHCQnXm8PEjrCYBeGQRJC99lMwjQklir/ 6LcA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sWAqSMIs; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113317-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113317-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id k6-20020a17090a4c8600b0029ff73e6b4fsi6407183pjh.69.2024.03.24.17.11.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 17:11:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113317-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sWAqSMIs; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113317-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113317-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7DAA82823EA for ; Mon, 25 Mar 2024 00:08:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5AA67193FCA; Sun, 24 Mar 2024 22:42:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sWAqSMIs" 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 5D427193FB1; Sun, 24 Mar 2024 22:41:59 +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=1711320119; cv=none; b=RXIFYKUPwv5ig9nevmJe2Bh0Jo3ZuHDsvyrwEtwuq77qvEtWRp/3AYZOgfZDxudMnadExtQlhO1olLel9KU0ZLCkSwZ4KZHfSeFFqKWwZ0CY6dS27xKa3gAYSrIsueuzKzeGyq/Hu8FPzVScKMwluw9W2m7FDAYKqDAFXuMOZ0U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320119; c=relaxed/simple; bh=WpXy2LNVlErVoZaptWzqLxI6KmqPSeSQU3Pgz6DJJ3k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Uu1M0DNmL9G1btSiyM0+Ftsx+YID+RwwDUYgD/OSbg4HaaNQMp7mYQ9lJY33u86DHZSWZopMkXiSwx4fDy8+c0RVjE+pQRhwHoz3KlgwWnHFlOkVuGVM7Glazqd66yhpkW9rh6LlNMZWERFCWazDkeTX9+D9H7FOUpjPAoz/A1c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sWAqSMIs; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4103C433A6; Sun, 24 Mar 2024 22:41:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320118; bh=WpXy2LNVlErVoZaptWzqLxI6KmqPSeSQU3Pgz6DJJ3k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sWAqSMIsHcc08MxhQWa982uH5HtE/qXcypqg7MFJ/ofcN8IgJPdC9SdQWDKRC2l9w KitvpZScrWZLXuZaUVsVcEc4pGxy3Zv/cUMP4zoTkXBmJU6dFokMHe28p3NwPBCBUX B5YG+XpMrxQMr9LDy2T8x/lFduTgdGeGhvs4EHxnExmxL0VA8r4kHjLQWLGvpSSgZI 1FMyv4fed8oLv9WmVt0Goqz/3yRYG3Q43nvaOe615dRRB4NUG+cqJzpHk9gHff0EQb mqA8s3QbhEjhGrYEVDnVvu2bMyn/Y7ok/+DpCDOcSwBfGprFU5Y8+4airiee6IswVk rq2TzC2J9onFg== 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.8 426/715] perf metric: Don't remove scale from counts Date: Sun, 24 Mar 2024 18:30:05 -0400 Message-ID: <20240324223455.1342824-427-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-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: 8bit 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_value") 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 = NAN; source_count = 0; } else { - /* - * If an event was scaled during stat gathering, - * reverse the scale before computing the - * metric. - */ - val = aggr->counts.val * (1.0 / metric_events[i]->scale); + val = aggr->counts.val; source_count = evsel__source_count(metric_events[i]); } } -- 2.43.0