Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2685724imj; Mon, 11 Feb 2019 07:01:51 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ2g61uiqvrrVWNW1jKxjGo2I8Ykmoi9pzcFst7y1ARaP31YTA5Y3PWupY/X8Puu2oYrJdm X-Received: by 2002:aa7:83c5:: with SMTP id j5mr29572915pfn.21.1549897311491; Mon, 11 Feb 2019 07:01:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549897311; cv=none; d=google.com; s=arc-20160816; b=AbKaPKbh3ePv1JDpGJjUdwY4UcH7nJgLwY6A6RmDyFgaPj8mdu6O6gtJkIsQxpkBEi bR52fi6nYGTxrDwxBXRBq+Evmz6bRq5u+WHdfGgR/5eS8+BE6ypGsLhhncd8G3JcgOxV eRdStAA62coWpfCtC6/CWIfU/gvswezFBakucP4xdUolsztxEwaoWXYubT9ScAWOPusR Mpw2y6D/zBR+bgj58P3bkDrnaGkdqRBzpFRuMlBRC/OjItdKIl9wtYXDT9PcCm9MzcTI 1PQlblW+lRE5C7Cz7e15+B1q5GizXzfFVlWf4Nqf8LVHf+o6Siy9Ex2iXlyrF9Pkx9Sn Wr/A== 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=0r4XYEnk84ArnXQDcYrBiwvOUEJFB8d0HEmeZ9yrvH4=; b=hHDx6HmYi9MQau9E3Z9pCVbyN3wZHaZrFmSouaD5ISMccVCbG3uQ+RKx5eVwczU2sX jjijSqB3w47mdPsilBS7zE0Vz6FSZ2F4LMkqmN4nOteymbi4IbuABt6eYT8KAu7hR6Rg Kqh2u8crrY/I9tDK5dC/+h6EQibWdxVWTRaKNY06QiZ/Mf794gz9bQkyfb2y9dK9ibfr 5cO0Zo1BQkmiPGtTinRcyhGUYo64xeGEcBOxmERm6/4s2QR8+FpSqbxUe2Mzc2bUx3Dr Oiywh96/9O9aPgMKvJ462d/NznC078Ymaks4ZOO+KgML4C/vB/W8LcxmmUH96uAquj+n uUug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="W5mkGQ/b"; 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 c5si3940286pgq.434.2019.02.11.07.01.31; Mon, 11 Feb 2019 07:01:51 -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="W5mkGQ/b"; 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 S2390044AbfBKPAg (ORCPT + 99 others); Mon, 11 Feb 2019 10:00:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:48528 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390031AbfBKPAe (ORCPT ); Mon, 11 Feb 2019 10:00:34 -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 1E4CB222AE; Mon, 11 Feb 2019 15:00:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549897233; bh=JZ15upKq5GV11p6Kza8as75GpvOQIMIw6TjyJ12DgKE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W5mkGQ/bHk13gi6gkHWRTjwYcB68YnYwNrUwND8JHtrryePXW8fgakoHka08O25jw JEtfzE9cm+ZkHKnhakCRZh4BYJajGQ+V4Y2ETZ7LRUwULZ7IB3p0Mdy8wBmdKym8BH IjfSS55plXQFctHfbzJlDnR6WIjwKec1fvQFD5RM= 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.14 117/205] powerpc/perf: Fix thresholding counter data for unknown type Date: Mon, 11 Feb 2019 15:18:35 +0100 Message-Id: <20190211141836.120672982@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141827.214852402@linuxfoundation.org> References: <20190211141827.214852402@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.14-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 2efee3f196f5..cf9c35aa0cf4 100644 --- a/arch/powerpc/perf/isa207-common.c +++ b/arch/powerpc/perf/isa207-common.c @@ -228,8 +228,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