From patchwork Mon Mar 15 13:54:05 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: 400456 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp3460343jai; Mon, 15 Mar 2021 07:14:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEsGv9ittC2Yoicb2qKTo5EinzuAbj9rSRRbVy1UKFnliVQYPCFwxjeXOgqLToyqFCl1YC X-Received: by 2002:aa7:cb90:: with SMTP id r16mr30810037edt.139.1615817608068; Mon, 15 Mar 2021 07:13:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615817608; cv=none; d=google.com; s=arc-20160816; b=BxdHUDVyIhGhfKBhMvh2JEEpfazqDMkB8j2nN27ogBXfbpt2UUT8ndEU/bhJW4LzLY hFuOyQOPhl5q5kVD3LDlRph19NyIScxNm0LfcVfWOEekrQ6YhA4qwR8Lr7g+uOQU685m Lxaskjxw6QpPxW6J3ZN6vbpQEda5BvdDMX2NdGsK3BaitlKBRHCAQJDoq9jCpMocLmW0 qIFyFfg8MR0XKckhJZB1dfLHHy+UqoBrfNLb3ung3nGc+N1hncdgVUzniV4fyrXQNfal vDC4YvwqNlHHbY2DSID930jmo22t68E/Gop+YUgn5gXMxgdxTytmUoGW8i8LsNqZRTQb p9Ug== 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=RpGMcq01XHwT/ZjX+8J99X6by7jHDnSmiKboMMOO0Mv4qEUXkgWKdJ1jxCgE7InAF6 EhiELfa2tt7x5S8RRTcvtc1sfYGAVFjuS1A5bM509RFCFOAezLefgMa2ftjghSq0Dd8C SRG36DQHWzKzc7tuBRA+ar1sARplNkXyaKVEJQwVzKIVJ8enXGTdH4eXJrlddeIjNYbT TGDg9GUuMytfp40mGlCiEw4PAkZomQp9tbQHigTNqH3NqZ8CV49Djr3hTDJgzRp5X4Wh e7uCmjwNmgWa/zi0eI0I8cew3WnoPgwZJ8aycLU/O42e2Dfd1ry/Zk5Q3FxjO8ghE/Vx nGuQ== 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 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.13.27; Mon, 15 Mar 2021 07:13:28 -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=Q7oVyrgB; 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 S230290AbhCOOGO (ORCPT + 12 others); Mon, 15 Mar 2021 10:06:14 -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 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);