Skip to content
Snippets Groups Projects
  1. May 08, 2018
    • Cédric Le Goater's avatar
      cpus: tcg: fix never exiting loop on unplug · 54961aac
      Cédric Le Goater authored
      
      Commit 9b0605f9 ("cpus: tcg: unregister thread with RCU, fix
      exiting of loop on unplug") changed the exit condition of the loop in
      the vCPU thread function but forgot to remove the beginning 'while (1)'
      statement. The resulting code :
      
      	while (1) {
      	...
      	} while (!cpu->unplug || cpu_can_run(cpu));
      
      is a sequence of two distinct two while() loops, the first not exiting
      in case of an unplug event.
      
      Remove the first while (1) to fix CPU unplug.
      
      Signed-off-by: default avatarCédric Le Goater <clg@kaod.org>
      Message-Id: <20180425131828.15604-1-clg@kaod.org>
      Cc: qemu-stable@nongnu.org
      Fixes: 9b0605f9
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarCédric Le Goater <clg@kaod.org>
      54961aac
    • Markus Armbruster's avatar
      cpus: Fix event order on resume of stopped guest · f056158d
      Markus Armbruster authored
      
      When resume of a stopped guest immediately runs into block device
      errors, the BLOCK_IO_ERROR event is sent before the RESUME event.
      
      Reproducer:
      
      1. Create a scratch image
         $ dd if=/dev/zero of=scratch.img bs=1M count=100
      
         Size doesn't actually matter.
      
      2. Prepare blkdebug configuration:
      
         $ cat >blkdebug.conf <<EOF
         [inject-error]
         event = "write_aio"
         errno = "5"
         EOF
      
         Note that errno 5 is EIO.
      
      3. Run a guest with an additional scratch disk, i.e. with additional
         arguments
         -drive if=none,id=scratch-drive,format=raw,werror=stop,file=blkdebug:blkdebug.conf:scratch.img
         -device virtio-blk-pci,id=scratch,drive=scratch-drive
      
         The blkdebug part makes all writes to the scratch drive fail with
         EIO.  The werror=stop pauses the guest on write errors.
      
      4. Connect to the QMP socket e.g. like this:
         $ socat UNIX:/your/qmp/socket READLINE,history=$HOME/.qmp_history,prompt='QMP> '
      
         Issue QMP command 'qmp_capabilities':
         QMP> { "execute": "qmp_capabilities" }
      
      5. Boot the guest.
      
      6. In the guest, write to the scratch disk, e.g. like this:
      
         # dd if=/dev/zero of=/dev/vdb count=1
      
         Do double-check the device specified with of= is actually the
         scratch device!
      
      7. Issue QMP command 'cont':
         QMP> { "execute": "cont" }
      
      After step 6, I get a BLOCK_IO_ERROR event followed by a STOP event.  Good.
      
      After step 7, I get BLOCK_IO_ERROR, then RESUME, then STOP.  Not so
      good; I'd expect RESUME, then BLOCK_IO_ERROR, then STOP.
      
      The funny event order confuses libvirt: virsh -r domstate DOMAIN
      --reason reports "paused (unknown)" rather than "paused (I/O error)".
      
      The culprit is vm_prepare_start().
      
          /* Ensure that a STOP/RESUME pair of events is emitted if a
           * vmstop request was pending.  The BLOCK_IO_ERROR event, for
           * example, according to documentation is always followed by
           * the STOP event.
           */
          if (runstate_is_running()) {
              qapi_event_send_stop(&error_abort);
              res = -1;
          } else {
              replay_enable_events();
              cpu_enable_ticks();
              runstate_set(RUN_STATE_RUNNING);
              vm_state_notify(1, RUN_STATE_RUNNING);
          }
      
          /* We are sending this now, but the CPUs will be resumed shortly later */
          qapi_event_send_resume(&error_abort);
          return res;
      
      When resuming a stopped guest, we take the else branch before we get
      to sending RESUME.  vm_state_notify() runs virtio_vmstate_change(),
      among other things.  This restarts I/O, triggering the BLOCK_IO_ERROR
      event.
      
      Reshuffle vm_prepare_start() to send the RESUME event earlier.
      
      Fixes RHBZ 1566153.
      
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20180423084518.2426-1-armbru@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      f056158d
  2. May 04, 2018
    • Laszlo Ersek's avatar
      qapi: discriminate CpuInfoFast on SysEmuTarget, not CpuInfoArch · daa9d2bc
      Laszlo Ersek authored
      
      Add a new field @target (of type @SysEmuTarget) to the output of the
      @query-cpus-fast command, which provides more information about the
      emulation target than the field @arch (of type @CpuInfoArch). Make @target
      the new discriminator for the @CpuInfoFast return structure. Keep @arch
      for compatibility.
      
      Cc: "Daniel P. Berrange" <berrange@redhat.com>
      Cc: Eric Blake <eblake@redhat.com>
      Cc: Markus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarLaszlo Ersek <lersek@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <20180427192852.15013-5-lersek@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      daa9d2bc
    • Laszlo Ersek's avatar
      qapi: fill in CpuInfoFast.arch in query-cpus-fast · 96054f56
      Laszlo Ersek authored
      * Commit ca230ff3 added the @arch field to @CpuInfoFast, but it failed
        to set the new field in qmp_query_cpus_fast(), when TARGET_S390X was not
        defined. The updated @query-cpus-fast example in "qapi-schema.json"
        showed "arch":"x86" only because qmp_query_cpus_fast() calls g_malloc0()
        to allocate @CpuInfoFast, and the CPU_INFO_ARCH_X86 enum constant is
        generated with value 0.
      
        All @arch values other than @s390 implied the @CpuInfoOther sub-struct
        for @CpuInfoFast -- at the time of writing the patch --, thus no fields
        other than @arch needed to be set when TARGET_S390X was not defined. Set
        @arch now, by copying the corresponding assignments from
        qmp_query_cpus().
      
      * Commit 25fa194b added the @riscv enum constant to @CpuInfoArch (used
        in both @CpuInfo and @CpuInfoFast -- the return types of the @query-cpus
        and @query-cpus-fast commands, respectively), and assigned, in both
        return structures, the @CpuInfoRISCV sub-structure to the new enum
        value.
      
        However, qmp_query_cpus_fast() would not populate either the @arch field
        or the @CpuInfoRISCV sub-structure, when TARGET_RISCV was defined; only
        qmp_query_cpus() would.
      
        Assign @CpuInfoOther to the @riscv enum constant in @CpuInfoFast, and
        populate only the @arch field in qmp_query_cpus_fast(). Getting CPU
        state without interrupting KVM is an exceptional thing that only S390X
        does currently. Quoting Cornelia Huck <cohuck@redhat.com>, "s390x is
        exceptional in that it has state in QEMU that is actually interesting
        for upper layers and can be retrieved without performance penalty". See
        also
        <https://www.redhat.com/archives/libvir-list/2018-February/msg00121.html
      
      >.
      
      Cc: Cornelia Huck <cohuck@redhat.com>
      Cc: Eric Blake <eblake@redhat.com>
      Cc: Markus Armbruster <armbru@redhat.com>
      Cc: Viktor VM Mihajlovski <mihajlov@linux.vnet.ibm.com>
      Cc: qemu-stable@nongnu.org
      Fixes: ca230ff3
      Fixes: 25fa194b
      Signed-off-by: default avatarLaszlo Ersek <lersek@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Reviewed-by: default avatarCornelia Huck <cohuck@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20180427192852.15013-2-lersek@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      96054f56
  3. Apr 10, 2018
  4. Mar 12, 2018
  5. Mar 08, 2018
    • Stefan Hajnoczi's avatar
      vl: introduce vm_shutdown() · 4486e89c
      Stefan Hajnoczi authored
      
      Commit 00d09fdb ("vl: pause vcpus before
      stopping iothreads") and commit dce8921b
      ("iothread: Stop threads before main() quits") tried to work around the
      fact that emulation was still active during termination by stopping
      iothreads.  They suffer from race conditions:
      1. virtio_scsi_handle_cmd_vq() racing with iothread_stop_all() hits the
         virtio_scsi_ctx_check() assertion failure because the BDS AioContext
         has been modified by iothread_stop_all().
      2. Guest vq kick racing with main loop termination leaves a readable
         ioeventfd that is handled by the next aio_poll() when external
         clients are enabled again, resulting in unwanted emulation activity.
      
      This patch obsoletes those commits by fully disabling emulation activity
      when vcpus are stopped.
      
      Use the new vm_shutdown() function instead of pause_all_vcpus() so that
      vm change state handlers are invoked too.  Virtio devices will now stop
      their ioeventfds, preventing further emulation activity after vm_stop().
      
      Note that vm_stop(RUN_STATE_SHUTDOWN) cannot be used because it emits a
      QMP STOP event that may affect existing clients.
      
      It is no longer necessary to call replay_disable_events() directly since
      vm_shutdown() does so already.
      
      Drop iothread_stop_all() since it is no longer used.
      
      Cc: Fam Zheng <famz@redhat.com>
      Cc: Kevin Wolf <kwolf@redhat.com>
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: default avatarFam Zheng <famz@redhat.com>
      Acked-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Message-id: 20180307144205.20619-5-stefanha@redhat.com
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      4486e89c
  6. Mar 06, 2018
  7. Mar 02, 2018
    • Markus Armbruster's avatar
      qapi: Empty out qapi-schema.json · 112ed241
      Markus Armbruster authored
      
      The previous commit improved compile time by including less of the
      generated QAPI headers.  This is impossible for stuff defined directly
      in qapi-schema.json, because that ends up in headers that that pull in
      everything.
      
      Move everything but include directives from qapi-schema.json to new
      sub-module qapi/misc.json, then include just the "misc" shard where
      possible.
      
      It's possible everywhere, except:
      
      * monitor.c needs qmp-command.h to get qmp_init_marshal()
      
      * monitor.c, ui/vnc.c and the generated qapi-event-FOO.c need
        qapi-event.h to get enum QAPIEvent
      
      Perhaps we'll get rid of those some other day.
      
      Adding a type to qapi/migration.json now recompiles some 120 instead
      of 2300 out of 5100 objects.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20180211093607.27351-25-armbru@redhat.com>
      [eblake: rebase to master]
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      112ed241
    • Markus Armbruster's avatar
      Include less of the generated modular QAPI headers · 9af23989
      Markus Armbruster authored
      
      In my "build everything" tree, a change to the types in
      qapi-schema.json triggers a recompile of about 4800 out of 5100
      objects.
      
      The previous commit split up qmp-commands.h, qmp-event.h, qmp-visit.h,
      qapi-types.h.  Each of these headers still includes all its shards.
      Reduce compile time by including just the shards we actually need.
      
      To illustrate the benefits: adding a type to qapi/migration.json now
      recompiles some 2300 instead of 4800 objects.  The next commit will
      improve it further.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20180211093607.27351-24-armbru@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Reviewed-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      [eblake: rebase to master]
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      9af23989
  8. Feb 26, 2018
  9. Feb 09, 2018
  10. Feb 07, 2018
  11. Feb 06, 2018
    • Alistair Francis's avatar
      tcg: Replace fprintf(stderr, "*\n" with error_report() · 493d89bf
      Alistair Francis authored
      
      Replace a large number of the fprintf(stderr, "*\n" calls with
      error_report(). The functions were renamed with these commands and then
      compiler issues where manually fixed.
      
      find ./* -type f -exec sed -i \
          'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
          {} +
      find ./* -type f -exec sed -i \
          'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
          {} +
      find ./* -type f -exec sed -i \
          'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
          {} +
      find ./* -type f -exec sed -i \
          'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
          {} +
      find ./* -type f -exec sed -i \
          'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
          {} +
      find ./* -type f -exec sed -i \
          'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
          {} +
      find ./* -type f -exec sed -i \
          'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
          {} +
      find ./* -type f -exec sed -i \
          'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
          {} +
      find ./* -type f -exec sed -i \
          'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
          {} +
      find ./* -type f -exec sed -i \
          'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
          {} +
      find ./* -type f -exec sed -i \
          'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
          {} +
      
      Signed-off-by: default avatarAlistair Francis <alistair.francis@xilinx.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Peter Crosthwaite <crosthwaite.peter@gmail.com>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Stefan Weil <sw@weilnetz.de>
      
      Conversions that aren't followed by exit() dropped, because they might
      be inappropriate.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Message-Id: <20180203084315.20497-14-armbru@redhat.com>
      Reviewed-by: default avatarThomas Huth <thuth@redhat.com>
      493d89bf
  12. Jan 16, 2018
  13. Dec 22, 2017
    • Sergio Andres Gomez Del Real's avatar
      i386: hvf: add code base from Google's QEMU repository · c97d6d2c
      Sergio Andres Gomez Del Real authored
      This file begins tracking the files that will be the code base for HVF
      support in QEMU. This code base is part of Google's QEMU version of
      their Android emulator, and can be found at
      https://android.googlesource.com/platform/external/qemu/+/emu-master-dev
      
      This code is based on Veertu Inc's vdhh (Veertu Desktop Hosted
      Hypervisor), found at https://github.com/veertuinc/vdhh
      
      . Everything is
      appropriately licensed under GPL v2-or-later, except for the code inside
      x86_task.c and x86_task.h, which, deriving from KVM (the Linux kernel),
      is licensed GPL v2-only.
      
      This code base already implements a very great deal of functionality,
      although Google's version removed from Vertuu's the support for APIC
      page and hyperv-related stuff. According to the Android Emulator Release
      Notes, Revision 26.1.3 (August 2017), "Hypervisor.framework is now
      enabled by default on macOS for 32-bit x86 images to improve performance
      and macOS compatibility", although we better use with caution for, as the
      same Revision warns us, "If you experience issues with it specifically,
      please file a bug report...". The code hasn't seen much update in the
      last 5 months, so I think that we can further develop the code with
      occasional visiting Google's repository to see if there has been any
      update.
      
      On top of Google's code, the following changes were made:
      
      - add code to the configure script to support the --enable-hvf argument.
      If the OS is Darwin, it checks for presence of HVF in the system. The
      patch also adds strings related to HVF in the file qemu-options.hx.
      QEMU will only support the modern syntax style '-M accel=hvf' no enable
      hvf; the legacy '-enable-hvf' will not be supported.
      
      - fix styling issues
      
      - add glue code to cpus.c
      
      - move HVFX86EmulatorState field to CPUX86State, changing the
      the emulation functions to have a parameter with signature 'CPUX86State *'
      instead of 'CPUState *' so we don't have to get the 'env'.
      
      Signed-off-by: default avatarSergio Andres Gomez Del Real <Sergio.G.DelReal@gmail.com>
      Message-Id: <20170913090522.4022-2-Sergio.G.DelReal@gmail.com>
      Message-Id: <20170913090522.4022-3-Sergio.G.DelReal@gmail.com>
      Message-Id: <20170913090522.4022-5-Sergio.G.DelReal@gmail.com>
      Message-Id: <20170913090522.4022-6-Sergio.G.DelReal@gmail.com>
      Message-Id: <20170905035457.3753-7-Sergio.G.DelReal@gmail.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      c97d6d2c
  14. Dec 21, 2017
  15. Oct 24, 2017
    • Emilio G. Cota's avatar
      tcg: enable multiple TCG contexts in softmmu · 3468b59e
      Emilio G. Cota authored
      
      This enables parallel TCG code generation. However, we do not take
      advantage of it yet since tb_lock is still held during tb_gen_code.
      
      In user-mode we use a single TCG context; see the documentation
      added to tcg_region_init for the rationale.
      
      Note that targets do not need any conversion: targets initialize a
      TCGContext (e.g. defining TCG globals), and after this initialization
      has finished, the context is cloned by the vCPU threads, each of
      them keeping a separate copy.
      
      TCG threads claim one entry in tcg_ctxs[] by atomically increasing
      n_tcg_ctxs. Do not be too annoyed by the subsequent atomic_read's
      of that variable and tcg_ctxs; they are there just to play nice with
      analysis tools such as thread sanitizer.
      
      Note that we do not allocate an array of contexts (we allocate
      an array of pointers instead) because when tcg_context_init
      is called, we do not know yet how many contexts we'll use since
      the bool behind qemu_tcg_mttcg_enabled() isn't set yet.
      
      Previous patches folded some TCG globals into TCGContext. The non-const
      globals remaining are only set at init time, i.e. before the TCG
      threads are spawned. Here is a list of these set-at-init-time globals
      under tcg/:
      
      Only written by tcg_context_init:
      - indirect_reg_alloc_order
      - tcg_op_defs
      Only written by tcg_target_init (called from tcg_context_init):
      - tcg_target_available_regs
      - tcg_target_call_clobber_regs
      - arm: arm_arch, use_idiv_instructions
      - i386: have_cmov, have_bmi1, have_bmi2, have_lzcnt,
              have_movbe, have_popcnt
      - mips: use_movnz_instructions, use_mips32_instructions,
              use_mips32r2_instructions, got_sigill (tcg_target_detect_isa)
      - ppc: have_isa_2_06, have_isa_3_00, tb_ret_addr
      - s390: tb_ret_addr, s390_facilities
      - sparc: qemu_ld_trampoline, qemu_st_trampoline (build_trampolines),
               use_vis3_instructions
      
      Only written by tcg_prologue_init:
      - 'struct jit_code_entry one_entry'
      - aarch64: tb_ret_addr
      - arm: tb_ret_addr
      - i386: tb_ret_addr, guest_base_flags
      - ia64: tb_ret_addr
      - mips: tb_ret_addr, bswap32_addr, bswap32u_addr, bswap64_addr
      
      Reviewed-by: default avatarRichard Henderson <rth@twiddle.net>
      Signed-off-by: default avatarEmilio G. Cota <cota@braap.org>
      Signed-off-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      3468b59e
    • Emilio G. Cota's avatar
      tcg: introduce regions to split code_gen_buffer · e8feb96f
      Emilio G. Cota authored
      
      This is groundwork for supporting multiple TCG contexts.
      
      The naive solution here is to split code_gen_buffer statically
      among the TCG threads; this however results in poor utilization
      if translation needs are different across TCG threads.
      
      What we do here is to add an extra layer of indirection, assigning
      regions that act just like pages do in virtual memory allocation.
      (BTW if you are wondering about the chosen naming, I did not want
      to use blocks or pages because those are already heavily used in QEMU).
      
      We use a global lock to serialize allocations as well as statistics
      reporting (we now export the size of the used code_gen_buffer with
      tcg_code_size()). Note that for the allocator we could just use
      a counter and atomic_inc; however, that would complicate the gathering
      of tcg_code_size()-like stats. So given that the region operations are
      not a fast path, a lock seems the most reasonable choice.
      
      The effectiveness of this approach is clear after seeing some numbers.
      I used the bootup+shutdown of debian-arm with '-tb-size 80' as a benchmark.
      Note that I'm evaluating this after enabling per-thread TCG (which
      is done by a subsequent commit).
      
      * -smp 1, 1 region (entire buffer):
          qemu: flush code_size=83885014 nb_tbs=154739 avg_tb_size=357
          qemu: flush code_size=83884902 nb_tbs=153136 avg_tb_size=363
          qemu: flush code_size=83885014 nb_tbs=152777 avg_tb_size=364
          qemu: flush code_size=83884950 nb_tbs=150057 avg_tb_size=373
          qemu: flush code_size=83884998 nb_tbs=150234 avg_tb_size=373
          qemu: flush code_size=83885014 nb_tbs=154009 avg_tb_size=360
          qemu: flush code_size=83885014 nb_tbs=151007 avg_tb_size=370
          qemu: flush code_size=83885014 nb_tbs=151816 avg_tb_size=367
      
      That is, 8 flushes.
      
      * -smp 8, 32 regions (80/32 MB per region) [i.e. this patch]:
      
          qemu: flush code_size=76328008 nb_tbs=141040 avg_tb_size=356
          qemu: flush code_size=75366534 nb_tbs=138000 avg_tb_size=361
          qemu: flush code_size=76864546 nb_tbs=140653 avg_tb_size=361
          qemu: flush code_size=76309084 nb_tbs=135945 avg_tb_size=375
          qemu: flush code_size=74581856 nb_tbs=132909 avg_tb_size=375
          qemu: flush code_size=73927256 nb_tbs=135616 avg_tb_size=360
          qemu: flush code_size=78629426 nb_tbs=142896 avg_tb_size=365
          qemu: flush code_size=76667052 nb_tbs=138508 avg_tb_size=368
      
      Again, 8 flushes. Note how buffer utilization is not 100%, but it
      is close. Smaller region sizes would yield higher utilization,
      but we want region allocation to be rare (it acquires a lock), so
      we do not want to go too small.
      
      * -smp 8, static partitioning of 8 regions (10 MB per region):
          qemu: flush code_size=21936504 nb_tbs=40570 avg_tb_size=354
          qemu: flush code_size=11472174 nb_tbs=20633 avg_tb_size=370
          qemu: flush code_size=11603976 nb_tbs=21059 avg_tb_size=365
          qemu: flush code_size=23254872 nb_tbs=41243 avg_tb_size=377
          qemu: flush code_size=28289496 nb_tbs=52057 avg_tb_size=358
          qemu: flush code_size=43605160 nb_tbs=78896 avg_tb_size=367
          qemu: flush code_size=45166552 nb_tbs=82158 avg_tb_size=364
          qemu: flush code_size=63289640 nb_tbs=116494 avg_tb_size=358
          qemu: flush code_size=51389960 nb_tbs=93937 avg_tb_size=362
          qemu: flush code_size=59665928 nb_tbs=107063 avg_tb_size=372
          qemu: flush code_size=38380824 nb_tbs=68597 avg_tb_size=374
          qemu: flush code_size=44884568 nb_tbs=79901 avg_tb_size=376
          qemu: flush code_size=50782632 nb_tbs=90681 avg_tb_size=374
          qemu: flush code_size=39848888 nb_tbs=71433 avg_tb_size=372
          qemu: flush code_size=64708840 nb_tbs=119052 avg_tb_size=359
          qemu: flush code_size=49830008 nb_tbs=90992 avg_tb_size=362
          qemu: flush code_size=68372408 nb_tbs=123442 avg_tb_size=368
          qemu: flush code_size=33555560 nb_tbs=59514 avg_tb_size=378
          qemu: flush code_size=44748344 nb_tbs=80974 avg_tb_size=367
          qemu: flush code_size=37104248 nb_tbs=67609 avg_tb_size=364
      
      That is, 20 flushes. Note how a static partitioning approach uses
      the code buffer poorly, leading to many unnecessary flushes.
      
      Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      Signed-off-by: default avatarEmilio G. Cota <cota@braap.org>
      Signed-off-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      e8feb96f
  16. Sep 21, 2017
  17. Jul 13, 2017
    • Alistair Francis's avatar
      Convert error_report() to warn_report() · 3dc6f869
      Alistair Francis authored
      
      Convert all uses of error_report("warning:"... to use warn_report()
      instead. This helps standardise on a single method of printing warnings
      to the user.
      
      All of the warnings were changed using these two commands:
          find ./* -type f -exec sed -i \
            's|error_report(".*warning[,:] |warn_report("|Ig' {} +
      
      Indentation fixed up manually afterwards.
      
      The test-qdev-global-props test case was manually updated to ensure that
      this patch passes make check (as the test cases are case sensitive).
      
      Signed-off-by: default avatarAlistair Francis <alistair.francis@xilinx.com>
      Suggested-by: default avatarThomas Huth <thuth@redhat.com>
      Cc: Jeff Cody <jcody@redhat.com>
      Cc: Kevin Wolf <kwolf@redhat.com>
      Cc: Max Reitz <mreitz@redhat.com>
      Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Peter Lieven <pl@kamp.de>
      Cc: Josh Durgin <jdurgin@redhat.com>
      Cc: "Richard W.M. Jones" <rjones@redhat.com>
      Cc: Markus Armbruster <armbru@redhat.com>
      Cc: Peter Crosthwaite <crosthwaite.peter@gmail.com>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
      Cc: Greg Kurz <groug@kaod.org>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Peter Maydell <peter.maydell@linaro.org>
      Cc: Peter Chubb <peter.chubb@nicta.com.au>
      Cc: Eduardo Habkost <ehabkost@redhat.com>
      Cc: Marcel Apfelbaum <marcel@redhat.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Igor Mammedov <imammedo@redhat.com>
      Cc: David Gibson <david@gibson.dropbear.id.au>
      Cc: Alexander Graf <agraf@suse.de>
      Cc: Gerd Hoffmann <kraxel@redhat.com>
      Cc: Jason Wang <jasowang@redhat.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Cornelia Huck <cohuck@redhat.com>
      Cc: Stefan Hajnoczi <stefanha@redhat.com>
      Acked-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      Acked-by: default avatarGreg Kurz <groug@kaod.org>
      Acked-by: default avatarCornelia Huck <cohuck@redhat.com>
      Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Reviewed by: Peter Chubb <peter.chubb@data61.csiro.au>
      Acked-by: default avatarMax Reitz <mreitz@redhat.com>
      Acked-by: default avatarMarcel Apfelbaum <marcel@redhat.com>
      Message-Id: <e1cfa2cd47087c248dd24caca9c33d9af0c499b0.1499866456.git.alistair.francis@xilinx.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      3dc6f869
  18. Jun 07, 2017
  19. Jun 05, 2017
    • David Gibson's avatar
      migration: Mark CPU states dirty before incoming migration/loadvm · 75e972da
      David Gibson authored
      
      As a rule, CPU internal state should never be updated when
      !cpu->kvm_vcpu_dirty (or the HAX equivalent).  If that is done, then
      subsequent calls to cpu_synchronize_state() - usually safe and idempotent -
      will clobber state.
      
      However, we routinely do this during a loadvm or incoming migration.
      Usually this is called shortly after a reset, which will clear all the cpu
      dirty flags with cpu_synchronize_all_post_reset().  Nothing is expected
      to set the dirty flags again before the cpu state is loaded from the
      incoming stream.
      
      This means that it isn't safe to call cpu_synchronize_state() from a
      post_load handler, which is non-obvious and potentially inconvenient.
      
      We could cpu_synchronize_all_state() before the loadvm, but that would be
      overkill since a) we expect the state to already be synchronized from the
      reset and b) we expect to completely rewrite the state with a call to
      cpu_synchronize_all_post_init() at the end of qemu_loadvm_state().
      
      To clear this up, this patch introduces cpu_synchronize_pre_loadvm() and
      associated helpers, which simply marks the cpu state as dirty without
      actually changing anything.  i.e. it says we want to discard any existing
      KVM (or HAX) state and replace it with what we're going to load.
      
      Cc: Juan Quintela <quintela@redhat.com>
      Cc: Dave Gilbert <dgilbert@redhat.com>
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: default avatarJuan Quintela <quintela@redhat.com>
      75e972da
  20. May 11, 2017
  21. May 10, 2017
  22. Apr 10, 2017
    • Alex Bennée's avatar
      cpus: call cpu_update_icount on read · 1d05906b
      Alex Bennée authored
      
      This ensures each time the vCPU thread reads the icount we update the
      master timer_state.qemu_icount field. This way as long as updates are
      in BQL protected sections (which they should be) the main-loop can
      never come to update the log and find time has gone backwards.
      
      Signed-off-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      1d05906b
Loading