kvm: Add experimental support for a perf-based execution timer
Add support for using the CPU cycle counter instead of a normal POSIX timer to generate timed exits to gem5. This should, in theory, provide better resolution when requesting timer signals. The perf-based timer requires a fairly recent kernel since it requires a working PERF_EVENT_IOC_PERIOD ioctl. This ioctl has existed in the kernel for a long time, but it used to be completely broken due to an inverted match when the kernel copied things from user space. Additionally, the ioctl does not change the sample period correctly on all kernel versions which implement it. It is currently only known to work reliably on kernel version 3.7 and above on ARM.
This commit is contained in:
@@ -460,12 +460,6 @@ class BaseKvmCPU : public BaseCPU
|
||||
/** Setup hardware performance counters */
|
||||
void setupCounters();
|
||||
|
||||
/** @{ */
|
||||
/** Start/stop counting HW performance events */
|
||||
void startCounters();
|
||||
void stopCounters();
|
||||
/** @} */
|
||||
|
||||
/** KVM vCPU file descriptor */
|
||||
int vcpuFD;
|
||||
/** Size of MMAPed kvm_run area */
|
||||
@@ -495,6 +489,15 @@ class BaseKvmCPU : public BaseCPU
|
||||
PerfKvmCounter hwInstructions;
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* Does the runTimer control the performance counters?
|
||||
*
|
||||
* The run timer will automatically enable and disable performance
|
||||
* counters if a PerfEvent-based timer is used to control KVM
|
||||
* exits.
|
||||
*/
|
||||
bool perfControlledByTimer;
|
||||
|
||||
/**
|
||||
* Timer used to force execution into the monitor after a
|
||||
* specified number of simulation tick equivalents have executed
|
||||
|
||||
Reference in New Issue
Block a user