Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp1952251ima; Thu, 25 Oct 2018 07:29:38 -0700 (PDT) X-Google-Smtp-Source: AJdET5ezY4Df8lX35O73ZAEvCfsky3XM+AnxEUnkHHQgwBcyoRuYS5XB4Js953dHRcOzOH5MAV+f X-Received: by 2002:a63:2507:: with SMTP id l7mr1650210pgl.22.1540477778047; Thu, 25 Oct 2018 07:29:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540477778; cv=none; d=google.com; s=arc-20160816; b=lwzePoAoKiM4NmQ9/BLOj12U4t2ZvL2hXhhwx2iFmLN0MLwj2g3pmS/e/ED2MdayZT +t6edUCAvLI3GPFW4hngtYIkPr44NICGobUFg9g88DBp/boeChxtDgzh84X2bN99CaO9 yQ8UODsKasvuCxhUayDt4gTQWnCRlRrbu/kRuwBwONRkm0XS9MyD/+yNV/14XcpXvjar iWXL9ZB9d8v8BfN4VsKw8kY4B8C+131wAnvy4vowSOtSWlutebpF1woKNbfR8xCcSa7F BH7zBOhL6j4i6+YFFKlrA+sTzKjrnCO3yDW4DRsGZn7iCTtJCeFmRDpOqF1y09J76bFM nfsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=6Of5DOewuqp0MfyaLc8al8TsEa+VqtPITh3eyMgl0cg=; b=uy4EuTGThW3fEHin9mxd0FsWk2ZalCgXvf02w8M3DimkGE+tYWa3/oxi11Rzaz6Xzh FawUnUQ9uGxiVAnhqdk6AmooxetAZZ3Xr4Sd0rxO0100U3yb98SuuW5Yu2WNEE/4K538 GjsF682fT4BbhlmSlu+gPg0QpdP0QV7v2kzGtirjObl5WSy15gcr9uPAlNCTiuOXNfs6 poUyFRbjY3k6/Yl5GaIbjGaDSe6FQcrOEvzjS69ndZz87f08zzgZuoA1HSUvE9TyKkO5 E0XGCaUI7D3nD9Ngxu8E15/rabdsQh6aKpHn++S1PZhdMXR0p3Qxii67pmT+i/tgDviO cF1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zqcwt9R+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y11-v6si8273056pgi.121.2018.10.25.07.28.55; Thu, 25 Oct 2018 07:29:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zqcwt9R+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731063AbeJYW7B (ORCPT + 99 others); Thu, 25 Oct 2018 18:59:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:35278 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730799AbeJYWw5 (ORCPT ); Thu, 25 Oct 2018 18:52:57 -0400 Received: from sasha-vm.mshome.net (unknown [167.98.65.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6C45F2086D; Thu, 25 Oct 2018 14:19:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1540477199; bh=YWS3JOVof7Rredp1ttU9JzYUTsN/6NglWAKcZt/iob0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zqcwt9R+B4lnB+ZfqpN4ZTOHsmrA/RWLXhp4fuy2vbY1403joCeUrUdm0ffqlfX3m QG6ePNKqtyCBwCRoh3dbcqC0JbmzK0Vkq/e/qmaHRNLes5Q1iLWIguN1Zsr+xqIeEv 4DzFcMo4DtCaUtG7tNZslPbXmcZVjrmMX9WFDK+A= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Kan Liang , Peter Zijlstra , Arnaldo Carvalho de Melo , Linus Torvalds , Ingo Molnar , Sasha Levin Subject: [PATCH AUTOSEL 3.18 44/98] perf/x86/intel: Fix bug for "cycles:p" and "cycles:pp" on SLM Date: Thu, 25 Oct 2018 10:17:59 -0400 Message-Id: <20181025141853.214051-44-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025141853.214051-1-sashal@kernel.org> References: <20181025141853.214051-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kan Liang [ Upstream commit 33636732dcd7cc738a5913bb730d663c6b03c8fb ] cycles:p and cycles:pp do not work on SLM since commit: 86a04461a99f ("perf/x86: Revamp PEBS event selection") UOPS_RETIRED.ALL is not a PEBS capable event, so it should not be used to count cycle number. Actually SLM calls intel_pebs_aliases_core2() which uses INST_RETIRED.ANY_P to count the number of cycles. It's a PEBS capable event. But inv and cmask must be set to count cycles. Considering SLM allows all events as PEBS with no flags, only INST_RETIRED.ANY_P, inv=1, cmask=16 needs to handled specially. Signed-off-by: Kan Liang Signed-off-by: Peter Zijlstra (Intel) Link: http://lkml.kernel.org/r/1421084541-31639-1-git-send-email-kan.liang@intel.com Cc: Arnaldo Carvalho de Melo Cc: Linus Torvalds Signed-off-by: Ingo Molnar Signed-off-by: Sasha Levin --- arch/x86/kernel/cpu/perf_event_intel_ds.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c index 46211bcc813e..423cbd9bea3e 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_ds.c +++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c @@ -568,8 +568,8 @@ struct event_constraint intel_atom_pebs_event_constraints[] = { }; struct event_constraint intel_slm_pebs_event_constraints[] = { - /* UOPS_RETIRED.ALL, inv=1, cmask=16 (cycles:p). */ - INTEL_FLAGS_EVENT_CONSTRAINT(0x108001c2, 0xf), + /* INST_RETIRED.ANY_P, inv=1, cmask=16 (cycles:p). */ + INTEL_FLAGS_EVENT_CONSTRAINT(0x108000c0, 0x1), /* Allow all events as PEBS with no flags */ INTEL_ALL_EVENT_CONSTRAINT(0, 0x1), EVENT_CONSTRAINT_END -- 2.17.1