Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp279630pxx; Wed, 28 Oct 2020 04:53:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQ9z+tdrOQEkdcw6G30bMP1FlP04JhudVwho1x5ULwcexq53AUunNqmMM2kBbNLx0Hi5D8 X-Received: by 2002:aa7:d9ce:: with SMTP id v14mr7357794eds.203.1603886009461; Wed, 28 Oct 2020 04:53:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603886009; cv=none; d=google.com; s=arc-20160816; b=OeV5N7LhucThohyHT5suFW2EebeqrtYUw2coMV6Pr+3d6FThMrkHwCuda9NGr3+sys +0OLF7OkxSB+urwgj75mdTMXkVOznKvxk5AU1EobIQTkeEujzer8whiD1fRLDmvp3BlW DNt4fLt7LA8o2DqVgRjhx9x/a1e5VlJkspGe9RtYsgRRI7PGmf8HDUulkkKUZEJxYpjO CZbQSy5WJiV0RiaxIu0sXgidFwgP8fxDS3DX++5X5OZ+xnYI7GFufQV+3AGUztT01HM4 sOsZ6IqZ/uAXNzW9pq3Eyv7KnX22sCbS6qpPuJcu56K6z4xdIgmrATMcIQCVJMtslDnh frvQ== 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=YwMAiE9L2u3MwjhsfH2C5mr0I9bRObdUuMqtzSE6UeY=; b=UEFhCPQmTtyJCFfEPoHQvXRJ6PztTnVloHw79eQqBzzNN/4PDkDyCfA0NuHi8mPfz2 cD1kqj/8iFPgw+KCZy+ouMdQMWYX/+6DrUp+Z6cjFWGbwh1cUYO3qbtaWG2tf694uR85 GGgDFUezFVrUXoPBTTx/VUPUK+KirZXqWNw5Reuic+nvoJ+lERzBAd0kwf79QapBa4gj GtDCPbcmTe2ryoZDAHGXBtTmS/1iqn9QUxm8D8ta1GX8iUwVQDOV5bfD1xn8ThyPeaY6 inVH67HQVO+LnE5ezmJkzad/NlKV7MJVsafr7ydAsVaVe07mPaNjZIYBmA/7ZRz8G7ks Rc3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Onofla2Z; 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=fail (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 i19si2816688ejh.153.2020.10.28.04.53.06; Wed, 28 Oct 2020 04:53:29 -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=@kernel.org header.s=default header.b=Onofla2Z; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1794716AbgJ0PNL (ORCPT + 99 others); Tue, 27 Oct 2020 11:13:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:40384 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1793164AbgJ0PGP (ORCPT ); Tue, 27 Oct 2020 11:06:15 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 1B81B206E5; Tue, 27 Oct 2020 15:06:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603811174; bh=xPTYDqcKFPNokPQ4YG2zVjKrCaVG4vsCuNK5PQRUCM4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Onofla2ZqIN/N1RFMhKjOA+bnP1ozV3eTuey7PFQPgzOlutB8PsZNHuNgv+mBc0uU lnKoS/EZrLAkPF3kCzi55kkB2v7EAI/nxLfXYnSXt8jHwpVLFU/lPSkW6yzq2lWBpy YHq+VV0oyWibZydmhsh/Clsx38sLI22JSSDbAENU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Athira Rajeev , Madhavan Srinivasan , Michael Ellerman , Sasha Levin Subject: [PATCH 5.8 399/633] powerpc/perf: Exclude pmc5/6 from the irrelevant PMU group constraints Date: Tue, 27 Oct 2020 14:52:22 +0100 Message-Id: <20201027135541.429691096@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@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: Athira Rajeev [ Upstream commit 3b6c3adbb2fa42749c3d38cfc4d4d0b7e096bb7b ] PMU counter support functions enforces event constraints for group of events to check if all events in a group can be monitored. Incase of event codes using PMC5 and PMC6 ( 500fa and 600f4 respectively ), not all constraints are applicable, say the threshold or sample bits. But current code includes pmc5 and pmc6 in some group constraints (like IC_DC Qualifier bits) which is actually not applicable and hence results in those events not getting counted when scheduled along with group of other events. Patch fixes this by excluding PMC5/6 from constraints which are not relevant for it. Fixes: 7ffd948 ("powerpc/perf: factor out power8 pmu functions") Signed-off-by: Athira Rajeev Reviewed-by: Madhavan Srinivasan Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/1600672204-1610-1-git-send-email-atrajeev@linux.vnet.ibm.com Signed-off-by: Sasha Levin --- arch/powerpc/perf/isa207-common.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/powerpc/perf/isa207-common.c b/arch/powerpc/perf/isa207-common.c index 4c86da5eb28ab..0b5c8f4fbdbfd 100644 --- a/arch/powerpc/perf/isa207-common.c +++ b/arch/powerpc/perf/isa207-common.c @@ -269,6 +269,15 @@ int isa207_get_constraint(u64 event, unsigned long *maskp, unsigned long *valp) mask |= CNST_PMC_MASK(pmc); value |= CNST_PMC_VAL(pmc); + + /* + * PMC5 and PMC6 are used to count cycles and instructions and + * they do not support most of the constraint bits. Add a check + * to exclude PMC5/6 from most of the constraints except for + * EBB/BHRB. + */ + if (pmc >= 5) + goto ebb_bhrb; } if (pmc <= 4) { @@ -335,6 +344,7 @@ int isa207_get_constraint(u64 event, unsigned long *maskp, unsigned long *valp) } } +ebb_bhrb: if (!pmc && ebb) /* EBB events must specify the PMC */ return -1; -- 2.25.1