From 6aa375df2ad3ce2e7d741d09b378503c25547df1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciro=20Santilli=20=E5=85=AD=E5=9B=9B=E4=BA=8B=E4=BB=B6=20?= =?UTF-8?q?=E6=B3=95=E8=BD=AE=E5=8A=9F?= Date: Sat, 7 Sep 2019 00:00:04 +0000 Subject: [PATCH] run: make --num-cpus work in gem5 userland and fs_bigLITTLE.py --- run | 7 ++++--- userland/cpp/thread_return_value.cpp | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/run b/run index 1989e9f..cfaec32 100755 --- a/run +++ b/run @@ -479,6 +479,7 @@ Extra options to append at the end of the emulator command line. cmd.extend([ self.env['gem5_se_file'], LF, '--cmd', self.env['image'], LF, + '--num-cpus', str(self.env['cpus']), LF, # We have to use cpu[0] here because on multi-cpu workloads, # cpu[1] and higher use workload as a proxy to cpu[0].workload. # as can be seen from the config.ini. @@ -498,10 +499,10 @@ Extra options to append at the end of the emulator command line. extra_emulator_args.extend(['-r', str(cpt_dirs_sorted_by_tick.index(cpt_dir) + 1)]) cmd.extend([ self.env['gem5_fs_file'], LF, - '--num-cpus', str(self.env['cpus']), LF, '--disk-image', self.env['disk_image'], LF, '--kernel', self.env['image'], LF, '--mem-size', memory, LF, + '--num-cpus', str(self.env['cpus']), LF, '--script', self.env['gem5_readfile_file'], LF, ]) if self.env['arch'] == 'x86_64': @@ -565,11 +566,11 @@ Extra options to append at the end of the emulator command line. 'arm', 'fs_bigLITTLE.py' ), LF, - '--big-cpus', '2', LF, + '--big-cpus', str((self.env['cpus'] + 1) // 2), LF, '--cpu-type', cpu_type, LF, '--disk', self.env['disk_image'], LF, '--kernel', self.env['image'], LF, - '--little-cpus', '2', LF, + '--little-cpus', str(self.env['cpus'] // 2), LF, ]) if self.env['dtb']: cmd.extend([ diff --git a/userland/cpp/thread_return_value.cpp b/userland/cpp/thread_return_value.cpp index 988eac1..4f2249c 100644 --- a/userland/cpp/thread_return_value.cpp +++ b/userland/cpp/thread_return_value.cpp @@ -1,3 +1,5 @@ +// https://cirosantilli.com/linux-kernel-module-cheat#cpp-multithreading +// // http://stackoverflow.com/questions/7686939/c-simple-return-value-from-stdthread // http://stackoverflow.com/questions/28950835/c-error-no-type-named-type-in-class-stdresult-ofvoid-stdunordered // http://stackoverflow.com/questions/21048906/stdthread-pass-by-reference-calls-copy-constructor