Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2756378imj; Mon, 11 Feb 2019 08:02:12 -0800 (PST) X-Google-Smtp-Source: AHgI3IYNWppqznhKADujgPLNUNa5Dn5u+zfzbpxhLZl6qU0ISnCzZ5PUNWE5KL/bwxsdR1YZOwIp X-Received: by 2002:a63:374e:: with SMTP id g14mr34755172pgn.59.1549900932654; Mon, 11 Feb 2019 08:02:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549900932; cv=none; d=google.com; s=arc-20160816; b=WS6XnRJYbeCyr5vcCoDrB02hRHLwq2G8sIcNn4qIYNFigW7GqIJD4axCJ2HUcXSO79 HqzXS3T0VUWOVoQ919iP8fI9UNdgpRc3D7pGMhfGQP3PYJPC+kTUGNMokiavkkqb/fMz m6bDGhYZIK0mdZvjJzuS0fEQEsYCIiyO+DV7+OrfaHQJha2w12y4Q7pixhsqu08sFUB+ gLQMTaXLpOoEYktZ9gRVHRqa9SWpQtAqtVONN1PuU9DqEyb94L9oq8y+ktbXTydVQmBM xB0Dc8dEKw3ImHb3v6w0h8gLxkQ7+GiI8y2DkoK7AEQammx6pFSglaGO1o+pOhBYhQ4z neKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+I+XTorL0YtIl5Dis8JjWJQrxX2Lq6gZ91Hzl7NibrQ=; b=doqjSrvY57a9E6D5f0CUg3/XDyEpCLzrpwqnxCz4iEcHOXR0JBKb84FB9hV2o4El6o gia0ANLd7HwHN/zGarJgkm4DatlwNlE9nN6N2faC0Oc4CIcm7glPDiNtxViHMoScWRJB kJ+Z4k9m4xvhS6J5Hr3DFbzfYEbdDTTT5cxNCoTc0WQslbC2279TlIY2MAF5+i44rCZh +vRTgq0HaTwV4wb9MD25R7PUUwdNLhj6XgehoycF3zWdRY906ysBBU0205XgyFJw6W++ SI6wOnZXnBo4XjwawHn7VG55Sym3RTyWlckeR2xvqorcPh8aLZpyDgAgbz81vutQMeee KqXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="lLX8u/sS"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 141si10488925pfb.227.2019.02.11.08.01.54; Mon, 11 Feb 2019 08:02:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="lLX8u/sS"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729985AbfBKOb3 (ORCPT + 99 others); Mon, 11 Feb 2019 09:31:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:38294 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730299AbfBKOb0 (ORCPT ); Mon, 11 Feb 2019 09:31:26 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F22EB20838; Mon, 11 Feb 2019 14:31:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895485; bh=h0NU2CXX2SBuxWnLUKKMyJ3Cbu0wVEzzqYhn9rNmJKE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lLX8u/sSkfBastXiSO+dTJxiOGpyuTqAhOqgeNIIausu5wldorqFs3xnkc3yWBseE hwrE2OYQya1YzZw1Q8abN9EdCY2hufDYDtdYCE1UW1j3moe+uXIq7nPgdrptHozmQz P2cMVPUK6JI3geGOElXfaJjP1VOYuyEcahsvLUdU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Madhavan Srinivasan , Michael Ellerman , Sasha Levin Subject: [PATCH 4.20 221/352] powerpc/perf: Fix thresholding counter data for unknown type Date: Mon, 11 Feb 2019 15:17:28 +0100 Message-Id: <20190211141901.290154563@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 17cfccc91545682513541924245abb876d296063 ] MMCRA[34:36] and MMCRA[38:44] expose the thresholding counter value. Thresholding counter can be used to count latency cycles such as load miss to reload. But threshold counter value is not relevant when the sampled instruction type is unknown or reserved. Patch to fix the thresholding counter value to zero when sampled instruction type is unknown or reserved. Fixes: 170a315f41c6('powerpc/perf: Support to export MMCRA[TEC*] field to userspace') Signed-off-by: Madhavan Srinivasan Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin --- arch/powerpc/perf/isa207-common.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/perf/isa207-common.c b/arch/powerpc/perf/isa207-common.c index 177de814286f..6a2f65d3d088 100644 --- a/arch/powerpc/perf/isa207-common.c +++ b/arch/powerpc/perf/isa207-common.c @@ -226,8 +226,13 @@ void isa207_get_mem_weight(u64 *weight) u64 mmcra = mfspr(SPRN_MMCRA); u64 exp = MMCRA_THR_CTR_EXP(mmcra); u64 mantissa = MMCRA_THR_CTR_MANT(mmcra); + u64 sier = mfspr(SPRN_SIER); + u64 val = (sier & ISA207_SIER_TYPE_MASK) >> ISA207_SIER_TYPE_SHIFT; - *weight = mantissa << (2 * exp); + if (val == 0 || val == 7) + *weight = 0; + else + *weight = mantissa << (2 * exp); } int isa207_get_constraint(u64 event, unsigned long *maskp, unsigned long *valp) -- 2.19.1