Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp4431403imb; Wed, 6 Mar 2019 13:15:54 -0800 (PST) X-Google-Smtp-Source: APXvYqykl4mRidIZf9JWskPAHDm/3T+R/8Pioqbu4gwmxT5YUXBER9I0xo9bbfLNmJKZmu4E6eK2 X-Received: by 2002:a62:a113:: with SMTP id b19mr9103700pff.227.1551906954154; Wed, 06 Mar 2019 13:15:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551906954; cv=none; d=google.com; s=arc-20160816; b=X9PRQD1J0s9CK5oVSEMW4TpacvW2G1+y0b7G+eD0A7np8d2JzYybWEo5vSTH4a9S9m 6scQeS1gNDBvTMzDL1DUVHWmofY81eifoFaMHJxQY/ZrFtceIDSL6GZAE0GGB5fRwAQc h3frN/SEzR3p90Pdvqv3VikTpb3BsU8OVosKgdRIF9opQR2iilnd557zeeHI+QX89V51 rvbywBJwmQPjMJByWzMVj5FgtC6RYY+uo/b+vVkxxrpS9FwDBR8lsZZtOiaBVgiV86U0 rVdowJEmytycrh8ElRP96cAs6KpWZO7a9+5t5g4vBvpm+DQu81hLgkQylo+PwFpQQI6p slKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:mime-version :message-id:date:dkim-signature; bh=G630ddU/pY4PPGElv4ZfTutalcdCfH9uZUVNLNV6Hyo=; b=lP+CAwZMCIggZHAw5zvHi1oVWQNpFgKNVNbn+GUd7J+whN9R62CG61A4lm8JamHd8V +Oy/pzxklAdLBPpRBI3SrvT9utvSvkUKUrDMM20L1S+ksW5FLUy3kEmTQtGBYyMPX+Rl Ru5iQ9TTNCg39SAqJD15zkuR6TXbsylNDsAB4ITs4gH4Ea676l8LKFe4282tMG2O9qys u5dqF8iYpqyz1WTqNfNO8EMh1b3DfDUXK36bJAiDIEfYbv6egOGTMTY4x5JrPVc8Jzhj 1BwV9ZWDPmrE5yDDGL0TeNxbM9X1XLjLAQbqt7QLlK1zKU70ZqTBP8V6TeqryDjIEIrS VzJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=HdJlw2y6; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q23si2283545pll.74.2019.03.06.13.15.38; Wed, 06 Mar 2019 13:15:54 -0800 (PST) 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=@google.com header.s=20161025 header.b=HdJlw2y6; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730903AbfCFTuw (ORCPT + 99 others); Wed, 6 Mar 2019 14:50:52 -0500 Received: from mail-pf1-f201.google.com ([209.85.210.201]:50316 "EHLO mail-pf1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728324AbfCFTuw (ORCPT ); Wed, 6 Mar 2019 14:50:52 -0500 Received: by mail-pf1-f201.google.com with SMTP id q21so14664829pfi.17 for ; Wed, 06 Mar 2019 11:50:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=G630ddU/pY4PPGElv4ZfTutalcdCfH9uZUVNLNV6Hyo=; b=HdJlw2y67wxuXfUIAW9ScYFSFVngUueWCIvkH/pxxF2omBI1i7CwMUqPK+dQSu6NEG 8+R+ZU/6GZ7/1LroBNv+u+VMt6GWj90J0w6AF9rbCJJa08od0AEyfO1BqhZu/j5wQBVz wZwzZap9aGj6rE7no84WLW0DeXtOEIx8brhik8wjp9Mlwdb5zi1K8QdqRcjRhgsYyn1+ 3/Xtu5iXYeYGFZ7v+PYG+9bjGttyLsuQe/PihtFrp97ebNAFkrNInm2NFIfaEHfUYTh0 8PZupbbiEfOc7XgDUDtdnDb4XnbIPgoW1NsW+Nuer29vQ5VA6uJymIfWoQDXZJNCt0Wz ueSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=G630ddU/pY4PPGElv4ZfTutalcdCfH9uZUVNLNV6Hyo=; b=mW4tITD2/9pICcL6WvegUd4oDsskhh4w9yNFdcpMsrV9Xs66jbEjyFnvK01+lxjzqv OO7RHyHNtd/2OuzV3IZkdbPfZbz0uMYg/fVJbx2BQ76yfGvYVOg7TFzmJX2qflAfqvZ9 rmL68vyUoLnMZkpycXSe/sn+eG/eWxnSIsgRsobWgKFqJNOyBNn6Nxn3O5h+0OtofN3+ wWAdErg9MGx12Ii04wnRAsoEm9kOOUGlyRngb8RYHvlWXqq2CzeJ5fOER4PPwtILqYXf BSbS51VgNCUVW/AIXsqBt4zPnK0q8Gb845ka4M72NMbFxnzILXrNOUqgUpcgHy2Y1Lqs bVcA== X-Gm-Message-State: APjAAAWgL9ruAk4s51MPsbvbi9C9IoKj2Zh01DKbop16gVk6S19MCkTw EZz1mLdFoDg5lmGffwmNScv1UlYB01I4DtkjceVyLu0tmPlPEWG2QxRe33j5vX7e7TPJl/tWdlA NXc5IP99LBx1qDPUcwnWBF0VvpncGYyB9perbC5zVnVIzU1GrXZV4yR3u07UjPaHvvg9IAJWl X-Received: by 2002:aa7:8512:: with SMTP id v18mr3471213pfn.41.1551901851301; Wed, 06 Mar 2019 11:50:51 -0800 (PST) Date: Wed, 6 Mar 2019 11:50:48 -0800 Message-Id: <20190306195048.189514-1-eranian@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.21.0.352.gf09ad66450-goog Subject: [PATCH] perf/x86/intel: fix handling of wakeup_events for multi-entry PEBS From: Stephane Eranian To: linux-kernel@vger.kernel.org Cc: ak@linux.intel.com, kan.liang@intel.com, peterz@infradead.org, mingo@elte.hu, acme@redhat.com, jolsa@redhat.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 7ec265b..13d7167 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -3143,7 +3143,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))) -- 2.7.4