问题
When running a simulation in gem5, I can select a CPU with fs.py --cpu-type
.
This option can also show a list of all CPU types if I use an invalid CPU type such as fs.py --cpu-type
.
What is the difference between those CPU types and which one should I choose for my experiment?
Question inspired by: https://www.mail-archive.com/gem5-users@gem5.org/msg16976.html
回答1:
An overview of the CPU types can be found at: https://cirosantilli.com/linux-kernel-module-cheat/#gem5-cpu-types
In summary:
simplistic CPUs (derived from
BaseSimpleCPU
): for exampleAtomicSimpleCPU
(the default one). They have no CPU pipeline, and therefor are completely unrealistic. However, they also run much faster. Therefore,they are mostly useful to boot Linux fast and then checkpoint and switch to a more detailed CPU.Within the simple CPUs we can notably distinguish:
AtomicSimpleCPU
: memory requests finish immediatelyTimingSimpleCPU:
memory requests actually take time to go through to the memory system and return. Since there is no CPU pipeline however, the simulated CPU stalls on every memory request waiting for a response.
An alternative to those is to use KVM CPUs to speed up boot if host and guest ISA are the same, although as of 2019, KVM is less stable as it is harder to implement and debug.
in-order CPUs: derived from the generic
MinorCPU
by parametrization, Minor stands for In Order:- for ARM:
HPI
is made by ARM and models a "(2017) modern in-order Armv8-A implementation". This is your best in-order ARM bet.
- for ARM:
out-of-order CPUs, derived from the generic
DerivO3CPU
by parametrization, O3 stands for Out Of Order:- for ARM: there are no models specifically published by ARM as of 2019. The only specific O3 model available is
ex5_big
for an A15, but you would have to verify its authors claims on how well it models the real core A15 core.
- for ARM: there are no models specifically published by ARM as of 2019. The only specific O3 model available is
If none of those are accurate enough for your purposes, you could try to create your own in-order/out-of-order models by parametrizing MinorCPU
/ DerivO3CPU
like HPI
and ex5_big
do, although this could be hard to get right, as there isn't generally enough public information on non-free CPUs to do this without experiments or reverse engineering.
The other thing you will want to think about is the memory system model. There are basically two choices: classical vs Ruby, and within Ruby, several options are available, see also: https://cirosantilli.com/linux-kernel-module-cheat/#gem5-ruby-build
来源:https://stackoverflow.com/questions/58554232/what-is-the-difference-between-the-gem5-cpu-models-and-which-one-is-more-accurat