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 <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user