sim-se: add a release parameter to Process.py
authorCiro Santilli <ciro.santilli@arm.com>
Tue, 21 May 2019 15:36:32 +0000 (16:36 +0100)
committerCiro Santilli <ciro.santilli@arm.com>
Wed, 29 May 2019 09:34:37 +0000 (09:34 +0000)
Set the default release to that single value for all ISAs.

glibc has checks for the kernel version based on uname, and refuses
to start any syscall emulation programs if those checks don't pass with
error:

FATAL: kernel too old

The ideal solution to this problem is to actually implement all missing
system calls for the required kernel version and bumping the release
accordingly.

However, it is very hard to implement all missing syscalls and verify
compliance.

Previously, we have simply bumped the version manually from time to
time when major glibc versions started breaking.

This commit alleviates the problem in two ways.

Firstly, having a single kernel version for all versions means that it is
easier to bump all versions at once.

Secondly, it makes it is possible to set the release with a parameter,
which in turn can be set from the command line with:

se.py --param 'system.cpu[:].workload[:].release = "4.18.0"'

Change-Id: I9e3c31073bfe68735f7b0775c8e299aa62b98222
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/17849
Maintainer: Brandon Potter <Brandon.Potter@amd.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/arch/alpha/linux/process.cc
src/arch/arm/linux/process.cc
src/arch/mips/linux/process.cc
src/arch/power/linux/process.cc
src/arch/riscv/linux/process.cc
src/arch/sparc/linux/syscalls.cc
src/arch/sparc/solaris/process.cc
src/arch/x86/linux/process.cc
src/sim/Process.py
src/sim/process.cc
src/sim/process.hh

index de89410ace2313bbb45be1fb497cff5e127c198b..d342c5d2d0e31b4efcfaab5c813a2e8c637a616d 100644 (file)
@@ -85,7 +85,7 @@ unameFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
 
     strcpy(name->sysname, "Linux");
     strcpy(name->nodename, "sim.gem5.org");
-    strcpy(name->release, "3.0.0");
+    strcpy(name->release, process->release.c_str());
     strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003");
     strcpy(name->machine, "alpha");
 
index 25bccb6b673edd2ad555de88747efbc227cab4a0..3fcb01fe770f67f3b4d1e1c69a6250e7f56f65ad 100644 (file)
@@ -113,7 +113,7 @@ unameFunc32(SyscallDesc *desc, int callnum, ThreadContext *tc)
 
     strcpy(name->sysname, "Linux");
     strcpy(name->nodename, "m5.eecs.umich.edu");
-    strcpy(name->release, "3.7.0+");
+    strcpy(name->release, process->release.c_str());
     strcpy(name->version, "#1 SMP Sat Dec  1 00:00:00 GMT 2012");
     strcpy(name->machine, "armv7l");
 
@@ -131,7 +131,7 @@ unameFunc64(SyscallDesc *desc, int callnum, ThreadContext *tc)
 
     strcpy(name->sysname, "Linux");
     strcpy(name->nodename, "gem5");
-    strcpy(name->release, "4.10.8+");
+    strcpy(name->release, process->release.c_str());
     strcpy(name->version, "#1 SMP Sat Dec  1 00:00:00 GMT 2012");
     strcpy(name->machine, "armv8l");
 
index 8a4811a0450b2d4e0b80aea8a63fa9eb44db417b..9efaf2624734df73ad4197d65430f602421cbee3 100644 (file)
@@ -88,7 +88,7 @@ unameFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
 
     strcpy(name->sysname, "Linux");
     strcpy(name->nodename,"sim.gem5.org");
-    strcpy(name->release, "3.0.0");
+    strcpy(name->release, process->release.c_str());
     strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003");
     strcpy(name->machine, "mips");
 
index 58e7eb5070f076ead9b93a29e031165bff53a70a..8a5cd137c9fe9c34ca4dfc0190d110545423b608 100644 (file)
@@ -88,7 +88,7 @@ unameFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
 
     strcpy(name->sysname, "Linux");
     strcpy(name->nodename, "sim.gem5.org");
-    strcpy(name->release, "3.0.0");
+    strcpy(name->release, process->release.c_str());
     strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003");
     strcpy(name->machine, "power");
 
index f3f328e48d2713261bec1e715e6fc21fa88aa691..8aebd558e4b507d639b267880f8eb2ccca4984e4 100644 (file)
@@ -96,7 +96,7 @@ unameFunc64(SyscallDesc *desc, int callnum, ThreadContext *tc)
 
     strcpy(name->sysname, "Linux");
     strcpy(name->nodename,"sim.gem5.org");
-    strcpy(name->release, "3.0.0");
+    strcpy(name->release, process->release.c_str());
     strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003");
     strcpy(name->machine, "riscv64");
 
@@ -114,7 +114,7 @@ unameFunc32(SyscallDesc *desc, int callnum, ThreadContext *tc)
 
     strcpy(name->sysname, "Linux");
     strcpy(name->nodename,"sim.gem5.org");
-    strcpy(name->release, "3.0.0");
+    strcpy(name->release, process->release.c_str());
     strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003");
     strcpy(name->machine, "riscv32");
 
index 9cf08b7b3fc8a37561f6945dcc541b0a71cd45f5..70d1b2af60e6f83e88317c674dbeb7524aadac94 100644 (file)
@@ -47,7 +47,7 @@ unameFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
 
     strcpy(name->sysname, "Linux");
     strcpy(name->nodename, "sim.gem5.org");
-    strcpy(name->release, "3.0.0-sparc64");
+    strcpy(name->release, process->release.c_str());
     strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003");
     strcpy(name->machine, "sparc");
 
index 0b67f53d3971a2c32d48222be4de8e7839f26890..3a13229ed364c08858df99c9ebb7481574d70936 100644 (file)
@@ -80,7 +80,7 @@ unameFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
 
     strcpy(name->sysname, "SunOS");
     strcpy(name->nodename, "m5.eecs.umich.edu");
-    strcpy(name->release, "5.9"); //?? do we want this or something newer?
+    strcpy(name->release, process->release.c_str());
     strcpy(name->version, "Generic_118558-21");
     strcpy(name->machine, "sun4u");
 
index 98a68b40983d8f470f2f29e5df73bd071517e25e..d38b168fde7c1c51630f6af4ed6215a3a1936e3e 100644 (file)
@@ -99,7 +99,7 @@ unameFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
 
     strcpy(name->sysname, "Linux");
     strcpy(name->nodename, "sim.gem5.org");
-    strcpy(name->release, "3.2.0");
+    strcpy(name->release, process->release.c_str());
     strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003");
     strcpy(name->machine, "x86_64");
 
index 73a0145fd38015e202b3482d17f14691a5f15fff..6714ee5603c82b0819867392b3e14236b116c8af 100644 (file)
@@ -62,6 +62,7 @@ class Process(SimObject):
     cwd = Param.String(getcwd(), "current working directory")
     simpoint = Param.UInt64(0, 'simulation point at which to start simulation')
     drivers = VectorParam.EmulatedDriver([], 'Available emulated drivers')
+    release = Param.String('5.1.0', "Linux kernel uname release")
 
     @classmethod
     def export_methods(cls, code):
index 90d0e5d55b50dd8807ceeb2b0304ed27139cd65a..f647467b8bb985e9bfb0b796e1f3f807ac491bfb 100644 (file)
@@ -97,6 +97,7 @@ Process::Process(ProcessParams *params, EmulationPageTable *pTable,
       executable(params->executable),
       tgtCwd(normalize(params->cwd)),
       hostCwd(checkPathRedirect(tgtCwd)),
+      release(params->release),
       _uid(params->uid), _euid(params->euid),
       _gid(params->gid), _egid(params->egid),
       _pid(params->pid), _ppid(params->ppid),
index 27c56960246c420f99d4eadebce14f738578cfa4..23ed6d661c59c82027fa103fdb6b43786ad3739f 100644 (file)
@@ -224,6 +224,9 @@ class Process : public SimObject
     std::string tgtCwd;
     std::string hostCwd;
 
+    // Syscall emulation uname release.
+    std::string release;
+
     // Id of the owner of the process
     uint64_t _uid;
     uint64_t _euid;