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.
Reviewed-by: Andreas Sandberg <firstname.lastname@example.org>
Maintainer: Andreas Sandberg <email@example.com>
diff --git a/src/cpu/kvm/perfevent.cc b/src/cpu/kvm/perfevent.cc
index 5023b30..0b5960d 100644
@@ -169,7 +169,18 @@
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);