From patchwork Mon Mar 15 13:54:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 400459 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp3461420jai; Mon, 15 Mar 2021 07:15:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPd817Ael3kW5yi3a/bJIqRr98O3Tw/vQCywyz2DbELXbnqLViPzYrzqehIYz60BKBO85T X-Received: by 2002:a17:906:30da:: with SMTP id b26mr23758962ejb.376.1615817670935; Mon, 15 Mar 2021 07:14:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615817670; cv=none; d=google.com; s=arc-20160816; b=CyA2h10GcTdiB0NVDvYb5nEFra/HbvJlikjVHcbdweaOkhneDmTCb2a/zmPzl2M1S2 9XpPUm276YEdOGb0/tXPguh98hPriPhVusjHVc6zcsbVK2SGaXVPEyJXd/fHv/EECR29 uzPuT6Ca6RQtufsDHObTUOTF711kmfs3cHslvwpHzzXfuDLR/6rMgED3MVmSK/dJvdCF 8flHw9VY1XkxNDN55DJo0gxLf2bdWTvIeXngSawm/tCO75C8H884/DlklgFsffu56HV5 ZTfDKAmBfLxHPu+yFmm498IoHg6+MdQ4e+2rNh/zBvi2OyIOCJXh+UVz8PllRSjpO6t2 VX1A== 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=3vsGZ56bd4ZC5b5+8bAlc/EHkfOQ5hyCyWOeDGSWez8=; b=abUI0l64sS1Ek+1rAyhV8ZCu2xmijHPyJm6fi6A6zju35iUiLf67IheU9eucuF9lu5 MV8H+kNxJrhBhoFGIRacVJ5SxwrTr7cxZo+sMkj3YUGu2i/nmzwMuhJjbi22OGC4aa0y x/Plppi6BL8euJWICAiFJq0bUmOadE7lRB6v5AlsBos1QlVkar6sL9M6p50acwiBszQb qbXpMLfOcYR7eu0SHem7FSdMD7KeLBqlhTOCZeFiG3rd4xO3SDShh0YmJYJOxUXp0srj Z4lQ/g1y5sAVKBGtyelY8nPMLXKS6GyhP13NXK2obK6LwEJ2BC88nBb5URMhm2nxoUBT U4pQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Rf9/mirK"; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 h21si993553ede.37.2021.03.15.07.14.30; Mon, 15 Mar 2021 07:14:30 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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="Rf9/mirK"; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 S235073AbhCOOHD (ORCPT + 12 others); Mon, 15 Mar 2021 10:07:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:48770 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233561AbhCOOCC (ORCPT ); Mon, 15 Mar 2021 10:02:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 63EC664EED; Mon, 15 Mar 2021 14:01:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816921; bh=hrGdOrt4gZVGQEqv/sHRyRlydI/WbwDZ6dUGMlUJots=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rf9/mirK/o4C9xXZlHYASH0EP8lN0XpHPo7pT+CHr0REsHO7bPeLUyQDTFSwsEW9E gWSJ8aOkQlyBEYuW0x+Z9WZ8LP86divrNOVLi54+szXRDhyzygBoLSZOv50Ca4jqAa QkT1lwP/IChUf0Z7QvfbEn4I/YP/CQ/gCQuD7RfQ= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexandru Elisei , Julien Thierry , Mark Rutland , Will Deacon , Catalin Marinas , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Rob Herring Subject: [PATCH 5.10 188/290] arm64: perf: Fix 64-bit event counter read truncation Date: Mon, 15 Mar 2021 14:54:41 +0100 Message-Id: <20210315135548.267672279@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135541.921894249@linuxfoundation.org> References: <20210315135541.921894249@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Greg Kroah-Hartman From: Rob Herring commit 7bb8bc6eb550116c504fb25af8678b9d7ca2abc5 upstream. Commit 0fdf1bb75953 ("arm64: perf: Avoid PMXEV* indirection") changed armv8pmu_read_evcntr() to return a u32 instead of u64. The result is silent truncation of the event counter when using 64-bit counters. Given the offending commit appears to have passed thru several folks, it seems likely this was a bad rebase after v8.5 PMU 64-bit counters landed. Cc: Alexandru Elisei Cc: Julien Thierry Cc: Mark Rutland Cc: Will Deacon Cc: Catalin Marinas Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Arnaldo Carvalho de Melo Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Namhyung Kim Cc: Fixes: 0fdf1bb75953 ("arm64: perf: Avoid PMXEV* indirection") Signed-off-by: Rob Herring Acked-by: Mark Rutland Reviewed-by: Alexandru Elisei Link: https://lore.kernel.org/r/20210310004412.1450128-1-robh@kernel.org Signed-off-by: Will Deacon Signed-off-by: Greg Kroah-Hartman --- arch/arm64/kernel/perf_event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/arm64/kernel/perf_event.c +++ b/arch/arm64/kernel/perf_event.c @@ -460,7 +460,7 @@ static inline int armv8pmu_counter_has_o return pmnc & BIT(ARMV8_IDX_TO_COUNTER(idx)); } -static inline u32 armv8pmu_read_evcntr(int idx) +static inline u64 armv8pmu_read_evcntr(int idx) { u32 counter = ARMV8_IDX_TO_COUNTER(idx);