Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp348292pxj; Thu, 20 May 2021 10:41:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz851tt6VYsTb5JX0ykoS0nnQg3rskSM/G/MIO5rmzx4xu3OV+7eJl6l6clGexj19U0/TPV X-Received: by 2002:a17:906:c9d8:: with SMTP id hk24mr5891646ejb.480.1621532472021; Thu, 20 May 2021 10:41:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621532472; cv=none; d=google.com; s=arc-20160816; b=SVsg9ZAIKvP1J15V4gGZHCmEIRs+MavSA00a175fRFmIdT8NPws1fb5CJjjp9ouIc/ VDgo1+smDsFa2igd8zsSLL8oMhmw0lNjfMtuebMkLrMAqNwpJNzk74o0zQthndyWU6EU jBPzK60l/jaepDRDo5Vu1seUqnzPsyEHJmiWGW6E0+TZj87NxfHflY3dMK77s9BwCu9v RJmNmgiGVOFtd+kywVNWlinqn690Uer+qjVIQkVm9aBiGE4L5XZ2TBDgBeqZUJVIXlLS 9MFKfSvth9+YxrgoiCPBbaVBk9FVxlYrILg+YWno6LD+4tzeqaYikVl7b690CiEZ+oLb mjuA== 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=7KqF0U2Ybh5wLUQ/BOPYWRBwhwSZjRuKPJcNrMbCEo0=; b=qxVIqGbXCJVLvPxHRF67ZQwZ26zgCsr5OMr/4kwIwgK9T9wdGoqxbRtsuoIJJedJQN 9n9BLzp3XLv7q+QlI7nRk6Zn5XCHXnJ3j171P837Jmq/1an2+v297uhONKHSriHL/ioE LNAdqXWCc50nQgj7WLfLZxqgdKBjsfdVr+IbviBhw1IlOljVPpsc4oDDj8YLYy+Ici6X 1p+rAI1QmzmKEffKYKofecp5IM6R6kcXcQkk35GGjlRyXGeVvdcjqb76pAuN4YinO6Kv 2g5qYr86kevJHXCeOeHYJE4XotNPufD1twzXwhtKluwLL8Yn2NQJnRbIDwfzHZDVua00 O61g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="d/Cp0qFe"; 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 k4si2815289edv.523.2021.05.20.10.40.48; Thu, 20 May 2021 10:41:12 -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="d/Cp0qFe"; 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 S235536AbhETKJA (ORCPT + 99 others); Thu, 20 May 2021 06:09:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:38312 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234768AbhETKDF (ORCPT ); Thu, 20 May 2021 06:03:05 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EE66661933; Thu, 20 May 2021 09:39:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621503599; bh=4Jik7zxV7ZNsrd2/Sw5Gr0wlzfCq4fKtjNFpy1FmCHA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d/Cp0qFeft7Sf4lwY+8moEjVfkgdOmzvl29d8UpUnmB5w+OABgHTSizCT09zw9BoB EZwZQ48NV6WU2TaZYrw2Ji711/XjZ88pvtlics7JxPOgs7mtcevTcfOFFxG71l0RLM +2upjw8/3xT/Z8LjeUhJ3nNZjyP8OshrGPgEH9fQ= 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.19 260/425] powerpc/perf: Fix PMU constraint check for EBB events Date: Thu, 20 May 2021 11:20:29 +0200 Message-Id: <20210520092139.998328502@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092131.308959589@linuxfoundation.org> References: <20210520092131.308959589@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 69a2dc2b16cf..a1ff4142cc6a 100644 --- a/arch/powerpc/perf/isa207-common.c +++ b/arch/powerpc/perf/isa207-common.c @@ -359,8 +359,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