diff options
author | Andreas Sandberg <andreas@sandberg.pp.se> | 2014-02-20 15:43:53 +0100 |
---|---|---|
committer | Andreas Sandberg <andreas@sandberg.pp.se> | 2014-02-20 15:43:53 +0100 |
commit | 0d6009e8dc3ab8419ca7daf9c79c9c987464e3ae (patch) | |
tree | a996eafa5fe69192cadd21fc0c3de0fa26fad530 /src/cpu/kvm/base.hh | |
parent | fd9343eb857493ba7bade90d99a945f5577ab7ab (diff) | |
download | gem5-0d6009e8dc3ab8419ca7daf9c79c9c987464e3ae.tar.xz |
kvm: Add support for multi-system simulation
The introduction of parallel event queues added most of the support
needed to run multiple VMs (systems) within the same gem5
instance. This changeset fixes up signal delivery so that KVM's
control signals are delivered to the thread that executes the CPU's
event queue. Specifically:
* Timers and counters are now initialized from a separate method
(startupThread) that is scheduled as the first event in the
thread-specific event queue. This ensures that they are
initialized from the thread that is going to execute the CPUs
event queue and enables signal delivery to the right thread when
exiting from KVM.
* The POSIX-timer-based KVM timer (used to force exits from KVM) has
been updated to deliver signals to the thread that's executing KVM
instead of the process (thread is undefined in that case). This
assumes that the timer is instantiated from the thread that is
going to execute the KVM vCPU.
* Signal masking is now done using pthread_sigmask instead of
sigprocmask. The behavior of the latter is undefined in threaded
applications.
* Since signal masks can be inherited, make sure to actively unmask
the control signals when setting up the KVM signal mask.
There are currently no facilities to multiplex between multiple KVM
CPUs in the same event queue, we are therefore limited to
configurations where there is only one KVM CPU per event queue. In
practice, this means that multi-system configurations can be
simulated, but not multiple CPUs in a shared-memory configuration.
Diffstat (limited to 'src/cpu/kvm/base.hh')
-rw-r--r-- | src/cpu/kvm/base.hh | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/cpu/kvm/base.hh b/src/cpu/kvm/base.hh index 8788d6c8a..5a0b80b15 100644 --- a/src/cpu/kvm/base.hh +++ b/src/cpu/kvm/base.hh @@ -618,6 +618,20 @@ class BaseKvmCPU : public BaseCPU */ bool discardPendingSignal(int signum) const; + /** + * Thread-specific initialization. + * + * Some KVM-related initialization requires us to know the TID of + * the thread that is going to execute our event queue. For + * example, when setting up timers, we need to know the TID of the + * thread executing in KVM in order to deliver the timer signal to + * that thread. This method is called as the first event in this + * SimObject's event queue. + * + * @see startup + */ + void startupThread(); + /** Try to drain the CPU if a drain is pending */ bool tryDrain(); |