Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp183628pxx; Wed, 28 Oct 2020 01:59:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKXhRXWuguISl2rZ/FbFK9qYWI6O3V/sT2eWmyObTvXPn8QQIlcERiyoP7xd//YRiP3g/1 X-Received: by 2002:a17:906:7210:: with SMTP id m16mr6882932ejk.490.1603875592718; Wed, 28 Oct 2020 01:59:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603875592; cv=none; d=google.com; s=arc-20160816; b=FmUrtE+jBwBuNa88sS87OcSggnUw+mIPfoi8z1O2L/z0dKZdJTjuuYzq5UKCVRUobd 0pPW6dIsU9KPoM3fIBVi1B3SceRsqRxaq7Q+7H1Ek5u/FATqnWF1ch0us02VlhFmVRUM rPx73p6ai2A8eDSv2BTVNtsUMyNr0lGkIdX9fEKzhJnR6rKfGHdakN9Com4Avjw6w3QR 3TQ3gEU/N3RQJ/QR6I9BSFvdOTb+2zwXELyNUsExX5vI30pr94ssmTwJkrz5TUovMe9l 6ck3DHgrfArnKTx5kM+290znWQq6+YIyq3kwFKDHkEVPKEKgAgwk29vZSDdZMJdHQ5S1 fYZA== 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=0ALxfx8jyJC0mP4eIyu/iyATQzMM8oLx0O8qcrmhvYI=; b=ZpXtf4vk6DszhZ/LbV0Lyxi/YCfDZU05wT/Gk85aQr1LzAd6zFnlm5i55yCRNCVlBP zYBolcjgv1H1OTzn/sCs5shgz1dVO3tvZ4wHCVY3Cz71wI8+8TID+oK1BRl801/thldH 3ZNzTfwJKuf24dtuzVNszjX2IsWNOy8FRUJAu+5Dh17e52dyDMzMC88EF36+2pSR8Qui Y6AbWYmuOnPOu4pPRjNV6gRE4L6unVuUATg8tyQZXUDUcNtawDCpfTZ5WySdfsAkA3QK HuYQr1ylrIj5LdlXqIhc9zQtnAMUnHOHk3cwUkrIHF31lQWKZY6iJyOzq57nZbgLbzYN p+bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=q6rMezRS; 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 g8si3473416ejm.389.2020.10.28.01.59.30; Wed, 28 Oct 2020 01:59:52 -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=q6rMezRS; 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 S1756678AbgJ0OOq (ORCPT + 99 others); Tue, 27 Oct 2020 10:14:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:54554 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754586AbgJ0OGN (ORCPT ); Tue, 27 Oct 2020 10:06:13 -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 128FE22263; Tue, 27 Oct 2020 14:06:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807572; bh=DyCgUOFpaWcwbYt0cV0sZrNWU3pAUTkWcI7SnqIxwEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q6rMezRSQZjKFZ8Nar10aKajZyt9yd6EivnjJo0Y0phinbB5B81sSK1gwtI8HSpg4 qccveo9YfcTuGLKwGe3Q3KRq37FhokO3KY8jqNqcp1ZLJtzzqnmQfIwhj41gzkoJOJ mM9BywUkV4KNd1vuI+iR+ppKzGeMZ1V0H5hPT8o8= 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 4.9 071/139] powerpc/perf: Exclude pmc5/6 from the irrelevant PMU group constraints Date: Tue, 27 Oct 2020 14:49:25 +0100 Message-Id: <20201027134905.489840573@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134902.130312227@linuxfoundation.org> References: <20201027134902.130312227@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 6143c99f3ec50..7592a6491a9a2 100644 --- a/arch/powerpc/perf/isa207-common.c +++ b/arch/powerpc/perf/isa207-common.c @@ -51,6 +51,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) { @@ -111,6 +120,7 @@ int isa207_get_constraint(u64 event, unsigned long *maskp, unsigned long *valp) value |= CNST_THRESH_VAL(event >> EVENT_THRESH_SHIFT); } +ebb_bhrb: if (!pmc && ebb) /* EBB events must specify the PMC */ return -1; -- 2.25.1