Received: by 10.213.65.68 with SMTP id h4csp310611imn; Tue, 20 Mar 2018 04:16:37 -0700 (PDT) X-Google-Smtp-Source: AG47ELu1/z5NDvM61b+NZqE6znm7M+ttWtLVXtiESksPse6Z7KD6BzWmxIm2hDJK8weJndQAIfZI X-Received: by 10.101.87.138 with SMTP id b10mr11814825pgr.241.1521544597743; Tue, 20 Mar 2018 04:16:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521544597; cv=none; d=google.com; s=arc-20160816; b=d7EjPfzIJTBqyQ8u4PL1OeDE57E8Y/EObyJhpQfEm9B1pCxXW6AncEjAsrH9Kh/ixW sfhrTRo5EuQdRd+zpOWdEaW96f7Bzb+tqitSFpbu1rJbYjH9One2l3GmDwlD8CBz+bU0 1MUtKpvseo++HKdhgd5hiVgNGJ9hDr/IZUWHTH95lhhEVljjm/p8GFw+LDEuodBhJi3U 4xpf0w8hdCNGRURnHdJkXKAWVPx//LsIWDV1rqzHjnmY3hhHohcXJZaRdw5VnTx0rVT3 wQC+bVgiMmSGafeS9yhMExHtfRjwKvi0DYBiL1GHuxlOqjnAb1RdwdFy99Smhd/l4q5R pW4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=DbgxnkmYNx6HsCtK6oO9WTxWKhke4suJ0cfaKhmEx4o=; b=GM88NicIMTeBqQ3g4/f5/SbVrV1BI13pV87V5bUPkfzVfye96AAsP+EdRJW+FPeCo8 4GpYFkyLVwE2MIat/tEzjcvQnkKHPm/FjMuU+zs+w2afjGhJi0plhBXo8+/ET0F3FI3q xIjNr00tfIzlFtq8VOnmLQj6EHUEcrje6SUy42gI6edqwlY9npRHBvucZrJSZ65jDhwd YgLWl4q/A0FdtV85G3VD9O04eqFO8Gj5j/kRJRd6fNNOe7tz7mc1Zqlx2cvsZxvfeT+S 6kBmOZyeC1QmnsbaWvgacn+y1alc1mmN+H5EPgHVsHy3EV5HE3ypzDhDI158zu5RW8KO atvw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p13-v6si1440610pll.416.2018.03.20.04.16.22; Tue, 20 Mar 2018 04:16:37 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752700AbeCTLPa (ORCPT + 99 others); Tue, 20 Mar 2018 07:15:30 -0400 Received: from terminus.zytor.com ([198.137.202.136]:44003 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751552AbeCTLP3 (ORCPT ); Tue, 20 Mar 2018 07:15:29 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTP id w2KBF6aH013565; Tue, 20 Mar 2018 04:15:06 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w2KBF6ko013562; Tue, 20 Mar 2018 04:15:06 -0700 Date: Tue, 20 Mar 2018 04:15:06 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Kan Liang Message-ID: Cc: mingo@kernel.org, jolsa@redhat.com, alexander.shishkin@linux.intel.com, torvalds@linux-foundation.org, eranian@google.com, kan.liang@linux.intel.com, tglx@linutronix.de, acme@redhat.com, hpa@zytor.com, vincent.weaver@maine.edu, linux-kernel@vger.kernel.org, peterz@infradead.org Reply-To: jolsa@redhat.com, mingo@kernel.org, alexander.shishkin@linux.intel.com, torvalds@linux-foundation.org, acme@redhat.com, tglx@linutronix.de, kan.liang@linux.intel.com, eranian@google.com, linux-kernel@vger.kernel.org, peterz@infradead.org, vincent.weaver@maine.edu, hpa@zytor.com In-Reply-To: <1518474035-21006-6-git-send-email-kan.liang@linux.intel.com> References: <1518474035-21006-6-git-send-email-kan.liang@linux.intel.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf/x86/intel: Disable userspace RDPMC usage for large PEBS Git-Commit-ID: 2c2a9bbe7fecb2ad4981b6f4a56cacbfb849f848 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 2c2a9bbe7fecb2ad4981b6f4a56cacbfb849f848 Gitweb: https://git.kernel.org/tip/2c2a9bbe7fecb2ad4981b6f4a56cacbfb849f848 Author: Kan Liang AuthorDate: Mon, 12 Feb 2018 14:20:35 -0800 Committer: Ingo Molnar CommitDate: Tue, 20 Mar 2018 08:52:58 +0100 perf/x86/intel: Disable userspace RDPMC usage for large PEBS Userspace RDPMC cannot possibly work for large PEBS, which was introduced in: b8241d20699e ("perf/x86/intel: Implement batched PEBS interrupt handling (large PEBS interrupt threshold)") When the PEBS interrupt threshold is larger than one, there is no way to get exact auto-reload times and value for userspace RDPMC. Disable the userspace RDPMC usage when large PEBS is enabled. The only exception is when the PEBS interrupt threshold is 1, in which case user-space RDPMC works well even with auto-reload events. Signed-off-by: Kan Liang Signed-off-by: Peter Zijlstra (Intel) Cc: Alexander Shishkin Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Stephane Eranian Cc: Thomas Gleixner Cc: Vince Weaver Cc: acme@kernel.org Fixes: b8241d20699e ("perf/x86/intel: Implement batched PEBS interrupt handling (large PEBS interrupt threshold)") Link: http://lkml.kernel.org/r/1518474035-21006-6-git-send-email-kan.liang@linux.intel.com Signed-off-by: Ingo Molnar (cherry picked from commit 1af22eba248efe2de25658041a80a3d40fb3e92e) --- arch/x86/events/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index 140d33288e78..3d24edfef3e4 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c @@ -2118,7 +2118,8 @@ static int x86_pmu_event_init(struct perf_event *event) event->destroy(event); } - if (READ_ONCE(x86_pmu.attr_rdpmc)) + if (READ_ONCE(x86_pmu.attr_rdpmc) && + !(event->hw.flags & PERF_X86_EVENT_FREERUNNING)) event->hw.flags |= PERF_X86_EVENT_RDPMC_ALLOWED; return err;