1. 18 2月, 2015 1 次提交
  2. 10 2月, 2015 8 次提交
  3. 02 2月, 2015 3 次提交
    • P
      rcu: add call_rcu · 26387f86
      Paolo Bonzini 提交于
      Asynchronous callbacks provided by call_rcu are particularly important
      for QEMU, because the BQL makes it hard to use synchronize_rcu.
      
      In addition, the current RCU implementation is not particularly friendly
      to multiple concurrent synchronize_rcu callers, making call_rcu even
      more important.
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      26387f86
    • P
      rcu: add rcu library · 7911747b
      Paolo Bonzini 提交于
      This includes a (mangled) copy of the liburcu code.  The main changes
      are: 1) removing dependencies on many other header files in liburcu; 2)
      removing for simplicity the tentative busy waiting in synchronize_rcu,
      which has limited performance effects; 3) replacing futexes in
      synchronize_rcu with QemuEvents for Win32 portability.  The API is
      the same as liburcu, so it should be possible in the future to require
      liburcu on POSIX systems for example and use our copy only on Windows.
      
      Among the various versions available I chose urcu-mb, which is the
      least invasive implementation even though it does not have the
      fastest rcu_read_{lock,unlock} implementation.  The urcu flavor can
      be changed later, after benchmarking.
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      7911747b
    • P
      qemu-thread: fix qemu_event without futexes · 158ef8cb
      Paolo Bonzini 提交于
      This had a possible deadlock that was visible with rcutorture.
      
          qemu_event_set                    qemu_event_wait
          ----------------------------------------------------------------
                                            cmpxchg reads FREE, writes BUSY
                                            futex_wait: pthread_mutex_lock
                                            futex_wait: value == BUSY
          xchg reads BUSY, writes SET
          futex_wake: pthread_cond_broadcast
                                            futex_wait: pthread_cond_wait
                                            <deadlock>
      
      The fix is simply to avoid condvar tricks and do the obvious locking
      around pthread_cond_broadcast:
      
          qemu_event_set        qemu_event_wait
          ----------------------------------------------------------------
                                            cmpxchg reads FREE, writes BUSY
                                            futex_wait: pthread_mutex_lock
                                            futex_wait: value == BUSY
          xchg reads BUSY, writes SET
          futex_wake: pthread_mutex_lock
          (blocks)
                                            futex_wait: pthread_cond_wait
          (mutex unlocked)
          futex_wake: pthread_cond_broadcast
          futex_wake: pthread_mutex_unlock
                                            futex_wait: pthread_mutex_unlock
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      158ef8cb
  4. 13 1月, 2015 1 次提交
    • P
      qemu-thread: add per-thread atexit functions · ef57137f
      Paolo Bonzini 提交于
      Destructors are the main additional feature of pthread TLS compared
      to __thread.  If we were using C++ (hint, hint!) we could have used
      thread-local objects with a destructor.  Since we are not, instead,
      we add a simple Notifier-based API.
      
      Note that the notifier must be per-thread as well.  We can add a
      global list as well later, perhaps.
      
      The Win32 implementation has some complications because a) detached
      threads used not to have a QemuThreadData; b) the main thread does
      not go through win32_start_routine, so we have to use atexit too.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Message-id: 1417518350-6167-3-git-send-email-pbonzini@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      ef57137f
  5. 13 12月, 2014 1 次提交
  6. 10 12月, 2014 4 次提交
  7. 23 11月, 2014 1 次提交
  8. 17 11月, 2014 1 次提交
  9. 02 11月, 2014 1 次提交
  10. 09 10月, 2014 2 次提交
  11. 03 10月, 2014 1 次提交
    • M
      util: Emancipate id_wellformed() from QemuOpts · f5bebbbb
      Markus Armbruster 提交于
      IDs have long spread beyond QemuOpts: not everything with an ID
      necessarily goes through QemuOpts.  Commit 9aebf3b8 is about such a
      case: block layer names are meant to be well-formed IDs, but some of
      them don't go through QemuOpts, and thus weren't checked.  The commit
      fixed that the straightforward way: rename the internal QemuOpts
      helper id_wellformed() to qemu_opts_id_wellformed() and give it
      external linkage.
      
      Instead of using it directly in block.c, the commit adds wrapper
      bdrv_is_valid_name(), probably to hide the connection to QemuOpts.
      
      Go one logical step further: emancipate IDs from QemuOpts.  Rename the
      function back to id_wellformed(), and put it in another file.  While
      there, clean up its value to bool.  Peel off the bdrv_is_valid_name()
      wrapper.
      
      [Replaced stray return 0 with return false to match bool returns used
      elsewhere in id_wellformed().
      --Stefan]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      f5bebbbb
  12. 27 9月, 2014 1 次提交
  13. 25 9月, 2014 1 次提交
    • K
      block: Validate node-name · 9aebf3b8
      Kevin Wolf 提交于
      The device_name of a BlockDriverState is currently checked because it is
      always used as a QemuOpts ID and qemu_opts_create() checks whether such
      IDs are wellformed.
      
      node-name is supposed to share the same namespace, but it isn't checked
      currently. This patch adds explicit checks both for device_name and
      node-name so that the same rules will still apply even if QemuOpts won't
      be used any more at some point.
      
      qemu-img used to use names with spaces in them, which isn't allowed any
      more. Replace them with underscores.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      9aebf3b8
  14. 17 9月, 2014 1 次提交
    • P
      util/qemu-sockets.c: Support specifying IPv4 or IPv6 in socket_dgram() · 8287fea3
      Peter Maydell 提交于
      Currently you can specify whether you want a UDP chardev backend
      to be IPv4 or IPv6 using the ipv4 or ipv6 options if you use the
      QemuOpts parsing code in inet_dgram_opts(). However the QMP struct
      parsing code in socket_dgram() doesn't provide this flexibility
      (which in turn prevents us from converting the UDP backend handling
      to the new style QAPI framework).
      
      Use the existing inet_addr_to_opts() function to convert the
      remote->inet address to option strings; this handles ipv4 and
      ipv6 flags as well as host and port. (It will also convert any
      'to' specification, which is harmless as it is ignored in this
      context.)
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Message-id: 1409653457-27863-3-git-send-email-peter.maydell@linaro.org
      8287fea3
  15. 09 9月, 2014 2 次提交
  16. 24 8月, 2014 1 次提交
  17. 15 8月, 2014 2 次提交
  18. 18 7月, 2014 2 次提交
  19. 14 7月, 2014 1 次提交
    • K
      dma-helpers: Fix too long qiov · 58f423fb
      Kevin Wolf 提交于
      If the size of the scatter/gather list isn't a multiple of 512, the
      number of sectors for the block layer request is rounded down, resulting
      in a qiov that doesn't match the request length. Truncate the qiov to the
      new length of the request.
      
      This fixes the IDE qtest case /x86_64/ide/bmdma/short_prdt.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      58f423fb
  20. 10 7月, 2014 1 次提交
  21. 26 6月, 2014 1 次提交
    • M
      qemu_opts_append: Play nicely with QemuOptsList's head · a7607150
      Michal Privoznik 提交于
      When running a libvirt test suite I've noticed the qemu-img is
      crashing occasionally. Tracing the problem down led me to the
      following valgrind output:
      
      qemu.git $ valgrind -q ./qemu-img create -f qed -obacking_file=/dev/null,backing_fmt=raw qed
      ==14881== Invalid write of size 8
      ==14881==    at 0x1D263F: qemu_opts_create (qemu-option.c:692)
      ==14881==    by 0x130782: bdrv_img_create (block.c:5531)
      ==14881==    by 0x118DE0: img_create (qemu-img.c:462)
      ==14881==    by 0x11E7E4: main (qemu-img.c:2830)
      ==14881==  Address 0x11fedd38 is 24 bytes inside a block of size 232 free'd
      ==14881==    at 0x4C2CA5E: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==14881==    by 0x592D35E: g_realloc (in /usr/lib64/libglib-2.0.so.0.3800.2)
      ==14881==    by 0x1D38D8: qemu_opts_append (qemu-option.c:1129)
      ==14881==    by 0x13075E: bdrv_img_create (block.c:5528)
      ==14881==    by 0x118DE0: img_create (qemu-img.c:462)
      ==14881==    by 0x11E7E4: main (qemu-img.c:2830)
      ==14881==
      Formatting 'qed', fmt=qed size=0 backing_file='/dev/null' backing_fmt='raw' cluster_size=65536
      ==14881== Invalid write of size 8
      ==14881==    at 0x1D28BE: qemu_opts_del (qemu-option.c:750)
      ==14881==    by 0x130BF3: bdrv_img_create (block.c:5638)
      ==14881==    by 0x118DE0: img_create (qemu-img.c:462)
      ==14881==    by 0x11E7E4: main (qemu-img.c:2830)
      ==14881==  Address 0x11fedd38 is 24 bytes inside a block of size 232 free'd
      ==14881==    at 0x4C2CA5E: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==14881==    by 0x592D35E: g_realloc (in /usr/lib64/libglib-2.0.so.0.3800.2)
      ==14881==    by 0x1D38D8: qemu_opts_append (qemu-option.c:1129)
      ==14881==    by 0x13075E: bdrv_img_create (block.c:5528)
      ==14881==    by 0x118DE0: img_create (qemu-img.c:462)
      ==14881==    by 0x11E7E4: main (qemu-img.c:2830)
      ==14881==
      
      The problem is apparently in the qemu_opts_append(). Well, if it
      gets called twice or more. On the first call, when @dst is NULL
      some initialization is done during which @dst->head list gets
      initialized. The list is initialized in a way, so that the list
      tail points at the list head. However, the next time
      qemu_opts_append() is called for new options to be added,
      g_realloc() may move @dst to a new address making the old list tail
      point at an invalid address. If that's the case, we must update the
      list pointers.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      a7607150
  22. 23 6月, 2014 3 次提交