Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2127662yba; Wed, 3 Apr 2019 01:44:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqyBqj1q0dnqHYyP39gKErqYOd6cIBdqTP/EujZ+WoSvI4MFgr0ouwF9GeSC7738RYLD+iUs X-Received: by 2002:a63:88c3:: with SMTP id l186mr72238503pgd.148.1554281080518; Wed, 03 Apr 2019 01:44:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554281080; cv=none; d=google.com; s=arc-20160816; b=Tr9HXLvlp0pcrcB/VB2ob5hGpEpeNP4/ZKBXLRcgqph7Iey+ez17LsS8Ao7Qo5C/QG kzEb879ONq/sUrRw0QXdwlu1XOuWZUXEEz4aualP1RS44sVfUn4RLeiEoR2SJSPI2Ew4 6Ocah/2Jgdaz2LnukkTNWJyuEv3178vUkOEIa+xS7o3qIE9knYGBQugjFcV9Q5bvkTWX UfXsnbIpmRsrPVwO5wzF1ZWwGn/IDiqA8Wo86EuQg+3exNNsVcFHh/1WvnG7aOeN89oo 55mt14B/YHoBTTlQ3JLb7MoGazAUu0vQyhm7K5f3URr5FUACvKLLK59GxzvX43d421PC gf9g== 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; bh=fqWCXhb3mbRdd5WBK/ylbi6MGwVOER110iVNzZTTvIM=; b=k4yX+BghqXq44pLDooKoXq6xElzMS2xePIjyzfCIavwikaurzl346QeN61lNjN4Z3g ZjAvwYd82p60MvD8e8A0/U3YgdH6HOeBWpW88s+6QfheQcjce3r7+A06j5FzTw+/XwV9 DsoyuyaXDRTVCwfxXuJRwD3z7HRCy6uyN5cepv2TFS8T/7jg5s1joEvQx9raYcvAa4ee dXoltEH1Z1TE1YamPX2SZ7yB3XtnkblfqH96CV9+PXW/7OXsU9Xvr9OGjMV4CzNOG69B qxlvt1gYLR/46Xb3EnIKz4lL7YPoe3npONthwgX3ppYfx3Y4y1uM008nWAYOeW4lDFj9 AZqw== 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 h18si6581529plr.321.2019.04.03.01.44.25; Wed, 03 Apr 2019 01:44:40 -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 S1728645AbfDCInk (ORCPT + 99 others); Wed, 3 Apr 2019 04:43:40 -0400 Received: from terminus.zytor.com ([198.137.202.136]:56395 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725822AbfDCInk (ORCPT ); Wed, 3 Apr 2019 04:43:40 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id x338hOvn1775827 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 3 Apr 2019 01:43:25 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id x338hODa1775824; Wed, 3 Apr 2019 01:43:24 -0700 Date: Wed, 3 Apr 2019 01:43:24 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Stephane Eranian Message-ID: Cc: acme@redhat.com, linux-kernel@vger.kernel.org, ak@linux.intel.com, alexander.shishkin@linux.intel.com, mingo@kernel.org, torvalds@linux-foundation.org, peterz@infradead.org, eranian@google.com, tglx@linutronix.de, hpa@zytor.com, jolsa@redhat.com, vincent.weaver@maine.edu Reply-To: tglx@linutronix.de, eranian@google.com, jolsa@redhat.com, vincent.weaver@maine.edu, hpa@zytor.com, mingo@kernel.org, torvalds@linux-foundation.org, peterz@infradead.org, alexander.shishkin@linux.intel.com, linux-kernel@vger.kernel.org, acme@redhat.com, ak@linux.intel.com In-Reply-To: <20190306195048.189514-1-eranian@google.com> References: <20190306195048.189514-1-eranian@google.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf/x86/intel: Fix handling of wakeup_events for multi-entry PEBS Git-Commit-ID: 583feb08e7f7ac9d533b446882eb3a54737a6dbb 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.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: 583feb08e7f7ac9d533b446882eb3a54737a6dbb Gitweb: https://git.kernel.org/tip/583feb08e7f7ac9d533b446882eb3a54737a6dbb Author: Stephane Eranian AuthorDate: Wed, 6 Mar 2019 11:50:48 -0800 Committer: Ingo Molnar CommitDate: Wed, 3 Apr 2019 09:57:43 +0200 perf/x86/intel: Fix handling of wakeup_events for multi-entry PEBS When an event is programmed with attr.wakeup_events=N (N>0), it means the caller is interested in getting a user level notification after N samples have been recorded in the kernel sampling buffer. With precise events on Intel processors, the kernel uses PEBS. The kernel tries minimize sampling overhead by verifying if the event configuration is compatible with multi-entry PEBS mode. If so, the kernel is notified only when the buffer has reached its threshold. Other PEBS operates in single-entry mode, the kenrel is notified for each PEBS sample. The problem is that the current implementation look at frequency mode and event sample_type but ignores the wakeup_events field. Thus, it may not be possible to receive a notification after each precise event. This patch fixes this problem by disabling multi-entry PEBS if wakeup_events is non-zero. Signed-off-by: Stephane Eranian Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Andi Kleen Cc: Alexander Shishkin Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Vince Weaver Cc: kan.liang@intel.com Link: https://lkml.kernel.org/r/20190306195048.189514-1-eranian@google.com Signed-off-by: Ingo Molnar --- arch/x86/events/intel/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 8baa441d8000..1539647ea39d 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -3185,7 +3185,7 @@ static int intel_pmu_hw_config(struct perf_event *event) return ret; if (event->attr.precise_ip) { - if (!event->attr.freq) { + if (!(event->attr.freq || event->attr.wakeup_events)) { event->hw.flags |= PERF_X86_EVENT_AUTO_RELOAD; if (!(event->attr.sample_type & ~intel_pmu_large_pebs_flags(event)))