CI: Upgrade QEMU to 7.2.0 (#6102)
* ci: Update QEMU to 7.2.0 * ci: Drop QEMU madvise patch This seems to have been upstreamed in: https://lists.gnu.org/archive/html/qemu-devel/2022-06/msg03752.html Running the full CI to ensure this works on all arches. prtest:full
This commit is contained in:
5
.github/workflows/main.yml
vendored
5
.github/workflows/main.yml
vendored
@@ -363,7 +363,7 @@ jobs:
|
||||
name: ${{ matrix.name }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
env:
|
||||
QEMU_BUILD_VERSION: 6.1.0
|
||||
QEMU_BUILD_VERSION: 7.2.0
|
||||
strategy:
|
||||
matrix: ${{ fromJson(needs.determine.outputs.test-matrix) }}
|
||||
steps:
|
||||
@@ -387,7 +387,7 @@ jobs:
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ runner.tool_cache }}/qemu
|
||||
key: qemu-${{ matrix.target }}-${{ env.QEMU_BUILD_VERSION }}-patchmadvise2
|
||||
key: qemu-${{ matrix.target }}-${{ env.QEMU_BUILD_VERSION }}
|
||||
if: matrix.target != '' && matrix.os == 'ubuntu-latest'
|
||||
- name: Install cross-compilation tools
|
||||
run: |
|
||||
@@ -420,7 +420,6 @@ jobs:
|
||||
# quickly.
|
||||
curl https://download.qemu.org/qemu-$QEMU_BUILD_VERSION.tar.xz | tar xJf -
|
||||
cd qemu-$QEMU_BUILD_VERSION
|
||||
patch -p1 < $GITHUB_WORKSPACE/ci/qemu-madvise.patch
|
||||
./configure --target-list=${{ matrix.qemu_target }} --prefix=${{ runner.tool_cache}}/qemu --disable-tools --disable-slirp --disable-fdt --disable-capstone --disable-docs
|
||||
ninja -C build install
|
||||
touch ${{ runner.tool_cache }}/qemu/built
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
From 1ec3de1634195a4d4410cc33fdc66c68057e16a3 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Fallin <chris@cfallin.org>
|
||||
Date: Sat, 5 Feb 2022 22:45:58 -0800
|
||||
Subject: [PATCH] Emulate Linux madvise() properly when possible.
|
||||
|
||||
Curently madvise() is not emulated for Linux targets because it is not
|
||||
trivial to emulate when the guest and host page sizes differ -- in this
|
||||
case, mmap()s are not passed straight through, so the semantics of
|
||||
various MADV_* flags are not trivial to replicate.
|
||||
|
||||
However, if the guest and host are both Linux, and the page sizes are
|
||||
the same on both ends (which is often the case, e.g. 4KiB for x86-64,
|
||||
aarch64, s390x, and possibly others), then the mmap()s are in fact
|
||||
passed straight through. Furthermore, the MADV_* flags are defined in
|
||||
target-independent headers, so we can pass the base, length, and
|
||||
`advice` arugments to `madvise()` straight through.
|
||||
|
||||
This patch alters the Linux-userspace syscall emulation to do just that,
|
||||
passing through the `madvise()` calls when possible and returning
|
||||
`EINVAL` otherwise so the guest is properly informed that the desired
|
||||
semantics (e.g., MADV_DONTNEED to clear memory) are not available.
|
||||
---
|
||||
linux-user/syscall.c | 22 ++++++++++++++++------
|
||||
1 file changed, 16 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
|
||||
index 5950222a77..836e39df5f 100644
|
||||
--- a/linux-user/syscall.c
|
||||
+++ b/linux-user/syscall.c
|
||||
@@ -11853,12 +11853,22 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
|
||||
|
||||
#ifdef TARGET_NR_madvise
|
||||
case TARGET_NR_madvise:
|
||||
- /* A straight passthrough may not be safe because qemu sometimes
|
||||
- turns private file-backed mappings into anonymous mappings.
|
||||
- This will break MADV_DONTNEED.
|
||||
- This is a hint, so ignoring and returning success is ok. */
|
||||
- return 0;
|
||||
-#endif
|
||||
+#ifdef __linux__
|
||||
+ /* If the host is Linux, and the guest and host page sizes are the
|
||||
+ * same, then mmaps will have been passed through one-to-one, so we can
|
||||
+ * rely on the madvise semantics of the host. Note that the advice
|
||||
+ * argument (arg3) is fully architecture-independent. */
|
||||
+ if (TARGET_PAGE_SIZE == sysconf(_SC_PAGESIZE)) {
|
||||
+ return get_errno(madvise(g2h_untagged(arg1), (size_t)arg2, (int)arg3));
|
||||
+ } else {
|
||||
+ return -TARGET_EINVAL;
|
||||
+ }
|
||||
+#else // __linux__
|
||||
+ /* We will not be able to emulate the Linux-specific semantics, so we
|
||||
+ * raise an error. */
|
||||
+ return -TARGET_EINVAL;
|
||||
+#endif // !__linux__
|
||||
+#endif // TARGET_NR_madvise
|
||||
#ifdef TARGET_NR_fcntl64
|
||||
case TARGET_NR_fcntl64:
|
||||
{
|
||||
--
|
||||
2.34.1
|
||||
|
||||
Reference in New Issue
Block a user