Reputation: 81
I was wondering if there is a way to differentiate between different logical (software) threads in gem5. I am trying to collect some stats for each logical thread and so far all I could find in gem5 is access to physical threads. I know that logical threads is the responsibility of the OS but is there anyway for gem5 to access the logical thread ID.
One option is to pin threads to cores but this only works if the number of cores is at least equal to the number of logical threads. However, I will need to run some experiments where the number of logical threads exceed the number of cores, in which case, multiple logical threads will be assigned to the same core and in order to differentiate between them I need the logical thread ID.
Thank you very much in advance.
Upvotes: 2
Views: 516
Reputation: 4073
I don't have a solution for stats unfortunately.
But at least for debugging purposes, on arm/arm64 full system Linux, if you build the kernel with CONFIG_PID_IN_CONTEXTIDR
, then the kernel saves the PID of each process in the CONTEXTIDR_EL1
system register before running the process from the scheduler.
And CONTEXTIDR_EL1
already shows by default on an --debug-flag Exec
on the A
field, e.g.:
336757437500: ExecEnable: system.cpu: A39 T0 : 0x400ffc : ret : IntAlu : flags=(IsInteger|IsControl|IsIndirectControl|IsUncondControl|IsReturn)
indicates that this instruction ran for process PID 39.
Here is my precise setup and further interpretation of the option: https://github.com/cirosantilli/linux-kernel-module-cheat/tree/7235857b1b9ab3e646204d9e13df0104ce1a4174#config_pid_in_contextidr
While this does not help with the stats immediately, it provides a reasonable starting point to either:
I don't think however there is a multi-process stat framework in gem5, you'd need to add that in either case.
Related:
Please always clarify if you are working on full system, or syscall emulation if that seems to make a difference, as the replies can be quite different.
Upvotes: 2