Merge tag 'v2.8.0-rc4' into develop
authorSeokYeon Hwang <syeon.hwang@samsung.com>
Tue, 20 Dec 2016 01:13:15 +0000 (10:13 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Tue, 20 Dec 2016 01:13:15 +0000 (10:13 +0900)
v2.8.0-rc4 release

Change-Id: I0158b5078d1af545dc32a51f10d2f8f0b96543a6
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
58 files changed:
1  2 
.gitignore
Makefile
Makefile.objs
Makefile.target
accel.c
arch_init.c
block.c
block/raw-win32.c
blockdev.c
configure
cpu-exec.c
cpus.c
docs/qmp-commands.txt
exec.c
fsdev/9p-iov-marshal.c
fsdev/9p-marshal.c
fsdev/9p-marshal.h
fsdev/file-op-9p.h
hmp-commands.hx
hmp.c
hmp.h
hw/9pfs/9p.h
hw/9pfs/cofile.c
hw/Makefile.objs
hw/acpi/ich9.c
hw/acpi/piix4.c
hw/arm/Makefile.objs
hw/i386/pc.c
hw/i386/pc_piix.c
hw/input/ps2.c
hw/intc/apic_common.c
include/qemu/atomic.h
include/qemu/error-report.h
include/qom/cpu.h
include/sysemu/arch_init.h
include/ui/console.h
main-loop.c
monitor.c
net/net.c
net/slirp.c
net/tap.c
qapi-schema.json
qemu-char.c
qemu-options.hx
target-i386/monitor.c
target-i386/translate.c
target-s390x/kvm.c
tcg/tcg.c
ui/cocoa.m
ui/console.c
ui/spice-core.c
ui/spice-display.c
util/coroutine-win32.c
util/oslib-posix.c
util/oslib-win32.c
util/qemu-coroutine.c
util/qemu-thread-posix.c
vl.c

diff --cc .gitignore
Simple merge
diff --cc Makefile
Simple merge
diff --cc Makefile.objs
Simple merge
diff --cc Makefile.target
@@@ -168,14 -157,8 +169,14 @@@ els
  obj-y += hw/$(TARGET_BASE_ARCH)/
  endif
  
- GENERATED_HEADERS += hmp-commands.h hmp-commands-info.h qmp-commands-old.h
+ GENERATED_HEADERS += hmp-commands.h hmp-commands-info.h
  
 +# Makefile for TIZEN-maru
 +ifdef CONFIG_MARU
 +obj-y += tizen/src/
 +endif
 +##
 +
  endif # CONFIG_SOFTMMU
  
  # Workaround for http://gcc.gnu.org/PR55489, see configure.
diff --cc accel.c
+++ b/accel.c
@@@ -33,9 -33,6 +33,8 @@@
  #include "sysemu/qtest.h"
  #include "hw/xen/xen.h"
  #include "qom/object.h"
- #include "hw/boards.h"
 +#include "sysemu/hax.h"
 +#include "qemu/error-report.h"
  
  int tcg_tb_size;
  static bool tcg_allowed = true;
diff --cc arch_init.c
Simple merge
diff --cc block.c
Simple merge
@@@ -303,9 -330,10 +330,10 @@@ static int raw_open(BlockDriverState *b
      QemuOpts *opts;
      Error *local_err = NULL;
      const char *filename;
+     bool use_aio;
      int ret;
 +    DWORD overlapped;
 +    int access_flags;
  
      s->type = FTYPE_FILE;
  
      s->hfile = CreateFile(filename, access_flags,
                            FILE_SHARE_READ, NULL,
                            OPEN_EXISTING, overlapped, NULL);
 -    if (s->hfile == INVALID_HANDLE_VALUE) {
 +      if (s->hfile == INVALID_HANDLE_VALUE) {
          int err = GetLastError();
  
+         error_setg_win32(errp, err, "Could not open '%s'", filename);
          if (err == ERROR_ACCESS_DENIED) {
              ret = -EACCES;
          } else {
diff --cc blockdev.c
  static QTAILQ_HEAD(, BlockDriverState) monitor_bdrv_states =
      QTAILQ_HEAD_INITIALIZER(monitor_bdrv_states);
  
- static int do_open_tray(const char *device, bool force, Error **errp);
 +#ifdef CONFIG_MARU
 +#include "tizen/src/util/exported_strings.h"
 +#endif
 +
+ static int do_open_tray(const char *blk_name, const char *qdev_id,
+                         bool force, Error **errp);
  
  static const char *const if_name[IF_COUNT] = {
      [IF_NONE] = "none",
diff --cc configure
+++ b/configure
@@@ -229,8 -228,9 +228,10 @@@ xfs="
  
  vhost_net="no"
  vhost_scsi="no"
+ vhost_vsock="no"
  kvm="no"
 +hax="no"
+ colo="yes"
  rdma=""
  gprof="no"
  debug_tcg="no"
@@@ -320,26 -321,8 +322,26 @@@ libssh2="
  numa=""
  tcmalloc="no"
  jemalloc="no"
+ replication="yes"
  
 +yagl="no"
 +yagl_stats="no"
 +glx=""
 +vigs="no"
 +libtizenusb="no"
 +
 +# for TIZEN-maru
 +maru="no"
 +winver="0x501"
 +libav=""
 +libpng="no"
 +dxva2=""
 +vaapi=""
 +qt="no"
 +qtabi="5.0"
 +extension_path=""
 +#
 +
  # parse CC options first
  for opt do
    optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
@@@ -939,10 -921,10 +942,14 @@@ for opt d
    ;;
    --enable-kvm) kvm="yes"
    ;;
 +  --disable-hax) hax="no"
 +  ;;
 +  --enable-hax) hax="yes"
 +  ;;
+   --disable-colo) colo="no"
+   ;;
+   --enable-colo) colo="yes"
+   ;;
    --disable-tcg-interpreter) tcg_interpreter="no"
    ;;
    --enable-tcg-interpreter) tcg_interpreter="yes"
    ;;
    --enable-jemalloc) jemalloc="yes"
    ;;
+   --disable-replication) replication="no"
+   ;;
+   --enable-replication) replication="yes"
+   ;;
 +# for TIZEN-maru
 +  --enable-maru) maru="yes"
 +  ;;
 +  --winver=*) winver="$optarg"
 +  ;;
 +  --enable-libav) libav="yes"
 +  ;;
 +  --disable-libav) libav="no"
 +  ;;
 +  --enable-libpng) libpng="yes"
 +  ;;
 +  --enable-dxva2) dxva2="yes"
 +  ;;
 +  --disable-dxva2) dxva2="no"
 +  ;;
 +  --enable-vaapi) vaapi="yes"
 +  ;;
 +  --disable-vaapi) vaapi="no"
 +  ;;
 +  --disable-qt) qt="no"
 +  ;;
 +  --enable-qt) qt="yes"
 +  ;;
 +  --extension-path=*) extension_path="$optarg"
 +  ;;
 +#
    *)
        echo "ERROR: unknown option $opt"
        echo "Try '$0 --help' for more information"
@@@ -1452,25 -1401,8 +1474,26 @@@ disabled with --disable-FEATURE, defaul
    numa            libnuma support
    tcmalloc        tcmalloc support
    jemalloc        jemalloc support
+   replication     replication support
 +  qt              Qt5 UI
 +  hax             HAX acceleration support
 +  yagl            YaGL device
 +  yagl-stats      YaGL stats
 +  vigs            VIGS device
 +
 +TIZEN-maru options:
 +  --enable-maru            enable maru board
 +  --winver=WINVER          set WINVER
 +  --enable-libav           enable libav library
 +  --disable-libav          disable libav library
 +  --enable-libpng          enable png library
 +  --enable-dxva2           enable dxva2 support
 +  --disable-dxva2          disable dxva2 support
 +  --ensable-vaapi          enable vaapi support
 +  --disable-vaapi          disable vaapi support
 +  --extension-path=PATH    set extension path
 +
  NOTE: The object files are built at the place where configure is launched
  EOF
  exit 0
  ##########################################
  # avx2 optimization requirement check
  
- if test "$static" = "no" ; then
-   cat > $TMPC << EOF
+ cat > $TMPC << EOF
 +#ifndef __clang__
  #pragma GCC push_options
  #pragma GCC target("avx2")
  #include <cpuid.h>
  #include <immintrin.h>
  static int bar(void *a) {
-     return _mm256_movemask_epi8(_mm256_cmpeq_epi8(*(__m256i *)a, (__m256i){0}));
+     __m256i x = *(__m256i *)a;
+     return _mm256_testz_si256(x, x);
  }
- static void *bar_ifunc(void) {return (void*) bar;}
- int foo(void *a) __attribute__((ifunc("bar_ifunc")));
- int main(int argc, char *argv[]) { return foo(argv[0]);}
+ int main(int argc, char *argv[]) { return bar(argv[0]); }
 +#endif //__clang__
  EOF
-   if compile_object "" ; then
-       if has readelf; then
-           if readelf --syms $TMPO 2>/dev/null |grep -q "IFUNC.*foo"; then
-               avx2_opt="yes"
-           fi
-       fi
-   fi
+ if compile_object "" ; then
+   avx2_opt="yes"
  fi
  
  #########################################
@@@ -5244,29 -5099,8 +5436,30 @@@ echo "NUMA host support $numa
  echo "tcmalloc support  $tcmalloc"
  echo "jemalloc support  $jemalloc"
  echo "avx2 optimization $avx2_opt"
+ echo "replication support $replication"
  
 +echo "Qt support        $qt"
 +echo "HAX support       $hax"
 +echo "YaGL support      $yagl"
 +echo "YaGL stats        $yagl_stats"
 +echo "VIGS support      $vigs"
 +
 +# for TIZEN-maru
 +if test "$maru" = "yes"; then
 +echo "TIZEN-maru options:"
 +echo "maru enabled               $maru"
 +    if test "$mingw32" = "yes"; then
 +echo "WINVER                     $winver"
 +    fi
 +echo "libav support              $libav"
 +echo "libpng support             $libpng"
 +echo "DXVA2 support              $dxva2"
 +echo "vaapi support              $vaapi"
 +echo "libtizenusb support        $libtizenusb"
 +echo "extension path             $extension_path"
 +fi
 +#
 +
  if test "$sdl_too_old" = "yes"; then
  echo "-> Your SDL version is too old - please upgrade to have SDL support"
  fi
diff --cc cpu-exec.c
@@@ -619,22 -631,11 +633,20 @@@ int cpu_exec(CPUState *cpu
              if (cpu_handle_exception(cpu, &ret)) {
                  break;
              }
 +#ifdef CONFIG_HAX
 +            if (hax_enabled() && !hax_vcpu_exec(cpu)) {
 +                break;
 +            }
 +#endif
  
-             cpu->tb_flushed = false; /* reset before first TB lookup */
              for(;;) {
                  cpu_handle_interrupt(cpu, &last_tb);
-                 tb = tb_find_fast(cpu, &last_tb, tb_exit);
+                 tb = tb_find(cpu, last_tb, tb_exit);
                  cpu_loop_exec_tb(cpu, tb, &last_tb, &tb_exit, &sc);
 +#ifdef CONFIG_HAX
 +                if (hax_enabled() && hax_stop_emulation(cpu))
 +                    cpu_loop_exit(cpu);
 +#endif
                  /* Try to align the host and virtual clocks
                     if the guest is in advance */
                  align_clocks(&sc, cpu);
diff --cc cpus.c
Simple merge
@@@ -1862,41 -1322,6 +1322,20 @@@ Example
  -> { "execute": "set_link", "arguments": { "name": "e1000.0", "up": false } }
  <- { "return": {} }
  
- EQMP
-     {
-         .name       = "get_link",
-         .args_type  = "name:s",
-         .mhandler.cmd_new = qmp_marshal_get_link,
-     },
- SQMP
 +get_link
 +--------
 +
 +Get the link status of a network adapter.
 +
 +Arguments:
 +
 +- "name": network device name (json-string)
 +
 +Example:
 +
 +-> { "execute": "get_link", "arguments": { "name": "e1000.0" } }
 +<- { "return": {on|off} }
 +
- EQMP
-     {
-         .name       = "getfd",
-         .args_type  = "fdname:s",
-         .params     = "getfd name",
-         .help       = "receive a file descriptor via SCM rights and assign it a name",
-         .mhandler.cmd_new = qmp_marshal_getfd,
-     },
- SQMP
  getfd
  -----
  
diff --cc exec.c
--- 1/exec.c
--- 2/exec.c
+++ b/exec.c
@@@ -1616,25 -1652,8 +1653,23 @@@ static void ram_block_add(RAMBlock *new
      if (new_block->host) {
          qemu_ram_setup_dump(new_block->host, new_block->max_length);
          qemu_madvise(new_block->host, new_block->max_length, QEMU_MADV_HUGEPAGE);
+         /* MADV_DONTFORK is also needed by KVM in absence of synchronous MMU */
          qemu_madvise(new_block->host, new_block->max_length, QEMU_MADV_DONTFORK);
-         if (kvm_enabled()) {
-             kvm_setup_guest_memory(new_block->host, new_block->max_length);
-         }
 +#ifdef CONFIG_HAX
 +        /*
 +         * In Hax, the qemu allocate the virtual address, and HAX kernel
 +         * populate the memory with physical memory. Currently we have no
 +         * paging, so user should make sure enough free memory in advance
 +         */
 +        if (hax_enabled()) {
 +            int ret = hax_populate_ram((uint64_t)(uintptr_t)new_block->host,
 +                    new_block->max_length);
 +            if (ret < 0) {
 +                fprintf(stderr, "HAX failed to populate ram\n");
 +                exit(-1);
 +            }
 +        }
 +#endif
      }
  }
  
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc hmp-commands.hx
@@@ -1392,22 -1409,8 +1409,23 @@@ STEX
  @findex set_link
  Switch link @var{name} on (i.e. up) or off (i.e. down).
  ETEXI
      {
-         .mhandler.cmd = hmp_get_link,
 +        .name       = "get_link",
 +        .args_type  = "name:s",
 +        .params     = "name",
 +        .help       = "get the link status of a network adapter",
++        .cmd = hmp_get_link,
 +    },
 +
 +STEXI
 +
 +@item get_link @var{name}
 +@findex get_link
 +Get the link status of @var{name}.
 +ETEXI
 +
 +    {
          .name       = "watchdog_action",
          .args_type  = "action:s",
          .params     = "[reset|shutdown|poweroff|pause|debug|none]",
diff --cc hmp.c
Simple merge
diff --cc hmp.h
Simple merge
diff --cc hw/9pfs/9p.h
Simple merge
Simple merge
Simple merge
diff --cc hw/acpi/ich9.c
Simple merge
diff --cc hw/acpi/piix4.c
Simple merge
Simple merge
diff --cc hw/i386/pc.c
  #include "qapi-visit.h"
  #include "qom/cpu.h"
  #include "hw/nmi.h"
+ #include "hw/i386/intel_iommu.h"
  
 +#include "sysemu/hax.h"
 +
  /* debug PC/ISA interrupts */
  //#define DEBUG_IRQ
  
Simple merge
diff --cc hw/input/ps2.c
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -33,8 -33,16 +33,17 @@@ void do_smbios_option(QemuOpts *opts)
  void audio_init(void);
  int kvm_available(void);
  int xen_available(void);
 +int hax_available(void);
  
  CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp);
+ CpuModelExpansionInfo *arch_query_cpu_model_expansion(CpuModelExpansionType type,
+                                                       CpuModelInfo *mode,
+                                                       Error **errp);
+ CpuModelCompareInfo *arch_query_cpu_model_comparison(CpuModelInfo *modela,
+                                                      CpuModelInfo *modelb,
+                                                      Error **errp);
+ CpuModelBaselineInfo *arch_query_cpu_model_baseline(CpuModelInfo *modela,
+                                                     CpuModelInfo *modelb,
+                                                     Error **errp);
  
  #endif
Simple merge
diff --cc main-loop.c
Simple merge
diff --cc monitor.c
+++ b/monitor.c
@@@ -4159,6 -3955,27 +3955,55 @@@ static void monitor_readline_flush(voi
      monitor_flush(opaque);
  }
  
++#ifdef CONFIG_MARU
++static QLIST_HEAD(, ErrorReporter) error_reporters =
++    QLIST_HEAD_INITIALIZER(error_reporters);
++
++void add_error_reporter(ErrorReporter *new_reporter)
++{
++    QLIST_INSERT_HEAD(&error_reporters, new_reporter, node);
++}
++
++static void report_to_clients(const char *fmt, va_list ap)
++{
++    ErrorReporter *reporter;
++    QLIST_FOREACH(reporter, &error_reporters, node) {
++        if (reporter->report) {
++            (*(reporter->report))(fmt, ap);
++        }
++    }
++}
++#endif
++
+ /*
+  * Print to current monitor if we have one, else to stderr.
+  * TODO should return int, so callers can calculate width, but that
+  * requires surgery to monitor_vprintf().  Left for another day.
+  */
+ void error_vprintf(const char *fmt, va_list ap)
+ {
+     if (cur_mon && !monitor_cur_is_qmp()) {
+         monitor_vprintf(cur_mon, fmt, ap);
+     } else {
++#ifdef CONFIG_MARU
++        va_list ap_copy;
++        va_copy(ap_copy, ap);
++        vfprintf(stderr, fmt, ap_copy);
++        va_end(ap_copy);
++        report_to_clients(fmt, ap);
++#else
+         vfprintf(stderr, fmt, ap);
++#endif
+     }
+ }
+ void error_vprintf_unless_qmp(const char *fmt, va_list ap)
+ {
+     if (cur_mon && !monitor_cur_is_qmp()) {
+         monitor_vprintf(cur_mon, fmt, ap);
+     }
+ }
  static void __attribute__((constructor)) monitor_lock_init(void)
  {
      qemu_mutex_init(&monitor_lock);
diff --cc net/net.c
Simple merge
diff --cc net/slirp.c
Simple merge
diff --cc net/tap.c
Simple merge
Simple merge
diff --cc qemu-char.c
Simple merge
diff --cc qemu-options.hx
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc tcg/tcg.c
Simple merge
diff --cc ui/cocoa.m
@@@ -1138,12 -1139,103 +1139,107 @@@ QemuCocoaView *cocoaView
      }
  }
  
+ /* The action method for the About menu item */
+ - (IBAction) do_about_menu_item: (id) sender
+ {
+     [about_window makeKeyAndOrderFront: nil];
+ }
+ /* Create and display the about dialog */
+ - (void)make_about_window
+ {
+     /* Make the window */
+     int x = 0, y = 0, about_width = 400, about_height = 200;
+     NSRect window_rect = NSMakeRect(x, y, about_width, about_height);
+     about_window = [[NSWindow alloc] initWithContentRect:window_rect
+                     styleMask:NSTitledWindowMask | NSClosableWindowMask |
+                     NSMiniaturizableWindowMask
+                     backing:NSBackingStoreBuffered
+                     defer:NO];
+     [about_window setTitle: @"About"];
+     [about_window setReleasedWhenClosed: NO];
+     [about_window center];
+     NSView *superView = [about_window contentView];
+     /* Create the dimensions of the picture */
+     int picture_width = 80, picture_height = 80;
+     x = (about_width - picture_width)/2;
+     y = about_height - picture_height - 10;
+     NSRect picture_rect = NSMakeRect(x, y, picture_width, picture_height);
+     /* Get the path to the QEMU binary */
+     NSString *binary_name = [NSString stringWithCString: gArgv[0]
+                                       encoding: NSASCIIStringEncoding];
+     binary_name = [binary_name lastPathComponent];
+     NSString *program_path = [[NSString alloc] initWithFormat: @"%@/%@",
+     [[NSBundle mainBundle] bundlePath], binary_name];
+     /* Make the picture of QEMU */
+     NSImageView *picture_view = [[NSImageView alloc] initWithFrame:
+                                                      picture_rect];
+     NSImage *qemu_image = [[NSWorkspace sharedWorkspace] iconForFile:
+                                                          program_path];
+     [picture_view setImage: qemu_image];
+     [picture_view setImageScaling: NSImageScaleProportionallyUpOrDown];
+     [superView addSubview: picture_view];
+     /* Make the name label */
+     x = 0;
+     y = y - 25;
+     int name_width = about_width, name_height = 20;
+     NSRect name_rect = NSMakeRect(x, y, name_width, name_height);
+     NSTextField *name_label = [[NSTextField alloc] initWithFrame: name_rect];
+     [name_label setEditable: NO];
+     [name_label setBezeled: NO];
+     [name_label setDrawsBackground: NO];
+     [name_label setAlignment: NSCenterTextAlignment];
+     NSString *qemu_name = [[NSString alloc] initWithCString: gArgv[0]
+                                             encoding: NSASCIIStringEncoding];
+     qemu_name = [qemu_name lastPathComponent];
+     [name_label setStringValue: qemu_name];
+     [superView addSubview: name_label];
+     /* Set the version label's attributes */
+     x = 0;
+     y = 50;
+     int version_width = about_width, version_height = 20;
+     NSRect version_rect = NSMakeRect(x, y, version_width, version_height);
+     NSTextField *version_label = [[NSTextField alloc] initWithFrame:
+                                                       version_rect];
+     [version_label setEditable: NO];
+     [version_label setBezeled: NO];
+     [version_label setAlignment: NSCenterTextAlignment];
+     [version_label setDrawsBackground: NO];
+     /* Create the version string*/
+     NSString *version_string;
+     version_string = [[NSString alloc] initWithFormat:
+     @"QEMU emulator version %s%s", QEMU_VERSION, QEMU_PKGVERSION];
+     [version_label setStringValue: version_string];
+     [superView addSubview: version_label];
+     /* Make copyright label */
+     x = 0;
+     y = 35;
+     int copyright_width = about_width, copyright_height = 20;
+     NSRect copyright_rect = NSMakeRect(x, y, copyright_width, copyright_height);
+     NSTextField *copyright_label = [[NSTextField alloc] initWithFrame:
+                                                         copyright_rect];
+     [copyright_label setEditable: NO];
+     [copyright_label setBezeled: NO];
+     [copyright_label setDrawsBackground: NO];
+     [copyright_label setAlignment: NSCenterTextAlignment];
+     [copyright_label setStringValue: [NSString stringWithFormat: @"%s",
+                                      QEMU_COPYRIGHT]];
+     [superView addSubview: copyright_label];
+ }
  @end
  
 +#ifdef CONFIG_MARU
 +int cocoa_main (int argc, const char * argv[]);
 +#define main cocoa_main
 +#endif
  
  int main (int argc, const char * argv[]) {
  
diff --cc ui/console.c
Simple merge
diff --cc ui/spice-core.c
Simple merge
Simple merge
Simple merge
  
  #include "qemu/mmap-alloc.h"
  
+ #ifdef CONFIG_DEBUG_STACK_USAGE
+ #include "qemu/error-report.h"
+ #endif
 +#ifdef CONFIG_MARU
 +#include "qemu/error-report.h"
 +#include "../../tizen/src/emulator_common.h"
 +#endif
 +
  int qemu_get_thread_id(void)
  {
  #if defined(__linux__)
Simple merge
Simple merge
Simple merge
diff --cc vl.c
--- 1/vl.c
--- 2/vl.c
+++ b/vl.c
@@@ -98,8 -90,8 +99,9 @@@ int qemu_main(int argc, char **argv, ch
  #include "audio/audio.h"
  #include "migration/migration.h"
  #include "sysemu/cpus.h"
+ #include "migration/colo.h"
  #include "sysemu/kvm.h"
 +#include "sysemu/hax.h"
  #include "qapi/qmp/qjson.h"
  #include "qemu/option.h"
  #include "qemu/config-file.h"
  #include "crypto/init.h"
  #include "sysemu/replay.h"
  #include "qapi/qmp/qerror.h"
+ #include "sysemu/iothread.h"
  
 +#ifdef CONFIG_MARU
 +#include "tizen/src/emulator.h"
 +#include "tizen/src/emul_state.h"
 +#include "tizen/src/ui/qt5.h"
 +#include "tizen/src/util/ui_operations.h"
 +#include "tizen/src/ecs/ecs.h"
 +#include "tizen/src/util/error_handler.h"
 +#include "tizen/src/util/exported_strings.h"
 +
 +inline static bool is_maru_machine(MachineClass *mc) {
 +   return g_str_has_prefix(mc->name, "maru");
 +}
 +#endif
 +
  #define MAX_VIRTIO_CONSOLES 1
  #define MAX_SCLP_CONSOLES 1
  
@@@ -3071,14 -3030,10 +3137,17 @@@ int main(int argc, char **argv, char **
      Error *main_loop_err = NULL;
      Error *err = NULL;
      bool list_data_dirs = false;
 +#ifdef CONFIG_YAGL
 +    static bool yagl_enabled = false;
 +#endif /* CONFIG_YAGL */
 +#ifdef CONFIG_VIGS
 +    static bool vigs_enabled = false;
 +    static char *vigs_backend = NULL;
 +#endif /* CONFIG_VIGS */
  
+     module_call_init(MODULE_INIT_TRACE);
+     qemu_init_cpu_list();
      qemu_init_cpu_loop();
      qemu_mutex_lock_iothread();
  
  
      os_setup_post();
  
-     trace_init_vcpu_events();
 +#ifdef CONFIG_MARU
 +    enable_print_backtrace_at_normal_exit();
 +#endif
      main_loop();
      replay_disable_events();
+     iothread_stop_all();
  
      bdrv_close_all();
      pause_all_vcpus();