Received: by 2002:a05:6520:4211:b029:f4:110d:56bc with SMTP id o17csp2121450lkv; Thu, 20 May 2021 03:55:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyuK9UEn1e9FICt2KExZvWZOeSiFfYJJQAnobuD6oF3SZIY7KE00tlGiqTlmlA43lPbxov0 X-Received: by 2002:a17:907:3f28:: with SMTP id hq40mr4104092ejc.283.1621508147146; Thu, 20 May 2021 03:55:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621508147; cv=none; d=google.com; s=arc-20160816; b=wWdKMcoYrSL+XV5MLQXdXwAyfLRiwm2qJaUbWJ0bhdH79/oEtu2AU5+JfGXBM48FmA +3gIhHMQnlho03MraJdxsaOJTDjlHaYH+lz3Tm8i2o3LHgiSJyihmixugFDN5K251nDr tCRSnwMuPYjmkXL13wcv/aeesnJpA1cowielRb2oLjPvKFoshbb98qAhPQsuV5PzndKL SL0uGU/Y0suVHRF+GdzB6blxnMLuW7qJRnHuR0XtrMDUCf7fmjv9STRF7dYr8MXwbZ4l agT66FprvFyQAfvSUvDkUsLnBpua9tEM8QtpajExv7ZPY+k6wfPsTT3EqpuChrBnnsR2 Dtow== 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=Ch3pcrx1waPbSh6oHrDo+ZYTf95aewSQA8w5YQXGQdI=; b=qmEpmEh7M7U65FdsxjhDuAmc4q7jMj1kcYJ33Mo/PYDRrql/RE/HGrTcVu7gzP2JVA 20olrD4jgowsbtjHfa+g7XiDjyaqnxyIb35oFslpKDhktz+XqSMUsUkTQmiT1Ggz9AAt qqUf4ue5UAqp/Ig7QzbKsoLrUVayp5Il8ZFPz605iv3WPcbWMkWH8CVUvT/9SmQfjU5m Zj9nC3S7G3Js7T66U2Tia/TIQfL+sdu9PkxZixXLxa4mqjOoebDnw0cQFmgoHBdaodr4 qYefDGRi5GHXKtN6rx90+uJ0miNF5eD7UzZAW/unt9Shgrp+Fa3ppkSlNDkfaIhDuGaS LUsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BTQE3Dyi; 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=pass (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 y13si2168326edc.322.2021.05.20.03.55.10; Thu, 20 May 2021 03:55:47 -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=@linuxfoundation.org header.s=korg header.b=BTQE3Dyi; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235421AbhETKvP (ORCPT + 99 others); Thu, 20 May 2021 06:51:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:39794 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237799AbhETKff (ORCPT ); Thu, 20 May 2021 06:35:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3A36E61C59; Thu, 20 May 2021 09:53:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504424; bh=i4GkmynJrwPHyYe9W9m/4kHJneG8Mr0zODmlFXvQtnE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BTQE3DyidVJydvvlsmvHGqEAv2yintu1L7ke+psOAhlfBTUfXBSp7KYDG8gnKeADY BUzSRDzHoiGQUpPtRci+kDmfwmRAc4k5Sl8vcOoASVmpGATqP9DiDmtY342mDX7meh tpa3DRjvS80GtMW2AkbmCFzT19kuJTrirBA4CTfc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thadeu Lima de Souza Cascardo , Athira Rajeev , Michael Ellerman , Sasha Levin Subject: [PATCH 4.14 205/323] powerpc/perf: Fix PMU constraint check for EBB events Date: Thu, 20 May 2021 11:21:37 +0200 Message-Id: <20210520092127.154247517@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@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 10f8f96179ecc7f69c927f6d231f6d02736cea83 ] The power PMU group constraints includes check for EBB events to make sure all events in a group must agree on EBB. This will prevent scheduling EBB and non-EBB events together. But in the existing check, settings for constraint mask and value is interchanged. Patch fixes the same. Before the patch, PMU selftest "cpu_event_pinned_vs_ebb_test" fails with below in dmesg logs. This happens because EBB event gets enabled along with a non-EBB cpu event. [35600.453346] cpu_event_pinne[41326]: illegal instruction (4) at 10004a18 nip 10004a18 lr 100049f8 code 1 in cpu_event_pinned_vs_ebb_test[10000000+10000] Test results after the patch: $ ./pmu/ebb/cpu_event_pinned_vs_ebb_test test: cpu_event_pinned_vs_ebb tags: git_version:v5.12-rc5-93-gf28c3125acd3-dirty Binding to cpu 8 EBB Handler is at 0x100050c8 read error on event 0x7fffe6bd4040! PM_RUN_INST_CMPL: result 9872 running/enabled 37930432 success: cpu_event_pinned_vs_ebb This bug was hidden by other logic until commit 1908dc911792 (perf: Tweak perf_event_attr::exclusive semantics). Fixes: 4df489991182 ("powerpc/perf: Add power8 EBB support") Reported-by: Thadeu Lima de Souza Cascardo Signed-off-by: Athira Rajeev [mpe: Mention commit 1908dc911792] Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/1617725761-1464-1-git-send-email-atrajeev@linux.vnet.ibm.com Signed-off-by: Sasha Levin --- arch/powerpc/perf/isa207-common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/perf/isa207-common.c b/arch/powerpc/perf/isa207-common.c index dd9f88fed63c..24a78565bca6 100644 --- a/arch/powerpc/perf/isa207-common.c +++ b/arch/powerpc/perf/isa207-common.c @@ -361,8 +361,8 @@ ebb_bhrb: * EBB events are pinned & exclusive, so this should never actually * hit, but we leave it as a fallback in case. */ - mask |= CNST_EBB_VAL(ebb); - value |= CNST_EBB_MASK; + mask |= CNST_EBB_MASK; + value |= CNST_EBB_VAL(ebb); *maskp = mask; *valp = value; -- 2.30.2