Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1777658pxj; Fri, 18 Jun 2021 15:27:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5bhL2jwBBcyBNOfHDul96Egpl1WWvI3Mx346EqAwFT9jXcuatDiRdA+3aeLxFZ1vJPSD9 X-Received: by 2002:a5d:94ce:: with SMTP id y14mr10157975ior.67.1624055259199; Fri, 18 Jun 2021 15:27:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624055259; cv=none; d=google.com; s=arc-20160816; b=M8EUz8pH57aG44P+M3zMPUP+idX0O2JFyZTBhAY+ie++5tkaG0ApgsQ+BkYQGU3AwR E5eSO17ZUWFcRwQuY0rgs3YFdL8nA2Y33ZI0KCL/jC/QRi8FV2L7JLNDw3RPArsptHxt otdFRyKOg0b0ColwTEULfOmGXKJicsXyBNpABauaKAuuc/Io5UWfzwrFN/y78dB3RBzv Md9K0jaGvOx5EtRsaqdHuxCBnPYhLKn3Oh6yOPWnY0jVIGaasP4C2HcZacjztnMbtoDz djPT4xXExm8NRqOlngosyYNS4V8P6r/rXfI1uLvYmBk52oRk0xWpg9ARp+Ag9NR+QzQV LvzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:ironport-sdr:ironport-sdr; bh=QqP/TGDIOuetZcD0UGCkBkpRToPQhp1wG/IvEO9Yd0Y=; b=E47aXvNLm3SarIjC4mPBRvk+T5AvAkIp8JO8z1qvTTNguDF2LSjw/aF3AhHr8KtqxG N69Hn1zI/jkJr89fsZdm8bx9LKPS85NDf0IiBE7IOKHVF3t0SPVn+4nVRIHMVuCtVUS7 4xVwUey7xFVIV+2OXOeQYvsB8ptNi3sjBxsCqz2b5+cA+wvw/GTRbwioX8KdPssGqWMR BRSLCI0pQiQ609/7Luoc6SSQi/BsFB+lUwD0gLDBL9hbo2XXA7Rs3ILRfoR+ge+UTb3v 7/SO3FXL45Cyr8Gt+Bwi/Rs0ld8Mhwq5VqmieUAjFRU03f8MEBVO8VukU5fI8jBfDCqZ 4GDQ== ARC-Authentication-Results: i=1; mx.google.com; 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u5si3678747ill.146.2021.06.18.15.27.24; Fri, 18 Jun 2021 15:27:39 -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; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235445AbhFRPbq (ORCPT + 99 others); Fri, 18 Jun 2021 11:31:46 -0400 Received: from mga01.intel.com ([192.55.52.88]:7117 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235441AbhFRPbD (ORCPT ); Fri, 18 Jun 2021 11:31:03 -0400 IronPort-SDR: 2RNbvj99O3fWnnxCr2Lr+cDh0DiVYYS7ZDsi0DDukEKrHkuwh79OncyvZuvhcbtfwcMAM4FLUU G2Or2UOgO2bg== X-IronPort-AV: E=McAfee;i="6200,9189,10019"; a="228099637" X-IronPort-AV: E=Sophos;i="5.83,284,1616482800"; d="scan'208";a="228099637" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jun 2021 08:27:38 -0700 IronPort-SDR: aJNqamVDDtaY37t3WVh+Y+edICyczRVVKg1PY4L/gXNPzIwCUAIpZUKs0FoBUXcbTa61IN7yc2 b/Z64a9EiaZw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,284,1616482800"; d="scan'208";a="405004817" Received: from otc-lr-04.jf.intel.com ([10.54.39.41]) by orsmga006.jf.intel.com with ESMTP; 18 Jun 2021 08:27:34 -0700 From: kan.liang@linux.intel.com To: peterz@infradead.org, mingo@redhat.com, linux-kernel@vger.kernel.org Cc: acme@kernel.org, jolsa@redhat.com, namhyung@kernel.org, ak@linux.intel.com, Kan Liang , stable@vger.kernel.org Subject: [PATCH 3/3] perf/x86/intel: Fix instructions:ppp support in Sapphire Rapids Date: Fri, 18 Jun 2021 08:12:54 -0700 Message-Id: <1624029174-122219-4-git-send-email-kan.liang@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1624029174-122219-1-git-send-email-kan.liang@linux.intel.com> References: <1624029174-122219-1-git-send-email-kan.liang@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kan Liang Perf errors out when sampling instructions:ppp. $ perf record -e instructions:ppp -- true Error: The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (instructions:ppp). The instruction PDIR is only available on the fixed counter 0. The event constraint has been updated to fixed0_constraint in icl_get_event_constraints(). The Sapphire Rapids codes unconditionally error out for the event which is not available on the GP counter 0. Make the instructions:ppp an exception. Fixes: 61b985e3e775 ("perf/x86/intel: Add perf core PMU support for Sapphire Rapids") Reported-by: Yasin, Ahmad Signed-off-by: Kan Liang Cc: stable@vger.kernel.org --- arch/x86/events/intel/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index e442b55..e355db5 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -4032,8 +4032,10 @@ spr_get_event_constraints(struct cpu_hw_events *cpuc, int idx, * The :ppp indicates the Precise Distribution (PDist) facility, which * is only supported on the GP counter 0. If a :ppp event which is not * available on the GP counter 0, error out. + * Exception: Instruction PDIR is only available on the fixed counter 0. */ - if (event->attr.precise_ip == 3) { + if ((event->attr.precise_ip == 3) && + !constraint_match(&fixed0_constraint, event->hw.config)) { if (c->idxmsk64 & BIT_ULL(0)) return &counter0_constraint; -- 2.7.4