[gem5-dev] Change in public/gem5[master]: arm, sim: fix context switch stats dumps for ARM64/Linux
Paul Rosenfeld has uploaded this change for review. ( https://gem5-review.googlesource.com/2640 Change subject: arm,sim: fix context switch stats dumps for ARM64/Linux .. arm,sim: fix context switch stats dumps for ARM64/Linux 32bit and 64bit Linux have different arguments passed to the __switch_to() function that gem5 hooks into in order to collect context switch statistics. 64bit Linux provides the task_struct pointer to the next task that will be switched to, which means we don't have to look up the task_struct from thread_info as we do in 32bit ARM Linux. This patch adds a second set of accessors to ThreadInfo to extract details such as the pid, tgid, task name, etc., directly from a task_struct. The existing accessors maintain their existing behavior by first looking up the task_struct and then calling these new accessors. A 64-bit variant of the DumpStatsPCEvent class is added that uses these new accessors to get the task details for the context switch dumps directly from the task_struct passed to __switch_to(). Change-Id: I63c4b3e1ad64446751a91f6340901d5180d7382d --- M src/arch/arm/linux/system.cc M src/arch/arm/linux/system.hh M src/arch/generic/linux/threadinfo.hh 3 files changed, 116 insertions(+), 24 deletions(-) diff --git a/src/arch/arm/linux/system.cc b/src/arch/arm/linux/system.cc index 52e075d..7f06475 100644 --- a/src/arch/arm/linux/system.cc +++ b/src/arch/arm/linux/system.cc @@ -236,7 +236,14 @@ LinuxArmSystem::startup() { if (enableContextSwitchStatsDump) { -dumpStatsPCEvent = addKernelFuncEvent("__switch_to"); +if (!highestELIs64()) { +dumpStatsPCEvent = +addKernelFuncEvent("__switch_to"); +} else { +dumpStatsPCEvent = +addKernelFuncEvent("__switch_to"); +} + if (!dumpStatsPCEvent) panic("dumpStatsPCEvent not created!"); @@ -276,25 +283,64 @@ Linux::dumpDmesg(getThreadContext(0), std::cout); } -/** This function is called whenever the the kernel function - * "__switch_to" is called to change running tasks. +/** + * Extracts the information used by the DumpStatsPCEvent by reading the + * thread_info pointer passed to __switch_to() in 32 bit ARM Linux * * r0 = task_struct of the previously running process - * r1 = task_info of the previously running process - * r2 = task_info of the next process to run + * r1 = thread_info of the previously running process + * r2 = thread_info of the next process to run + */ +void +DumpStatsPCEvent::getTaskDetails(ThreadContext *tc, uint32_t , +uint32_t , std::string _task_str, int32_t ) { + +Linux::ThreadInfo ti(tc); +Addr task_descriptor = tc->readIntReg(2); +pid = ti.curTaskPID(task_descriptor); +tgid = ti.curTaskTGID(task_descriptor); +next_task_str = ti.curTaskName(task_descriptor); + +// Streamline treats pid == -1 as the kernel process. +// Also pid == 0 implies idle process (except during Linux boot) +mm = ti.curTaskMm(task_descriptor); +} + +/** + * Extracts the information used by the DumpStatsPCEvent64 by reading the + * task_struct pointer passed to __switch_to() in 64 bit ARM Linux + * + * r0 = task_struct of the previously running process + * r1 = task_struct of next process to run + */ +void +DumpStatsPCEvent64::getTaskDetails(ThreadContext *tc, uint32_t , +uint32_t , std::string _task_str, int32_t ) { + +Linux::ThreadInfo ti(tc); +Addr task_struct = tc->readIntReg(1); +pid = ti.curTaskPIDFromTaskStruct(task_struct); +tgid = ti.curTaskTGIDFromTaskStruct(task_struct); +next_task_str = ti.curTaskNameFromTaskStruct(task_struct); + +// Streamline treats pid == -1 as the kernel process. +// Also pid == 0 implies idle process (except during Linux boot) +mm = ti.curTaskMmFromTaskStruct(task_struct); +} + +/** This function is called whenever the the kernel function + * "__switch_to" is called to change running tasks. */ void DumpStatsPCEvent::process(ThreadContext *tc) { -Linux::ThreadInfo ti(tc); -Addr task_descriptor = tc->readIntReg(2); -uint32_t pid = ti.curTaskPID(task_descriptor); -uint32_t tgid = ti.curTaskTGID(task_descriptor); -std::string next_task_str = ti.curTaskName(task_descriptor); +uint32_t pid = 0; +uint32_t tgid = 0; +std::string next_task_str; +int32_t mm = 0; -// Streamline treats pid == -1 as the kernel process. -// Also pid == 0 implies idle process (except during Linux boot) -int32_t mm = ti.curTaskMm(task_descriptor); +getTaskDetails(tc, pid, tgid, next_task_str, mm); + bool is_kernel = (mm == 0); if (is_kernel && (pid != 0)) { pid = -1; diff --git a/src/arch/arm/linux/system.hh b/src/arch/arm/linux/system.hh index 709776f..247ebae 100644 --- a/src/arch/arm/linux/system.hh +++ b/src/arch/arm/linux/system.hh @@ -132,6 +132,20 @@ {} virtual void
[gem5-dev] Change in public/gem5[master]: scons: bump required python version to 2.7 to support pybind11
Paul Rosenfeld has uploaded this change for review. ( https://gem5-review.googlesource.com/4440 Change subject: scons: bump required python version to 2.7 to support pybind11 .. scons: bump required python version to 2.7 to support pybind11 Change-Id: Ic3652f975477f2e5d144e054489ab73ed9f82b55 --- M SConstruct 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/SConstruct b/SConstruct index e4880e1..b5e3805 100755 --- a/SConstruct +++ b/SConstruct @@ -93,10 +93,9 @@ """ raise -# We ensure the python version early because because python-config -# requires python 2.5 +# pybind11 requires python 2.7 try: -EnsurePythonVersion(2, 5) +EnsurePythonVersion(2, 7) except SystemExit, e: print """ You can use a non-default installation of the Python interpreter by -- To view, visit https://gem5-review.googlesource.com/4440 To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings Gerrit-Project: public/gem5 Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: Ic3652f975477f2e5d144e054489ab73ed9f82b55 Gerrit-Change-Number: 4440 Gerrit-PatchSet: 1 Gerrit-Owner: Paul Rosenfeld___ gem5-dev mailing list gem5-dev@gem5.org http://m5sim.org/mailman/listinfo/gem5-dev
[gem5-dev] Change in public/gem5[master]: scons: detect tcmalloc using pkg-config (if available)
Hello Jason Lowe-Power, Joe Gross, Curtis Dunham, I'd like you to reexamine a change. Please visit https://gem5-review.googlesource.com/4500 to look at the new patch set (#2). Change subject: scons: detect tcmalloc using pkg-config (if available) .. scons: detect tcmalloc using pkg-config (if available) For users of gem5 who do not have permissions to install packages to system locations, pkg-config makes it much easier to detect libraries in custom locations. This patch adds pkg-config library include paths to for non-standard tcmalloc locations. Change-Id: I08241e7fd4299a38d964475af3a7cff0f4cd257e --- M SConstruct 1 file changed, 9 insertions(+), 1 deletion(-) -- To view, visit https://gem5-review.googlesource.com/4500 To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings Gerrit-Project: public/gem5 Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I08241e7fd4299a38d964475af3a7cff0f4cd257e Gerrit-Change-Number: 4500 Gerrit-PatchSet: 2 Gerrit-Owner: Paul RosenfeldGerrit-Reviewer: Curtis Dunham Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: Joe Gross Gerrit-Reviewer: Paul Rosenfeld ___ gem5-dev mailing list gem5-dev@gem5.org http://m5sim.org/mailman/listinfo/gem5-dev
[gem5-dev] Change in public/gem5[master]: scons: detect tcmalloc using pkg-config (if available)
Paul Rosenfeld has uploaded this change for review. ( https://gem5-review.googlesource.com/4500 Change subject: scons: detect tcmalloc using pkg-config (if available) .. scons: detect tcmalloc using pkg-config (if available) For users of gem5 who do not have permissions to install packages to system locations, pkg-config makes it much easier to detect libraries in custom locations. This patch adds pkg-config library include paths to for non-standard tcmalloc locations. Change-Id: I08241e7fd4299a38d964475af3a7cff0f4cd257e --- M SConstruct 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/SConstruct b/SConstruct index e4880e1..eda5966 100755 --- a/SConstruct +++ b/SConstruct @@ -888,6 +888,8 @@ # cygwin has some header file issues... main.Append(CCFLAGS=["-Wno-uninitialized"]) +has_pkg_config = readCommand(['pkg-config', '--version'], exception='') + # Check for the protobuf compiler protoc_version = readCommand([main['PROTOC'], '--version'], exception='').split() @@ -917,7 +919,7 @@ # protobuf without the involvement of pkg-config. Later on we # check go a library config check and at that point the test # will fail if libprotobuf cannot be found. -if readCommand(['pkg-config', '--version'], exception=''): +if has_pkg_config: try: # Attempt to establish what linking flags to add for protobuf # using pkg-config @@ -1096,6 +1098,9 @@ 'timer_create(CLOCK_MONOTONIC, NULL, NULL);') if not GetOption('without_tcmalloc'): +if has_pkg_config: +main.ParseConfig('pkg-config --libs-only-L libtcmalloc') +main.ParseConfig('pkg-config --libs-only-L libtcmalloc_minimal') if conf.CheckLib('tcmalloc'): main.Append(CCFLAGS=main['TCMALLOC_CCFLAGS']) elif conf.CheckLib('tcmalloc_minimal'): -- To view, visit https://gem5-review.googlesource.com/4500 To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings Gerrit-Project: public/gem5 Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I08241e7fd4299a38d964475af3a7cff0f4cd257e Gerrit-Change-Number: 4500 Gerrit-PatchSet: 1 Gerrit-Owner: Paul RosenfeldGerrit-Reviewer: Curtis Dunham Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: Joe Gross Gerrit-Reviewer: Paul Rosenfeld ___ gem5-dev mailing list gem5-dev@gem5.org http://m5sim.org/mailman/listinfo/gem5-dev
[gem5-dev] Change in public/gem5[master]: arm, sim: fix context switch stats dumps for ARM64/Linux
Paul Rosenfeld has submitted this change and it was merged. ( https://gem5-review.googlesource.com/2640 ) Change subject: arm,sim: fix context switch stats dumps for ARM64/Linux .. arm,sim: fix context switch stats dumps for ARM64/Linux 32bit and 64bit Linux have different arguments passed to the __switch_to() function that gem5 hooks into in order to collect context switch statistics. 64bit Linux provides the task_struct pointer to the next task that will be switched to, which means we don't have to look up the task_struct from thread_info as we do in 32bit ARM Linux. This patch adds a second set of accessors to ThreadInfo to extract details such as the pid, tgid, task name, etc., directly from a task_struct. The existing accessors maintain their existing behavior by first looking up the task_struct and then calling these new accessors. A 64-bit variant of the DumpStatsPCEvent class is added that uses these new accessors to get the task details for the context switch dumps directly from the task_struct passed to __switch_to(). Change-Id: I63c4b3e1ad64446751a91f6340901d5180d7382d Reviewed-on: https://gem5-review.googlesource.com/2640 Reviewed-by: Curtis DunhamReviewed-by: Jason Lowe-Power Reviewed-by: Pau Cabre Reviewed-by: Andreas Sandberg Maintainer: Andreas Sandberg --- M src/arch/arm/linux/system.cc M src/arch/arm/linux/system.hh M src/arch/generic/linux/threadinfo.hh 3 files changed, 116 insertions(+), 24 deletions(-) Approvals: Jason Lowe-Power: Looks good to me, but someone else must approve Andreas Sandberg: Looks good to me, approved; Looks good to me, approved Curtis Dunham: Looks good to me, but someone else must approve Pau Cabre: Looks good to me, but someone else must approve diff --git a/src/arch/arm/linux/system.cc b/src/arch/arm/linux/system.cc index 52e075d..7f06475 100644 --- a/src/arch/arm/linux/system.cc +++ b/src/arch/arm/linux/system.cc @@ -236,7 +236,14 @@ LinuxArmSystem::startup() { if (enableContextSwitchStatsDump) { -dumpStatsPCEvent = addKernelFuncEvent("__switch_to"); +if (!highestELIs64()) { +dumpStatsPCEvent = +addKernelFuncEvent("__switch_to"); +} else { +dumpStatsPCEvent = +addKernelFuncEvent("__switch_to"); +} + if (!dumpStatsPCEvent) panic("dumpStatsPCEvent not created!"); @@ -276,25 +283,64 @@ Linux::dumpDmesg(getThreadContext(0), std::cout); } -/** This function is called whenever the the kernel function - * "__switch_to" is called to change running tasks. +/** + * Extracts the information used by the DumpStatsPCEvent by reading the + * thread_info pointer passed to __switch_to() in 32 bit ARM Linux * * r0 = task_struct of the previously running process - * r1 = task_info of the previously running process - * r2 = task_info of the next process to run + * r1 = thread_info of the previously running process + * r2 = thread_info of the next process to run + */ +void +DumpStatsPCEvent::getTaskDetails(ThreadContext *tc, uint32_t , +uint32_t , std::string _task_str, int32_t ) { + +Linux::ThreadInfo ti(tc); +Addr task_descriptor = tc->readIntReg(2); +pid = ti.curTaskPID(task_descriptor); +tgid = ti.curTaskTGID(task_descriptor); +next_task_str = ti.curTaskName(task_descriptor); + +// Streamline treats pid == -1 as the kernel process. +// Also pid == 0 implies idle process (except during Linux boot) +mm = ti.curTaskMm(task_descriptor); +} + +/** + * Extracts the information used by the DumpStatsPCEvent64 by reading the + * task_struct pointer passed to __switch_to() in 64 bit ARM Linux + * + * r0 = task_struct of the previously running process + * r1 = task_struct of next process to run + */ +void +DumpStatsPCEvent64::getTaskDetails(ThreadContext *tc, uint32_t , +uint32_t , std::string _task_str, int32_t ) { + +Linux::ThreadInfo ti(tc); +Addr task_struct = tc->readIntReg(1); +pid = ti.curTaskPIDFromTaskStruct(task_struct); +tgid = ti.curTaskTGIDFromTaskStruct(task_struct); +next_task_str = ti.curTaskNameFromTaskStruct(task_struct); + +// Streamline treats pid == -1 as the kernel process. +// Also pid == 0 implies idle process (except during Linux boot) +mm = ti.curTaskMmFromTaskStruct(task_struct); +} + +/** This function is called whenever the the kernel function + * "__switch_to" is called to change running tasks. */ void DumpStatsPCEvent::process(ThreadContext *tc) { -Linux::ThreadInfo ti(tc); -Addr task_descriptor = tc->readIntReg(2); -uint32_t pid = ti.curTaskPID(task_descriptor); -uint32_t tgid = ti.curTaskTGID(task_descriptor); -std::string next_task_str = ti.curTaskName(task_descriptor); +uint32_t pid = 0; +uint32_t
[gem5-dev] Change in public/gem5[master]: misc: fix build failure in cxx_config example
Paul Rosenfeld has uploaded this change for review. ( https://gem5-review.googlesource.com/3000 Change subject: misc: fix build failure in cxx_config example .. misc: fix build failure in cxx_config example Fix a missing header in the cxx_config example which is used as a simple example of using libgem5.so without python. Change-Id: I758bfe42ba735ce0c7eaedd49b94a130e3bd21e3 --- M util/cxx_config/main.cc 1 file changed, 1 insertion(+), 0 deletions(-) diff --git a/util/cxx_config/main.cc b/util/cxx_config/main.cc index 0356aea..88bdec0 100644 --- a/util/cxx_config/main.cc +++ b/util/cxx_config/main.cc @@ -68,6 +68,7 @@ #include "sim/cxx_manager.hh" #include "sim/init_signals.hh" #include "sim/serialize.hh" +#include "sim/sim_events.hh" #include "sim/simulate.hh" #include "sim/stat_control.hh" #include "sim/system.hh" -- To view, visit https://gem5-review.googlesource.com/3000 To unsubscribe, visit https://gem5-review.googlesource.com/settings Gerrit-Project: public/gem5 Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I758bfe42ba735ce0c7eaedd49b94a130e3bd21e3 Gerrit-Change-Number: 3000 Gerrit-PatchSet: 1 Gerrit-Owner: Paul Rosenfeld___ gem5-dev mailing list gem5-dev@gem5.org http://m5sim.org/mailman/listinfo/gem5-dev
[gem5-dev] Change in public/gem5[master]: misc: fix build failure in cxx_config example
Paul Rosenfeld has submitted this change and it was merged. ( https://gem5-review.googlesource.com/3000 ) Change subject: misc: fix build failure in cxx_config example .. misc: fix build failure in cxx_config example Fix a missing header in the cxx_config example which is used as a simple example of using libgem5.so without python. Change-Id: I758bfe42ba735ce0c7eaedd49b94a130e3bd21e3 Reviewed-on: https://gem5-review.googlesource.com/3000 Reviewed-by: Andreas SandbergReviewed-by: Jason Lowe-Power Reviewed-by: Curtis Dunham Reviewed-by: Matthias Jung Maintainer: Andreas Sandberg --- M util/cxx_config/main.cc 1 file changed, 1 insertion(+), 0 deletions(-) Approvals: Jason Lowe-Power: Looks good to me, approved Andreas Sandberg: Looks good to me, approved; Looks good to me, approved Curtis Dunham: Looks good to me, approved Matthias Jung: Looks good to me, approved diff --git a/util/cxx_config/main.cc b/util/cxx_config/main.cc index 0356aea..88bdec0 100644 --- a/util/cxx_config/main.cc +++ b/util/cxx_config/main.cc @@ -68,6 +68,7 @@ #include "sim/cxx_manager.hh" #include "sim/init_signals.hh" #include "sim/serialize.hh" +#include "sim/sim_events.hh" #include "sim/simulate.hh" #include "sim/stat_control.hh" #include "sim/system.hh" -- To view, visit https://gem5-review.googlesource.com/3000 To unsubscribe, visit https://gem5-review.googlesource.com/settings Gerrit-Project: public/gem5 Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: I758bfe42ba735ce0c7eaedd49b94a130e3bd21e3 Gerrit-Change-Number: 3000 Gerrit-PatchSet: 2 Gerrit-Owner: Paul Rosenfeld Gerrit-Reviewer: Andreas Sandberg Gerrit-Reviewer: Curtis Dunham Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: Matthias Jung Gerrit-Reviewer: Paul Rosenfeld ___ gem5-dev mailing list gem5-dev@gem5.org http://m5sim.org/mailman/listinfo/gem5-dev
[gem5-dev] Change in public/gem5[master]: scons: bump required python version to 2.7 to support pybind11
Paul Rosenfeld has submitted this change and it was merged. ( https://gem5-review.googlesource.com/4440 ) Change subject: scons: bump required python version to 2.7 to support pybind11 .. scons: bump required python version to 2.7 to support pybind11 Change-Id: Ic3652f975477f2e5d144e054489ab73ed9f82b55 Reviewed-on: https://gem5-review.googlesource.com/4440 Reviewed-by: Andreas SandbergReviewed-by: Gabe Black Reviewed-by: Jason Lowe-Power Reviewed-by: Joe Gross Maintainer: Andreas Sandberg --- M SConstruct 1 file changed, 2 insertions(+), 3 deletions(-) Approvals: Jason Lowe-Power: Looks good to me, but someone else must approve Andreas Sandberg: Looks good to me, approved; Looks good to me, approved Gabe Black: Looks good to me, approved Joe Gross: Looks good to me, but someone else must approve diff --git a/SConstruct b/SConstruct index e4880e1..b5e3805 100755 --- a/SConstruct +++ b/SConstruct @@ -93,10 +93,9 @@ """ raise -# We ensure the python version early because because python-config -# requires python 2.5 +# pybind11 requires python 2.7 try: -EnsurePythonVersion(2, 5) +EnsurePythonVersion(2, 7) except SystemExit, e: print """ You can use a non-default installation of the Python interpreter by -- To view, visit https://gem5-review.googlesource.com/4440 To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings Gerrit-Project: public/gem5 Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: Ic3652f975477f2e5d144e054489ab73ed9f82b55 Gerrit-Change-Number: 4440 Gerrit-PatchSet: 3 Gerrit-Owner: Paul Rosenfeld Gerrit-Reviewer: Andreas Sandberg Gerrit-Reviewer: Anthony Gutierrez Gerrit-Reviewer: Bradford Beckmann Gerrit-Reviewer: Gabe Black Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: Joe Gross Gerrit-Reviewer: Paul Rosenfeld ___ gem5-dev mailing list gem5-dev@gem5.org http://m5sim.org/mailman/listinfo/gem5-dev
[gem5-dev] Change in public/gem5[master]: scons: detect tcmalloc using pkg-config (if available)
Hello Gabe Black, Jason Lowe-Power, Joe Gross, Curtis Dunham, I'd like you to reexamine a change. Please visit https://gem5-review.googlesource.com/4500 to look at the new patch set (#4). Change subject: scons: detect tcmalloc using pkg-config (if available) .. scons: detect tcmalloc using pkg-config (if available) For users of gem5 who do not have permissions to install packages to system locations, pkg-config makes it much easier to detect libraries in custom locations. This patch adds pkg-config library search paths for non-standard tcmalloc locations. Change-Id: I08241e7fd4299a38d964475af3a7cff0f4cd257e --- M SConstruct 1 file changed, 9 insertions(+), 1 deletion(-) -- To view, visit https://gem5-review.googlesource.com/4500 To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings Gerrit-Project: public/gem5 Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I08241e7fd4299a38d964475af3a7cff0f4cd257e Gerrit-Change-Number: 4500 Gerrit-PatchSet: 4 Gerrit-Owner: Paul RosenfeldGerrit-Reviewer: Curtis Dunham Gerrit-Reviewer: Gabe Black Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: Joe Gross Gerrit-Reviewer: Paul Rosenfeld ___ gem5-dev mailing list gem5-dev@gem5.org http://m5sim.org/mailman/listinfo/gem5-dev