Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3697612imu; Mon, 28 Jan 2019 09:13:22 -0800 (PST) X-Google-Smtp-Source: ALg8bN6va9nYgL0gVQy97s1WlpUhEw6t6kbBGL3qOugAH2drgYgphf59I29mMmtqoxidmeLbB9+L X-Received: by 2002:a63:2f86:: with SMTP id v128mr19869612pgv.407.1548695602317; Mon, 28 Jan 2019 09:13:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548695602; cv=none; d=google.com; s=arc-20160816; b=tyiLQAiYTics3Cdrd/M2WbEZHDxLrGGZ1cdsWUGWpKXkhdpO6iqopSeJmSlvVxQqn3 nlDY3tzPX5rZhCdm03LKORqOBJDnAhsR1wGbn/iDvQVexm2wem9qPlmkhRJgGoSW21f6 GBQubzL5aCxcrJpEC62BN9crISixv9TvAER/HTsNw8CuRviuAhtj8PONjqE9Sb3UfNAf f/9JvztPURdvnFSDOXO365gsWMfgZF7TpjK1Prvgapz73xpY+iSVgD3PvgHLeqlB4l2A casmIMQff0LN3N46Z1VhAditqh6LKK7X3mKP+8sSuNW+yAdKcHh203mP/umGM9Qu66Jg AXmA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=e/jzJzz7rD6vSc2k7nTKFpjWzlIGNgojyi2I8rU417Q=; b=K08FFb9AdAkLcjqmZqLPXoBZlRtPH4K0RVpCtBHynq678/e1Vt7P19hYbeyCwN8a7+ gXl8N4qQd23OJoGg2vBDsGVo6n5wce+w51NNUDKSfNX8ZvEPi52P+n8fiE4HJmWXXPck zUMstv3C+I5ehKFw2x8TnLz5twi+h8oQd/sqvKYNwY9SaZVPnh1XxtWuhWua2HvNO7OV kw9/tDXkdi2PvL3NE/Z78ucc1HVaarbtgeF5W2HCb0hLEgPbT2hVivO+tkVzTuMD8rq9 gj0zfI3cG+wV0BL6w6jqzgdBNgZNPJX5fRgIRvImlB7tc5XkyK3bAAFtc1wEwV+ZdMJE Bi7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SyvH5iAY; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 135si32527107pge.572.2019.01.28.09.13.04; Mon, 28 Jan 2019 09:13:22 -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=SyvH5iAY; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732421AbfA1QIf (ORCPT + 99 others); Mon, 28 Jan 2019 11:08:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:60518 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732010AbfA1QIe (ORCPT ); Mon, 28 Jan 2019 11:08:34 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 50B3B2147A; Mon, 28 Jan 2019 16:08:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691713; bh=bsxIhv6WSxRd8h1ynzWvtplwQb6L1ku+lHK8qpuyVE8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SyvH5iAYUDlGEphoBfHSQIYJC3U6ft/7Z/OBkvSxTIq5IdV3LUQL8a9qQICbBrqa+ xyaaWr1CmVB43p1CJr4loExMhHc9fTRX1r0QKF1GSQ0YYsG/m/eufFXndI1Ocwq2uo DLQFIF3Lmt6Ty1nCiFOgX1BxWGO6zZxvYag1PJTc= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Madhavan Srinivasan , Michael Ellerman , Sasha Levin , linuxppc-dev@lists.ozlabs.org Subject: [PATCH AUTOSEL 4.19 195/258] powerpc/perf: Fix thresholding counter data for unknown type Date: Mon, 28 Jan 2019 10:58:21 -0500 Message-Id: <20190128155924.51521-195-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Madhavan Srinivasan [ 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