Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1168798yba; Thu, 9 May 2019 11:53:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqyXfIl6rr9/eqE64StFbNwQgvAtPMGpTFOwXO8Qf/33bUf5C/WKI+oe7zL7xUfawCVqv/FK X-Received: by 2002:a17:902:e00a:: with SMTP id ca10mr7610191plb.18.1557428037266; Thu, 09 May 2019 11:53:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557428037; cv=none; d=google.com; s=arc-20160816; b=tA/ew0ThHAWLMspQvgVoKzMsufxPAPB5CBX78PWI7/ID1r9VEzz6BHv3Z25R21559s 8nTHdQEB8t10cliyHLbf9ec39z580ZwLUkVrLJyfPu+Ff4EAIyGhIaJ+muO+dOYheSKK BHe0N9aBq1SHS7mbo9eDHPW0nNZfVo6ob6UdHxOPJz9uLAlsGOn0albXoexMxSJRHLww LoXsYVfRayLXu6Z1bN0xXcFg1O0+DQhaBByQDSSsbU+3+bR4lCgh5NiDtoLPPh6sSN4S x2iwpWaW8GXebdDCxY458+xvl7gTE0uPz+h1sCR/NZ127Xut1KuSXWoSla/hfNCB6Bln 4FbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=agDTyhG4Ql9wNWBFxURrH50K6wcFUNNkmoHYcRaakRw=; b=XLCFE7jch+F6+jTnK2D7n9RcItqdodnR9p8772lDA/gv04HLmuZ7vXUNwnpbTZ0w21 Trv9uC3x/lOP/6k5K/MJd7rXLc2azRoGDOgcYHZnQFOrNImCW4hWkgVD8ILlnJSmgjyJ 50QfIN3Y2IaDG9uJsndWNqCYcmJf8ZeHhkUC56wQFTTCQw4bLSKxIamv2nIUp7Vvp2vK AhUPOCPFSUXi3S2LCAPiP44TEeJ8uc0iwH1zTRiyCbEpPRF/RqJOircmN71Sp2vo1r+j DNelMAxntrFvdYeuuZyRpfibbGtnfH0jGXG83C5/xTk9Byipo9R6+Kpnf9FES8XULIw8 T3MA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mZnU3IUw; 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 g33si4204953pgb.192.2019.05.09.11.53.41; Thu, 09 May 2019 11:53:57 -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=mZnU3IUw; 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 S1727888AbfEISwy (ORCPT + 99 others); Thu, 9 May 2019 14:52:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:47046 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728334AbfEISwt (ORCPT ); Thu, 9 May 2019 14:52:49 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 354FB2177E; Thu, 9 May 2019 18:52:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557427968; bh=bAL8kjRN4RC2lhZGCofR/JGu5vg/0k3sxbHAr5YsJRQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mZnU3IUw18gDh3IaxVQsapxMA28QfVXfUssVwNsFicXVbjouVMP8E8WLGko02ksNU iA1vWo3vRE/ZuR4++rZJbyY09UuWfER8muYGsnIkJ/14afCY1RUb3egpd+tmK48WI4 9AzcC/yu6x1vVhgO5MzKOpTLtBuvrJ2G3s8IU/AA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephane Eranian , "Peter Zijlstra (Intel)" , Andi Kleen , Alexander Shishkin , Arnaldo Carvalho de Melo , Jiri Olsa , Linus Torvalds , Thomas Gleixner , Vince Weaver , kan.liang@intel.com, Ingo Molnar , Sasha Levin Subject: [PATCH 5.0 36/95] perf/x86/intel: Fix handling of wakeup_events for multi-entry PEBS Date: Thu, 9 May 2019 20:41:53 +0200 Message-Id: <20190509181311.821760144@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190509181309.180685671@linuxfoundation.org> References: <20190509181309.180685671@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 583feb08e7f7ac9d533b446882eb3a54737a6dbb ] 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 Signed-off-by: Sasha Levin --- 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 470d7daa915d9..77353555d491a 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -3184,7 +3184,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.20.1