From 541d89953a4d2264702b90204ed91bb589a056ae Mon Sep 17 00:00:00 2001 From: Ryan Gambord Date: Thu, 21 Mar 2019 07:01:29 -0700 Subject: [PATCH] cpu-kvm: Added informative error message PerfKvmCounter::attach fails if the user doesn't have privileges to make the perf_event_open syscall. This is the default privilege setting since kernel 4.6. I've seen some users in the mailing list resort to running as root; changing the perf_event_paranoid setting is an alternative. Change-Id: I2bc6f76abb6e97bf34b408a611f64b1910f50a43 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/17508 Reviewed-by: Andreas Sandberg Maintainer: Andreas Sandberg --- src/cpu/kvm/perfevent.cc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/cpu/kvm/perfevent.cc b/src/cpu/kvm/perfevent.cc index 5023b301e..0b5960d51 100644 --- a/src/cpu/kvm/perfevent.cc +++ b/src/cpu/kvm/perfevent.cc @@ -169,7 +169,18 @@ PerfKvmCounter::attach(PerfKvmCounterConfig &config, group_fd, 0); // Flags if (fd == -1) - panic("PerfKvmCounter::open failed (%i)\n", errno); + { + if (errno == EACCES) + { + panic("PerfKvmCounter::attach recieved error EACCESS\n" + " This error may be caused by a too restrictive setting\n" + " in the file '/proc/sys/kernel/perf_event_paranoid'\n" + " The default value was changed to 2 in kernel 4.6\n" + " A value greater than 1 prevents gem5 from making\n" + " the syscall to perf_event_open"); + } + panic("PerfKvmCounter::attach failed (%i)\n", errno); + } mmapPerf(1); } -- 2.30.2