From 4d001f521fee5c5f52f5a5f67fec3bf562205121 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: Wed, 29 May 2019 00:00:02 +0000 Subject: [PATCH] gem5: update to 08c79a194d1a3430801c04f37d13216cc9ec1da3 Fix gem5 userland fatal: kernel too old. Fix https://github.com/cirosantilli/linux-kernel-module-cheat/issues/64 gem5 x86 boot fails with: "Assertion `locked && curr_frag_id == 0' failed So we are now back to mainline gem5! --- README.adoc | 18 +++++------------- run | 1 + submodules/gem5 | 2 +- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/README.adoc b/README.adoc index c1f2edc..3db0a56 100644 --- a/README.adoc +++ b/README.adoc @@ -3648,15 +3648,13 @@ At 125d14805f769104f93c510bedaa685a52ec025d we <> setups, but not on QEMU on Ubuntu 18.04 host. - glibc has a check for kernel version, likely obtained from the `uname` syscall, and if the kernel is not new enough, it quits. -Determining the right number to put there is of course highly non-trivial and would require an extensive userland test suite, which most emulator don't have. +Both gem5 and QEMU however allow setting the reported `uname` version from the command line, which we do to always match our toolchain. -We don't have this failure for QEMU on an 18.04 host, only gem5. +QEMU by default copies the host `uname` value, but we always override it in our scripts. -QEMU by default copies the host `uname` value. However, our scripts set it by default to our the latest Buildroot kernel version with QEMU's `-r` option, which is exposed as `--kernel-version`: +Determining the right number to use for the kernel version is of course highly non-trivial and would require an extensive userland test suite, which most emulator don't have. .... ./run --arch aarch64 --kernel-version 4.18 --userland userland/posix/uname.c @@ -3664,14 +3662,11 @@ QEMU by default copies the host `uname` value. However, our scripts set it by de Source: link:userland/posix/uname.c[]. -gem5 does not have such runtime configuration, but the error can be worked around for now by patching the hardcoded Linux version as mentioned at: https://stackoverflow.com/questions/48959349/how-to-solve-fatal-kernel-too-old-when-running-gem5-in-syscall-emulation-se-m to be a recent Linux version such as `v4.17.0`. - -We override the default QEMU uname because otherwise all executables fail with "kernel too old" on older Ubuntu hosts. The downside is that you might hit syscalls which your host does not have for QEMU to forward to, but we'll let you be the judge of that. - The QEMU source that does this is at: https://github.com/qemu/qemu/blob/v3.1.0/linux-user/syscall.c#L8931 -In gem5, there are tons of missing syscalls, and that number currently just gets bumped up randomly from time to time when someone gets fed up: +Bibliography: +* https://stackoverflow.com/questions/48959349/how-to-solve-fatal-kernel-too-old-when-running-gem5-in-syscall-emulation-se-m * https://stackoverflow.com/questions/53085048/how-to-compile-and-run-an-executable-in-gem5-syscall-emulation-mode-with-se-py/53085049#53085049 * https://gem5-review.googlesource.com/c/public/gem5/+/15855 @@ -3765,7 +3760,6 @@ ld: cannot find -lopenblas Less robust than QEMU's, but still usable: * https://stackoverflow.com/questions/48986597/when-should-you-use-full-system-fs-vs-syscall-emulation-se-with-userland-program -* https://stackoverflow.com/questions/48959349/how-to-solve-fatal-kernel-too-old-when-running-gem5-in-syscall-emulation-se-m There are much more unimplemented syscalls in gem5 than in QEMU. Many of those are trivial to implement however. @@ -10156,8 +10150,6 @@ Sources: * link:bst-vs-heap[] * link:bst-vs-heap.gnuplot[] -Tested on e70103b9b32e6e33dbab9eaf2ff00c358f55d8db + 1 with the workaround patch mentioned at: <>. - ===== BLAS Buildroot supports it, which makes everything just trivial: diff --git a/run b/run index ce1e043..6fbdd49 100755 --- a/run +++ b/run @@ -458,6 +458,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, + '--param', 'system.cpu[:].workload[:].release = "{}"'.format(self.env['kernel_version']), LF, ]) if self.env['userland_args'] is not None: cmd.extend(['--options', self.env['userland_args'], LF]) diff --git a/submodules/gem5 b/submodules/gem5 index 865287d..08c79a1 160000 --- a/submodules/gem5 +++ b/submodules/gem5 @@ -1 +1 @@ -Subproject commit 865287d5b593b84d6ad91946a9ca4c49e24f9595 +Subproject commit 08c79a194d1a3430801c04f37d13216cc9ec1da3