1. 08 Feb, 2014 2 commits
  2. 01 Feb, 2014 1 commit
  3. 24 Jan, 2014 3 commits
  4. 22 Jan, 2014 3 commits
  5. 16 Jan, 2014 1 commit
  6. 15 Jan, 2014 1 commit
  7. 13 Jan, 2014 1 commit
  8. 06 Jan, 2014 2 commits
    • Peter Crosthwaite's avatar
      qemu-option: Remove qemu_opts_create_nofail · 87ea75d5
      Peter Crosthwaite authored
      This is a boiler-plate _nofail variant of qemu_opts_create. Remove and
      use error_abort in call sites.
      
      null/0 arguments needs to be added for the id and fail_if_exists fields
      in affected callsites due to argument inconsistency between the normal and
      no_fail variants.
      Signed-off-by: default avatarPeter Crosthwaite <peter.crosthwaite@xilinx.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarLuiz Capitulino <lcapitulino@redhat.com>
      87ea75d5
    • Peter Crosthwaite's avatar
      error: Add error_abort · 5d24ee70
      Peter Crosthwaite authored
      Add a special Error * that can be passed to error handling APIs to
      signal that any errors are fatal and should abort QEMU. There are two
      advantages to this:
      
      - allows for brevity when wishing to assert success of Error **
        accepting APIs. No need for this pattern:
              Error * local_err = NULL;
              api_call(foo, bar, &local_err);
              assert_no_error(local_err);
        This also removes the need for _nofail variants of APIs with
        asserting call sites now reduced to 1LOC.
      - SIGABRT happens from within the offending API. When a fatal error
        occurs in an API call (when the caller is asserting sucess) failure
        often means the API itself is broken. With the abort happening in the
        API call now, the stack frames into the call are available at debug
        time. In the assert_no_error scheme the abort happens after the fact.
      
      The exact semantic is that when an error is raised, if the argument
      Error ** matches &error_abort, then the abort occurs immediately. The
      error messaged is reported.
      
      For error_propagate, if the destination error is &error_abort, then
      the abort happens at propagation time.
      Signed-off-by: default avatarPeter Crosthwaite <peter.crosthwaite@xilinx.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarLuiz Capitulino <lcapitulino@redhat.com>
      5d24ee70
  9. 29 Nov, 2013 2 commits
  10. 28 Nov, 2013 1 commit
  11. 14 Nov, 2013 1 commit
  12. 17 Oct, 2013 2 commits
    • Paolo Bonzini's avatar
      qemu-thread: add QemuEvent · c7c4d063
      Paolo Bonzini authored
      This emulates Win32 manual-reset events using futexes or conditional
      variables.  Typical ways to use them are with multi-producer,
      single-consumer data structures, to test for a complex condition whose
      elements come from different threads:
      
          for (;;) {
              qemu_event_reset(ev);
              ... test complex condition ...
              if (condition is true) {
                  break;
              }
              qemu_event_wait(ev);
          }
      
      Or more efficiently (but with some duplication):
      
          ... evaluate condition ...
          while (!condition) {
              qemu_event_reset(ev);
              ... evaluate condition ...
              if (!condition) {
                  qemu_event_wait(ev);
                  ... evaluate condition ...
              }
          }
      
      QemuEvent provides a very fast userspace path in the common case when
      no other thread is waiting, or the event is not changing state.
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      c7c4d063
    • Jan Kiszka's avatar
      compatfd: switch to QemuThread · 518420df
      Jan Kiszka authored
      qemu_thread_create already does signal blocking and detaching for us.
      Signed-off-by: default avatarJan Kiszka <jan.kiszka@siemens.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      518420df
  13. 11 Oct, 2013 1 commit
  14. 05 Oct, 2013 1 commit
  15. 02 Oct, 2013 2 commits
    • Sebastian Ottlik's avatar
      util: call socket_set_fast_reuse instead of setting SO_REUSEADDR · 04fd1c78
      Sebastian Ottlik authored
      SO_REUSEADDR should be avoided on Windows but is desired on other operating
      systems. So instead of setting it we call socket_set_fast_reuse that will result
      in the appropriate behaviour on all operating systems.
      Signed-off-by: default avatarSebastian Ottlik <ottlik@fzi.de>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Signed-off-by: default avatarStefan Weil <sw@weilnetz.de>
      04fd1c78
    • Sebastian Ottlik's avatar
      util: add socket_set_fast_reuse function which will replace setting SO_REUSEADDR · 606600a1
      Sebastian Ottlik authored
      If a socket is closed it remains in TIME_WAIT state for some time. On operating
      systems using BSD sockets the endpoint of the socket may not be reused while in
      this state unless SO_REUSEADDR was set on the socket. On windows on the other
      hand the default behaviour is to allow reuse (i.e. identical to SO_REUSEADDR on
      other operating systems) and setting SO_REUSEADDR on a socket allows it to be
      bound to a endpoint even if the endpoint is already used by another socket
      independently of the other sockets state. This can even result in undefined
      behaviour.
      
      Many sockets used by QEMU should not block the use of their endpoint after being
      closed while they are still in TIME_WAIT state. Currently QEMU sets SO_REUSEADDR
      for such sockets, which can lead to problems on Windows. This patch introduces
      the function socket_set_fast_reuse that should be used instead of setting
      SO_REUSEADDR when fast socket reuse is desired and behaves correctly on all
      operating systems.
      
      As a failure of this function can only be caused by bad QEMU internal errors, an
      assertion handles these situations. The return value is still passed on, to
      minimize changes in client code and prevent unused variable warnings if NDEBUG
      is defined.
      Signed-off-by: default avatarSebastian Ottlik <ottlik@fzi.de>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Signed-off-by: default avatarStefan Weil <sw@weilnetz.de>
      606600a1
  16. 20 Sep, 2013 1 commit
  17. 18 Sep, 2013 1 commit
  18. 12 Sep, 2013 1 commit
  19. 09 Sep, 2013 1 commit
  20. 06 Sep, 2013 1 commit
  21. 30 Aug, 2013 1 commit
  22. 12 Aug, 2013 1 commit
    • Markus Armbruster's avatar
      qemu-option: Guard against qemu_opts_set_defaults() misuse · cb77d192
      Markus Armbruster authored
      Commit 6d4cd408 fixed qemu_opts_set_defaults() for an existing corner
      case, but broke it for another one that can't be reached in current
      code.
      
      Quote from its commit message:
      
          I believe [opts_parse()] attempts to do the following:
      
              If options don't yet exist, create new options
              Else, if defaults, modify the existing options
              Else, if list->merge_lists, modify the existing options
              Else, fail
      
      The only caller that passes true for defaults is
      qemu_opts_set_defaults().
      
      The commit message then claims:
      
          A straightforward call of qemu_opts_create() does exactly that.
      
      Wrong.  When !list->merge_lists, and the option string doesn't contain
      id=, and options without ID exist, then we don't actually modify the
      existing options, we create new ones.
      
      Not reachable, because we never pass lists with !list->merge_lists to
      qemu_opts_set_defaults().
      
      Guard against possible (if unlikely) future misuse with assert().
      Reported-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Message-id: 1375428840-5275-1-git-send-email-armbru@redhat.com
      Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
      cb77d192
  23. 06 Aug, 2013 1 commit
  24. 05 Aug, 2013 1 commit
    • Izumi Tsutsui's avatar
      semaphore: fix a hangup problem under load on NetBSD hosts. · 79761c66
      Izumi Tsutsui authored
      Fix following bugs in "fallback implementation of counting semaphores
      with mutex+condvar" added in c166cb72:
       - waiting threads are not restarted properly if more than one threads
         are waiting unblock signals in qemu_sem_timedwait()
       - possible missing pthread_cond_signal(3) calls when waiting threads
         are returned by ETIMEDOUT
       - fix an uninitialized variable
      The problem is analyzed by and fix is provided by Noriyuki Soda.
      
      Also put additional cleanup suggested by Laszlo Ersek:
       - make QemuSemaphore.count unsigned (it won't be negative)
       - check a return value of in pthread_cond_wait() in qemu_sem_wait()
      Signed-off-by: default avatarIzumi Tsutsui <tsutsui@ceres.dti.ne.jp>
      Reviewed-by: default avatarLaszlo Ersek <lersek@redhat.com>
      Message-id: 1372841894-10634-1-git-send-email-tsutsui@ceres.dti.ne.jp
      Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
      79761c66
  25. 30 Jul, 2013 1 commit
  26. 27 Jul, 2013 1 commit
    • Stefan Weil's avatar
      aes: Remove unused code (NDEBUG, u16) · 9220eeed
      Stefan Weil authored
      The current code includes assert.h very early (from qemu-common.h),
      so the definition of NDEBUG was without any effect.
      
      In the initial version from 2004, NDEBUG was used to disable the assertions.
      Those assertions are not in time critical code, so it is no longer
      reasonable to disable them and the definition of NDEBUG can be removed.
      
      Type u16 is also unused and therefore does not need a type definition.
      Signed-off-by: default avatarStefan Weil <sw@weilnetz.de>
      Signed-off-by: default avatarMichael Tokarev <mjt@tls.msk.ru>
      9220eeed
  27. 26 Jul, 2013 1 commit
  28. 10 Jul, 2013 1 commit
    • Seiji Aguchi's avatar
      add timestamp to error_report() · 5e2ac519
      Seiji Aguchi authored
      [Issue]
      When we offer a customer support service and a problem happens
      in a customer's system, we try to understand the problem by
      comparing what the customer reports with message logs of the
      customer's system.
      
      In this case, we often need to know when the problem happens.
      
      But, currently, there is no timestamp in qemu's error messages.
      Therefore, we may not be able to understand the problem based on
      error messages.
      
      [Solution]
      Add a timestamp to qemu's error message logged by
      error_report() with g_time_val_to_iso8601().
      Signed-off-by: default avatarSeiji Aguchi <seiji.aguchi@hds.com>
      Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: default avatarLuiz Capitulino <lcapitulino@redhat.com>
      5e2ac519
  29. 09 Jul, 2013 2 commits
    • Markus Armbruster's avatar
      qemu-option: Fix qemu_opts_set_defaults() for corner cases · 6d4cd408
      Markus Armbruster authored
      Commit 4f6dd9af changed the initialization of opts in opts_parse() to
      this:
      
          if (defaults) {
              if (!id && !QTAILQ_EMPTY(&list->head)) {
                  opts = qemu_opts_find(list, NULL);
              } else {
                  opts = qemu_opts_create(list, id, 0);
              }
          } else {
              opts = qemu_opts_create(list, id, 1);
          }
      
      Same as before for !defaults.
      
      If defaults is true, and params has no ID, and options exist, we use
      the first assignment.  It sets opts to null if all options have an ID.
      opts_parse() then returns null.  qemu_opts_set_defaults() asserts the
      value is non-null.  It's the only caller that passes true for
      defaults.
      
      To reproduce, try "-M xenpv -machine id=foo" (yes, "id=foo" is silly,
      but it shouldn't crash).
      
      I believe the function attempts to do the following:
      
          If options don't yet exist, create new options
          Else, if defaults, modify the existing options
          Else, if list->merge_lists, modify the existing options
          Else, fail
      
      A straightforward call of qemu_opts_create() does exactly that.
      
      Cc: Jan Kiszka <jan.kiszka@siemens.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-id: 1372943363-24081-3-git-send-email-armbru@redhat.com
      Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
      6d4cd408
    • Markus Armbruster's avatar
      qemu-option: Fix qemu_opts_find() for null id arguments · 96bc97eb
      Markus Armbruster authored
      Crashes when the first list member has an ID.  Admittedly nonsensical
      reproducer:
      
      $ qemu-system-x86_64 -nodefaults -machine id=foo -machine ""
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      Message-id: 1372943363-24081-2-git-send-email-armbru@redhat.com
      Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
      96bc97eb
  30. 28 Jun, 2013 1 commit