Blob Blame History Raw
From: Tony Jones <tonyj@suse.de>
Subject: Additional warning when sampling rate if decayed below startup minimum
References: none
Patch-mainline: never,  see description below

Performance of the dwarf unwinder for call-graphs (perf record -g) will likely 
cause commit 14c63f17b1fde5a575a28e96547a22b451c71fb5 to decay the sampling 
rate below the minimum for perf record (4000).  Issue a warning in this case.

This a is temporary warning (documented in SLE12 release notes).  Intent is to 
fix underlying performance issue as soon as possible and remove this message.

---
 kernel/events/core.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -262,6 +262,13 @@ static void perf_duration_warn(struct ir
 			"kernel.perf_event_max_sample_rate to %d\n",
 			avg_local_sample_len, allowed_ns >> 1,
 			sysctl_perf_event_sample_rate);
+
+	if (sysctl_perf_event_sample_rate < 4000) {
+		printk_ratelimited(KERN_WARNING
+			"Subsequent perf sampling commands (record) will fail unless frequency <= %d is specified (via -F). "
+			"To disable this warning 'echo 0 > /proc/sys/kernel/perf_cpu_time_max_percent'\n",
+			sysctl_perf_event_sample_rate);
+	}
 }
 
 static DEFINE_IRQ_WORK(perf_duration_work, perf_duration_warn);
@@ -305,6 +312,13 @@ void perf_sample_event_took(u64 sample_l
 			     "kernel.perf_event_max_sample_rate to %d\n",
 			     avg_local_sample_len, allowed_ns >> 1,
 			     sysctl_perf_event_sample_rate);
+
+		if (sysctl_perf_event_sample_rate < 4000) {
+			early_printk(KERN_WARNING
+				"Subsequent perf sampling commands (record) will fail unless frequency <= %d is specified (via -F). "
+				"To disable this warning 'echo 0 > /proc/sys/kernel/perf_cpu_time_max_percent'\n",
+				sysctl_perf_event_sample_rate);
+		}
 	}
 }