perf/x86/intel: Allow PEBS multi-entry in watermark mode [Linux 4.14.126]

perf/x86/intel: Allow PEBS multi-entry in watermark mode [Linux 4.14.126]

This Linux kernel change "perf/x86/intel: Allow PEBS multi-entry in watermark mode" is included in the Linux 4.14.126 release. This change is authored by Stephane Eranian <eranian [at] google.com> on Mon May 13 17:34:00 2019 -0700. The commit for this change in Linux stable tree is 8340e78 (patch) which is from upstream commit c7a2865. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream c7a2865.

perf/x86/intel: Allow PEBS multi-entry in watermark mode

[ Upstream commit c7a286577d7592720c2f179aadfb325a1ff48c95 ]

This patch fixes a restriction/bug introduced by:

   583feb08e7f7 ("perf/x86/intel: Fix handling of wakeup_events for multi-entry PEBS")

The original patch prevented using multi-entry PEBS when wakeup_events != 0.
However given that wakeup_events is part of a union with wakeup_watermark, it
means that in watermark mode, PEBS multi-entry is also disabled which is not the
intent. This patch fixes this by checking is watermark mode is enabled.

Signed-off-by: Stephane Eranian <eranian@google.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: jolsa@redhat.com
Cc: kan.liang@intel.com
Cc: vincent.weaver@maine.edu
Fixes: 583feb08e7f7 ("perf/x86/intel: Fix handling of wakeup_events for multi-entry PEBS")
Link: http://lkml.kernel.org/r/20190514003400.224340-1-eranian@google.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>

There are 2 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 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 0b93f55..d44bb07 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -3051,7 +3051,7 @@ static int intel_pmu_hw_config(struct perf_event *event)
        return ret;

    if (event->attr.precise_ip) {
-       if (!(event->attr.freq || event->attr.wakeup_events)) {
+       if (!(event->attr.freq || (event->attr.wakeup_events && !event->attr.watermark))) {
            event->hw.flags |= PERF_X86_EVENT_AUTO_RELOAD;
            if (!(event->attr.sample_type &
                  ~intel_pmu_free_running_flags(event)))

Leave a Reply

Your email address will not be published. Required fields are marked *