1. 14 9月, 2016 2 次提交
  2. 16 8月, 2016 1 次提交
  3. 08 8月, 2016 2 次提交
  4. 05 8月, 2016 1 次提交
  5. 29 7月, 2016 3 次提交
  6. 13 7月, 2016 1 次提交
    • M
      char: do not use atexit cleanup handler · aa5cb7f5
      Marc-André Lureau 提交于
      It turns out qemu is calling exit() in various places from various
      threads without taking much care of resources state. The atexit()
      cleanup handlers cannot easily destroy resources that are in use (by
      the same thread or other).
      
      Since c1111a24, TCG arm guests run into the following abort() when
      running tests, the chardev mutex is locked during the write, so
      qemu_mutex_destroy() returns an error:
      
       #0  0x00007fffdbb806f5 in raise () at /lib64/libc.so.6
       #1  0x00007fffdbb822fa in abort () at /lib64/libc.so.6
       #2  0x00005555557616fe in error_exit (err=<optimized out>, msg=msg@entry=0x555555c38c30 <__func__.14622> "qemu_mutex_destroy")
           at /home/drjones/code/qemu/util/qemu-thread-posix.c:39
       #3  0x0000555555b0be20 in qemu_mutex_destroy (mutex=mutex@entry=0x5555566aa0e0) at /home/drjones/code/qemu/util/qemu-thread-posix.c:57
       #4  0x00005555558aab00 in qemu_chr_free_common (chr=0x5555566aa0e0) at /home/drjones/code/qemu/qemu-char.c:4029
       #5  0x00005555558b05f9 in qemu_chr_delete (chr=<optimized out>) at /home/drjones/code/qemu/qemu-char.c:4038
       #6  0x00005555558b05f9 in qemu_chr_delete (chr=<optimized out>) at /home/drjones/code/qemu/qemu-char.c:4044
       #7  0x00005555558b062c in qemu_chr_cleanup () at /home/drjones/code/qemu/qemu-char.c:4557
       #8  0x00007fffdbb851e8 in __run_exit_handlers () at /lib64/libc.so.6
       #9  0x00007fffdbb85235 in  () at /lib64/libc.so.6
       #10 0x00005555558d1b39 in testdev_write (testdev=0x5555566aa0a0) at /home/drjones/code/qemu/backends/testdev.c:71
       #11 0x00005555558d1b39 in testdev_write (chr=<optimized out>, buf=0x7fffc343fd9a "", len=0) at /home/drjones/code/qemu/backends/testdev.c:95
       #12 0x00005555558adced in qemu_chr_fe_write (s=0x5555566aa0e0, buf=buf@entry=0x7fffc343fd98 "0q", len=len@entry=2) at /home/drjones/code/qemu/qemu-char.c:282
      
      Instead of using a atexit() handler, only run the chardev cleanup as
      initially proposed at the end of main(), where there are less chances
      (hic) of conflicts or other races.
      Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Reported-by: NAndrew Jones <drjones@redhat.com>
      Message-Id: <20160704153823.16879-1-marcandre.lureau@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      aa5cb7f5
  7. 06 7月, 2016 1 次提交
  8. 29 6月, 2016 2 次提交
  9. 17 6月, 2016 2 次提交
  10. 06 6月, 2016 1 次提交
  11. 05 4月, 2016 2 次提交
  12. 23 3月, 2016 2 次提交
  13. 18 3月, 2016 1 次提交
    • E
      qapi: Don't special-case simple union wrappers · 32bafa8f
      Eric Blake 提交于
      Simple unions were carrying a special case that hid their 'data'
      QMP member from the resulting C struct, via the hack method
      QAPISchemaObjectTypeVariant.simple_union_type().  But by using
      the work we started by unboxing flat union and alternate
      branches, coupled with the ability to visit the members of an
      implicit type, we can now expose the simple union's implicit
      type in qapi-types.h:
      
      | struct q_obj_ImageInfoSpecificQCow2_wrapper {
      |     ImageInfoSpecificQCow2 *data;
      | };
      |
      | struct q_obj_ImageInfoSpecificVmdk_wrapper {
      |     ImageInfoSpecificVmdk *data;
      | };
      ...
      | struct ImageInfoSpecific {
      |     ImageInfoSpecificKind type;
      |     union { /* union tag is @type */
      |         void *data;
      |-        ImageInfoSpecificQCow2 *qcow2;
      |-        ImageInfoSpecificVmdk *vmdk;
      |+        q_obj_ImageInfoSpecificQCow2_wrapper qcow2;
      |+        q_obj_ImageInfoSpecificVmdk_wrapper vmdk;
      |     } u;
      | };
      
      Doing this removes asymmetry between QAPI's QMP side and its
      C side (both sides now expose 'data'), and means that the
      treatment of a simple union as sugar for a flat union is now
      equivalent in both languages (previously the two approaches used
      a different layer of dereferencing, where the simple union could
      be converted to a flat union with equivalent C layout but
      different {} on the wire, or to an equivalent QMP wire form
      but with different C representation).  Using the implicit type
      also lets us get rid of the simple_union_type() hack.
      
      Of course, now all clients of simple unions have to adjust from
      using su->u.member to using su->u.member.data; while this touches
      a number of files in the tree, some earlier cleanup patches
      helped minimize the change to the initialization of a temporary
      variable rather than every single member access.  The generated
      qapi-visit.c code is also affected by the layout change:
      
      |@@ -7393,10 +7393,10 @@ void visit_type_ImageInfoSpecific_member
      |     }
      |     switch (obj->type) {
      |     case IMAGE_INFO_SPECIFIC_KIND_QCOW2:
      |-        visit_type_ImageInfoSpecificQCow2(v, "data", &obj->u.qcow2, &err);
      |+        visit_type_q_obj_ImageInfoSpecificQCow2_wrapper_members(v, &obj->u.qcow2, &err);
      |         break;
      |     case IMAGE_INFO_SPECIFIC_KIND_VMDK:
      |-        visit_type_ImageInfoSpecificVmdk(v, "data", &obj->u.vmdk, &err);
      |+        visit_type_q_obj_ImageInfoSpecificVmdk_wrapper_members(v, &obj->u.vmdk, &err);
      |         break;
      |     default:
      |         abort();
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1458254921-17042-13-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      32bafa8f
  14. 17 3月, 2016 1 次提交
  15. 16 3月, 2016 1 次提交
    • P
      replay: character devices · 33577b47
      Pavel Dovgalyuk 提交于
      This patch implements record and replay of character devices.
      It records chardevs communication in replay mode. Recorded information
      include data read from backend and counter of bytes written
      from frontend to backend to preserve frontend internal state.
      If character device was configured through the command line in record mode,
      then in replay mode it should be also added to command line. Backend of
      the character device could be changed in replay mode.
      Replaying of devices that perform ioctl and get_msgfd operations is not
      supported.
      gdbstub which also acts as a backend is not recorded to allow controlling
      the replaying through gdb. Monitor backends are also not recorded.
      Signed-off-by: NPavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
      Message-Id: <20160314074436.4980.83856.stgit@PASHA-ISP>
      [Add stubs. - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      33577b47
  16. 11 3月, 2016 6 次提交
  17. 05 3月, 2016 3 次提交
    • E
      chardev: Drop useless ChardevDummy type · b1918fbb
      Eric Blake 提交于
      Commit d0d7708b made ChardevDummy be an empty wrapper type around
      ChardevCommon.  But there is no technical reason for this indirection,
      so simplify the code by directly using the base type.
      
      Also change the fallback assignment to assign u.null rather than
      u.data, since a future patch will remove the data member of the C
      struct generated for QAPI unions.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NDaniel P. Berrange <berrange@redhat.com>
      Message-Id: <1457106160-23614-1-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      b1918fbb
    • E
      util: Shorten references into SocketAddress · 0399293e
      Eric Blake 提交于
      An upcoming patch will alter how simple unions, like SocketAddress,
      are laid out, which will impact all lines of the form 'addr->u.XXX'
      (expanding it to the longer 'addr->u.XXX.data').  For better
      legibility in that patch, and less need for line wrapping, it's better
      to use a temporary variable to reduce the effect of a layout change to
      just the variable initializations, rather than every reference within
      a SocketAddress.  Also, take advantage of some C99 initialization where
      it makes sense (simplifying g_new0() to g_new()).
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1457021813-10704-7-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      0399293e
    • E
      chardev: Shorten references into ChardevBackend · f194a1ae
      Eric Blake 提交于
      An upcoming patch will alter how simple unions, like ChardevBackend,
      are laid out, which will impact all lines of the form 'backend->u.XXX'
      (expanding it to the longer 'backend->u.XXX.data').  For better
      legibility in that patch, and less need for line wrapping, it's better
      to use a temporary variable to reduce the effect of a layout change to
      just the variable initializations, rather than every reference within
      a ChardevBackend.  It doesn't hurt that this also makes the code more
      consistent: some clients touched here already had a temporary variable
      but weren't using it.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-By: NDaniel P. Berrange <berrange@redhat.com>
      Message-Id: <1457021813-10704-6-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      f194a1ae
  18. 25 2月, 2016 1 次提交
  19. 16 2月, 2016 2 次提交
    • D
      char: fix handling of QIO_CHANNEL_ERR_BLOCK · e046fb44
      Daniel P. Berrange 提交于
      If io_channel_send_full gets QIO_CHANNEL_ERR_BLOCK it
      and has already sent some of the data, it should return
      that amount of data, not EAGAIN, as that would cause
      the caller to re-try already sent data.
      
      Unfortunately due to a previous rebase conflict resolution
      error, the code for dealing with this was in the wrong
      part of the conditional, and so mistakenly ran on other
      I/O errors.
      
      This be seen running
      
         qemu-system-x86_64 -monitor stdio
      
      and entering 'info mtree', when running on a slow console
      (eg a slow remote ssh session). The monitor would get into
      an indefinite loop writing the same data until it managed
      to send it all without getting EAGAIN.
      Reported-by: NIgor Mammedov <imammedo@redhat.com>
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Message-Id: <1455288410-27046-1-git-send-email-berrange@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      e046fb44
    • P
      Revert "qemu-char: Keep pty slave file descriptor open until the master is closed" · 837a183f
      Paolo Bonzini 提交于
      This reverts commit 34689e20.
      
      Marc-André Lureau provided the following commentary: "It looks like if
      a the slave is opened, then Linux will buffer the master writes, up to
      a few kb and then throttle, so it's not entirely blocked but eventually
      the guest VM dies.  However, not having any slave open it will simply let
      the write go and discard the data.  At least, virt-install configures
      a pty for the serial but viewers like virt-manager do not necessarily
      open it.  And, if there are no viewers, it will just hang.  If qemu
      starts reading all the data from the slave, I don't think interactions
      with other slaves will work. I don't see much options but to close the
      slave, thus reverting this patch."
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      837a183f
  20. 11 2月, 2016 1 次提交
  21. 10 2月, 2016 1 次提交
  22. 09 2月, 2016 2 次提交
    • D
      char: fix repeated registration of tcp chardev I/O handlers · 1e94f23d
      Daniel P. Berrange 提交于
      In previous commit:
      
        commit f2001a7e
        Author: Daniel P. Berrange <berrange@redhat.com>
        Date:   Tue Jan 19 11:14:30 2016 +0000
      
          char: don't assume telnet initialization will not block
      
      The code which writes the telnet initialization sequence moved
      to an event loop callback. If the TCP chardev is opened as a
      server in blocking mode (ie -serial telnet:0.0.0.0:3000,server,wait)
      this results in a state where the TCP chardev is connected, but not
      yet ready to send/recv data when virtual hardware is created.
      
      When the virtual hardware initialization registers its chardev
      callbacks, it triggers tcp_chr_update_read_handler, which will
      add I/O watches to the connection.
      
      When the telnet initialization finally runs, it will then call
      tcp_chr_connect to finish the connection setup. This will in
      turn add I/O watches to the connection too.
      
      There are now two sets of I/O watches registered on the same
      connection. This ultimately causes data loss on the connection,
      for example, when typing into the telnet console only every
      second byte is echoed back to the client.
      
      The same flaw can affect channels running with TLS encryption
      too, since they also have delayed connection setup completion.
      
      The fix is to update tcp_chr_update_read_handler so that it
      avoids registering watches if the connection is not fully
      setup yet.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Message-Id: <1454939707-10869-1-git-send-email-berrange@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      1e94f23d
    • P
      qemu-char: Keep pty slave file descriptor open until the master is closed · 34689e20
      Paolo Bonzini 提交于
      If a process opens the slave pts device, writes data to it, then
      immediately closes it, the data doesn't reliably get delivered to the
      emulated serial port. This seems to be because a read of the master
      pty device returns EIO on Linux if no process has the pts device open,
      even when data is waiting "in the pipe".
      
      A fix seems to be for QEMU to keep the pts file descriptor open until
      the pty is closed, as per the below patch.
      Signed-off-by: NAshley Jonathan <jonathan.ashley@altran.com>
      Message-Id: <AC19797808C8D548ABDE0CA4A97AA30A30DEB409@XMB-DCFR-37.europe.corp.altran.com>
      Reviewed-by: NMichael Tokarev <mjt@tls.msk.ru>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      34689e20
  23. 05 2月, 2016 1 次提交
    • P
      all: Clean up includes · d38ea87a
      Peter Maydell 提交于
      Clean up includes so that osdep.h is included first and headers
      which it implies are not included manually.
      
      This commit was created with scripts/clean-includes.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Message-id: 1454089805-5470-16-git-send-email-peter.maydell@linaro.org
      d38ea87a