Ver código fonte

qemu: fix resource exhaustion building QEMU TCTI

osy 3 anos atrás
pai
commit
9f6ab1d5b8
2 arquivos alterados com 67 adições e 2 exclusões
  1. 0 2
      .github/workflows/build.yml
  2. 67 0
      patches/qemu-7.0.0-utm.patch

+ 0 - 2
.github/workflows/build.yml

@@ -69,8 +69,6 @@ jobs:
       - name: Build Sysroot
       - name: Build Sysroot
         if: steps.cache-sysroot.outputs.cache-hit != 'true' || github.event.inputs.rebuild_sysroot == 'true'
         if: steps.cache-sysroot.outputs.cache-hit != 'true' || github.event.inputs.rebuild_sysroot == 'true'
         run: ./scripts/build_dependencies.sh -p ${{ matrix.platform }} -a ${{ matrix.arch }}
         run: ./scripts/build_dependencies.sh -p ${{ matrix.platform }} -a ${{ matrix.arch }}
-        env:
-          NCPU: ${{ matrix.platform == 'ios-tci' && '1' || '0' }} # limit 1 CPU for TCI build due to memory issues, 0 = unlimited for other builds
       - name: Compress Sysroot
       - name: Compress Sysroot
         if: steps.cache-sysroot.outputs.cache-hit != 'true' || github.event_name == 'release' || github.event.inputs.test_release == 'true'
         if: steps.cache-sysroot.outputs.cache-hit != 'true' || github.event_name == 'release' || github.event.inputs.test_release == 'true'
         run: tar -acf sysroot.tgz sysroot*
         run: tar -acf sysroot.tgz sysroot*

+ 67 - 0
patches/qemu-7.0.0-utm.patch

@@ -594,3 +594,70 @@ index e139f7115e1f..765892f84f1c 100644
          qemu_console_get_height(s, -1) == height) {
          qemu_console_get_height(s, -1) == height) {
          return;
          return;
      }
      }
+From 7f65c39e6865763cb8a614a8903b25f23a9a8683 Mon Sep 17 00:00:00 2001
+From: osy <50960678+osy@users.noreply.github.com>
+Date: Fri, 19 Aug 2022 14:07:10 -0700
+Subject: [PATCH] tcg-tcti: fix memory usage issues with clang build
+
+Build with -O0 to avoid blowing up the memory during build.
+---
+ meson.build     | 12 ++++++++++++
+ tcg/meson.build |  8 +++++++-
+ 2 files changed, 19 insertions(+), 1 deletion(-)
+
+diff --git a/meson.build b/meson.build
+index d66b73d009..b144789c5e 100644
+--- a/meson.build
++++ b/meson.build
+@@ -2649,6 +2649,7 @@ qom_ss = ss.source_set()
+ softmmu_ss = ss.source_set()
+ specific_fuzz_ss = ss.source_set()
+ specific_ss = ss.source_set()
++specific_nooptimize_ss = ss.source_set()
+ stub_ss = ss.source_set()
+ trace_ss = ss.source_set()
+ user_ss = ss.source_set()
+@@ -3217,6 +3218,17 @@ foreach target : target_dirs
+   arch_srcs += target_specific.sources()
+   arch_deps += target_specific.dependencies()
+ 
++  nooptimize_ss = specific_nooptimize_ss.apply(config_target, strict: false)
++  if nooptimize_ss.sources().length() > 0
++    libnooptimize = static_library('qemu-' + target + '-nooptimize',
++                                   sources: genh + nooptimize_ss.sources(),
++                                   include_directories: target_inc,
++                                   dependencies: nooptimize_ss.dependencies(),
++                                   c_args: c_args + '-O0')
++    nooptimize = declare_dependency(link_whole: libnooptimize)
++    arch_deps += nooptimize
++  endif
++
+   if config_all.has_key('CONFIG_SHARED_LIBRARY_BUILD')
+     build_lib_args = {
+       'target_type': 'shared_library',
+diff --git a/tcg/meson.build b/tcg/meson.build
+index c4c63b19d4..16c226e114 100644
+--- a/tcg/meson.build
++++ b/tcg/meson.build
+@@ -3,7 +3,6 @@ tcg_ss = ss.source_set()
+ tcg_ss.add(files(
+   'optimize.c',
+   'region.c',
+-  'tcg.c',
+   'tcg-common.c',
+   'tcg-op.c',
+   'tcg-op-gvec.c',
+@@ -18,3 +17,10 @@ if get_option('tcg_interpreter')
+ endif
+ 
+ specific_ss.add_all(when: 'CONFIG_TCG', if_true: tcg_ss)
++
++# TCTI requires -O0 or otherwise clang memory usage blows up
++if get_option('tcg_threaded_interpreter')
++  specific_nooptimize_ss.add(when: 'CONFIG_TCG', if_true: files('tcg.c'))
++else
++  specific_ss.add(when: 'CONFIG_TCG', if_true: files('tcg.c'))
++endif
+-- 
+2.28.0
+