Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3527702pxf; Mon, 15 Mar 2021 11:33:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXOkM0VqbTUM1rpWvf7A6fjzQDF5RC1EkRRpcdQs09idExbnODFNrb0sZzDZaXVoJcgsch X-Received: by 2002:a17:906:d9d1:: with SMTP id qk17mr25079570ejb.52.1615833180361; Mon, 15 Mar 2021 11:33:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615833180; cv=none; d=google.com; s=arc-20160816; b=c+dfaeM/I4WqWpXmbdMQQynSWx3sOqhmw7Re9Ob2NJffpSdUPzjFCXRctDxXb0CTXV K5yVmfn7CfD4zHSt9+BfxOFvYFZRT8tp3uEqeTXYDt/v5sYIcSKEpa1nF16oU8sHoY2y 4c+HFXG8jNzUZiFsoK8oCkrCTBBLv9WsO/bRd1zNePncE/BMPIPSxDjgj6yqgnfsE1wt 3/KjOYy/AJsuqXGHZ1crvs6rKpHlaaLiIDOz1hbyxVqZd8j1uGfj5fE7xR1EmJhKaykM /ir+fYz6ryHaJpCEerK+bz9iixPcqYU4cYO842tAsvZ3CKqh5N52W1a3u0FtuK4ZZXBR 4G3g== 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=IMG5KrJlpwlPZYqEzU+DqmxgIOXC4aljJuvHu6iWWUGfUFLiEt61BKO4uZl7aY1lQN HA7FA0/EfS5NaE3pJlIiwqo7w50aEsbLhTdrZCydieNsG+V/Ih4nlCl6UwxoLzCkVbF8 mKfme1bC17h7RTsuk4C+qsoY8ing6aUuHN1mFhBqiuG1pga37LUwfXCPfB8LDnVCDdwN BOKU6UWXDDGT48PccxzRcke5ck6FEOEdmftf9RwlYmbvidZvXget0xLSNAW9J0P7atR1 wv/HGEZPo+B8ejw4wClST9z4ICsyf7LDqJmNL94UgejAasj/OoLIhlUFZgdWItb3EuEl uz9g== 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 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 w25si11673080eja.753.2021.03.15.11.32.37; Mon, 15 Mar 2021 11:33:00 -0700 (PDT) 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="Rf9/mirK"; 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 S240814AbhCOOi2 (ORCPT + 99 others); Mon, 15 Mar 2021 10:38:28 -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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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);