stdlib: Only set 'sim_quantum' value of KVM cores included
This commit: https://gem5-review.googlesource.com/c/public/gem5/+/62471 set `sim_quantum` for any simulation done via the Simulator module. However, this causes issues when setting exit events at a particular tick. It resulted in the exit being off by the `sim_quantum` value. This is required for KVM setups but is undesirable for non-KVM setups. Ergo, this commit ensures the `sim_quantum` is only set in cases where KVM cores are included in a simulation. There are two items of note here: 1. When using the SwitchableProcessor the KVM cores may be switched out and therefore not accessable via the `get_cores` method. To get round this we check if the processor is a SwitchableProcessor and run an additionial check that _any_ of the cores in the SwitchableProcessor are KVM. This is a big hacky; the Processor API should be changed to make this easier. 2. This only partially fixes the problem of exit events being off given a specified tick. This will still occur in the case a SwitchableProcessor is used containing KVM cores. E.g., non-KVM cores will still be "off" when KVM cores are switched out. This issue will be addressed in a later commit. Change-Id: Id966d76cd1630b6c41c5972fa9423c9e48eafaf6 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/63051 Maintainer: Jason Lowe-Power <power.jg@gmail.com> Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Bobby Bruce
parent
5a29fd6f8c
commit
36a1b6a73d
@@ -43,6 +43,7 @@ from .exit_event_generators import (
|
||||
)
|
||||
from .exit_event import ExitEvent
|
||||
from ..components.boards.abstract_board import AbstractBoard
|
||||
from ..components.processors.switchable_processor import SwitchableProcessor
|
||||
from ..components.processors.cpu_types import CPUTypes
|
||||
|
||||
|
||||
@@ -303,8 +304,28 @@ class Simulator:
|
||||
# (for example, in `get_stats()`).
|
||||
self._root = root
|
||||
|
||||
m5.ticks.fixGlobalFrequency()
|
||||
root.sim_quantum = m5.ticks.fromSeconds(0.001)
|
||||
# The following is a bit of a hack. If a simulation is to use a KVM
|
||||
# core then the `sim_quantum` value must be set. However, in the
|
||||
# case of using a SwitchableProcessor the KVM cores may be
|
||||
# switched out and therefore not accessible via `get_cores()`.
|
||||
# This is the reason for the `isinstance` check.
|
||||
#
|
||||
# We cannot set the `sim_quantum` value in every simulation as
|
||||
# setting it causes the scheduling of exits to be off by the
|
||||
# `sim_quantum` value (something necessary if we are using KVM
|
||||
# cores). Ergo we only set the value of KVM cores are present.
|
||||
#
|
||||
# There is still a bug here in that if the user is switching to and
|
||||
# from KVM and non-KVM cores via the SwitchableProcessor then the
|
||||
# scheduling of exits for the non-KVM cores will be incorrect. This
|
||||
# will be fixed at a later date.
|
||||
processor = self._board.processor
|
||||
if any(core.is_kvm_core() for core in processor.get_cores()) or (
|
||||
isinstance(processor, SwitchableProcessor)
|
||||
and any(core.is_kvm_core() for core in processor._all_cores())
|
||||
):
|
||||
m5.ticks.fixGlobalFrequency()
|
||||
root.sim_quantum = m5.ticks.fromSeconds(0.001)
|
||||
|
||||
# m5.instantiate() takes a parameter specifying the path to the
|
||||
# checkpoint directory. If the parameter is None, no checkpoint
|
||||
|
||||
Reference in New Issue
Block a user