FAILED: patch "[PATCH] perf/x86/intel: Use PAGE_SIZE for PEBS buffer size on Core2" failed to apply to 4.5-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 4.5-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
Quoted 1 line
From
e72daf3f4d764c47fb71c9bdc7f9c54a503825b1Mon Sep 17 00:00:00 2001
From: Jiri Olsa <[email protected]>
Date: Tue, 1 Mar 2016 20:03:52 +0100
Subject: [PATCH] perf/x86/intel: Use PAGE_SIZE for PEBS buffer size on Core2
Using PAGE_SIZE buffers makes the WRMSR to PERF_GLOBAL_CTRL in intel_pmu_enable_all() mysteriously hang on Core2. As a workaround, we don't do this.
The hard lockup is easily triggered by running 'perf test attr' repeatedly. Most of the time it gets stuck on sample session with small periods.
# perf test attr -vv
14: struct perf_event_attr setup :
--- start ---
...
'PERF_TEST_ATTR=/tmp/tmpuEKz3B /usr/bin/perf record -o /tmp/tmpuEKz3B/perf.data -c 123 kill >/dev/null 2>&1' ret 1arch/x86/events/intel/ds.c +11 -2
@@ -269,7 +269,7 @@ static int alloc_pebs_buffer(int cpu)if (!x86_pmu.pebs)return 0 ; - buffer =kzalloc_node (PEBS_BUFFER_SIZE ,GFP_KERNEL , node); + buffer =kzalloc_node (x86_pmu.pebs_buffer_size,GFP_KERNEL , node);if (unlikely (!buffer))return -ENOMEM ;
@@ -286,7 +286,7 @@ static int alloc_pebs_buffer(int cpu)per_cpu (insn_buffer, cpu) = ibuffer; } - max =PEBS_BUFFER_SIZE / x86_pmu.pebs_record_size; + max = x86_pmu.pebs_buffer_size / x86_pmu.pebs_record_size; ds->pebs_buffer_base = (u64 )(unsigned long )buffer; ds->pebs_index = ds->pebs_buffer_base;
@@ -1319,6 +1319,7 @@ void __init intel_ds_init(void) x86_pmu.bts =boot_cpu_has (X86_FEATURE_BTS ); x86_pmu.pebs =boot_cpu_has (X86_FEATURE_PEBS ); + x86_pmu.pebs_buffer_size =PEBS_BUFFER_SIZE ;if (x86_pmu.pebs) {char pebs_type = x86_pmu.intel_cap.pebs_trap ?'+' :'-' ;int format = x86_pmu.intel_cap.pebs_format;
@@ -1327,6 +1328,14 @@ void __init intel_ds_init(void)case 0 :pr_cont ("PEBS fmt0%c, " , pebs_type); x86_pmu.pebs_record_size =sizeof (struct pebs_record_core ); +/* +* Using >PAGE_SIZE buffers makes the WRMSR to +* PERF_GLOBAL_CTRL in intel_pmu_enable_all() +* mysteriously hang on Core2. +* +* As a workaround, we don't do this. +*/ + x86_pmu.pebs_buffer_size =PAGE_SIZE ; x86_pmu.drain_pebs = intel_pmu_drain_pebs_core;break ;
arch/x86/events/perf_event.h +1 -0
@@ -586,6 +586,7 @@ struct x86_pmu { pebs_broken :1 , pebs_prec_dist :1;int pebs_record_size; +int pebs_buffer_size;void (*drain_pebs)(struct pt_regs *regs);struct event_constraint *pebs_constraints;void (*pebs_aliases)(struct perf_event *event);