Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3344865pxf; Mon, 15 Mar 2021 07:36:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZeCXPaasCvOKkjiWW0lXFVn8FL4ooQZHCUVSMAI1YPE/TuWJ1s8aL0G9REePfCRBad4B7 X-Received: by 2002:a17:906:130c:: with SMTP id w12mr23866004ejb.253.1615819005849; Mon, 15 Mar 2021 07:36:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615819005; cv=none; d=google.com; s=arc-20160816; b=RNUF3fpTOkX9AQKap3pyhYPEW66Y5u0sboTUmEq1WZGPjnU1XX7gve0jtqAzAecEY8 KBjpMor7eMoqtif/v28Zt++kk/hEqhyvvLOB9mpt0wwN3IUX6ge/5d3twwCodgqrClFI eFV4wfyRaJYwlN6yQtKXoAzp1PcCX7Km5B2dc9VSBpBB8SJBoyKqn/O4GFvNDbHzHjwR iv6GhXb//SSremmnmAbFQEYj+J3lztW7lKAgnWde4OlY0B8aEAzySOGtrgGjOHaKvm8y MHXT0sWnjcH3jLLz26/TuJ/WZOA5TWtNYwWaXNuNe5OjFu1nHJ7kH5fml2cffXSAS6bB 7u5g== 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=VZtGglLRDj1Nzir0V3F5kFuLRBxCJVEK8ER7B6MuW27E3IL2++tpYOIrwp9vn6hf8w BEaJp+KpJrYOJtmELGhEyqX8JwM0T7R0xdjsv8n+Rk77hao0xDYQa62Kr2AFUc7OI+N9 DCqpfgZJG8wk1+KnZrvF8wSauYS8Rd7KTXWGPkChNPmM6r6UHNMzt0h9Ai/dktVOvuPw hAJbuhpG+0FXd43e9OB6mUjYWB/9Oc0DBqoN5IXNVXiLnAsEDTB7vj28BvdkLzjaFhET 0DsXV4b4mFvhJ8A2yUmU9ovEOMQb/l0tIRtftF1FOCgCF19piIqtQMwZ17IRnA4DjKp3 OjSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Q7oVyrgB; 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 cd8si11175986ejb.26.2021.03.15.07.36.23; Mon, 15 Mar 2021 07:36:45 -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=Q7oVyrgB; 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 S236255AbhCOOe4 (ORCPT + 99 others); Mon, 15 Mar 2021 10:34:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:36788 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233442AbhCOOBl (ORCPT ); Mon, 15 Mar 2021 10:01:41 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A87A364F06; Mon, 15 Mar 2021 14:01:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816885; bh=hrGdOrt4gZVGQEqv/sHRyRlydI/WbwDZ6dUGMlUJots=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q7oVyrgBAQTgUEV2LUzVDo3r/UsBxdHYI3T/DsiymS1uFpmbRrUv47/S/pwxZFacc QresNtEc5YaLDOX1P5jxyCiPev7pzUGnLZjAhRn6SkcZf9gnMzDZs7mymrc4CUvUs2 AEx8U612RNZzNYN0xc7mFItDSEtiEyAo2no0ZyPE= 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.11 182/306] arm64: perf: Fix 64-bit event counter read truncation Date: Mon, 15 Mar 2021 14:54:05 +0100 Message-Id: <20210315135513.771484717@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135507.611436477@linuxfoundation.org> References: <20210315135507.611436477@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);