1. 16 Jun, 2016 1 commit
  2. 13 Jun, 2016 1 commit
  3. 09 Jun, 2016 1 commit
  4. 30 May, 2016 2 commits
  5. 29 May, 2016 4 commits
  6. 23 May, 2016 4 commits
  7. 19 May, 2016 4 commits
  8. 13 May, 2016 1 commit
  9. 05 Apr, 2016 1 commit
    • Marc-André Lureau's avatar
      memory: fix segv on qemu_ram_free(block=0x0) · 85bc2a15
      Marc-André Lureau authored
      Since f1060c55, the pointer is directly passed to
      qemu_ram_free(). However, on initialization failure, it may be called
      with a NULL pointer. Return immediately in this case.
      This fixes a SEGV when memory initialization failed, for example
      permission denied on open backing store /dev/hugepages, with -object
      Program received signal SIGSEGV, Segmentation fault.
      0x00005555556e67e7 in qemu_ram_free (block=0x0) at /home/elmarco/src/qemu/exec.c:1775
      Signed-off-by: 's avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1459250451-29984-1-git-send-email-marcandre.lureau@redhat.com>
      Signed-off-by: 's avatarPaolo Bonzini <pbonzini@redhat.com>
  10. 22 Mar, 2016 3 commits
    • Paolo Bonzini's avatar
      exec: fix error handling in file_ram_alloc · 5c3ece79
      Paolo Bonzini authored
      One instance of double closing, and invalid close(-1) in some cases
      of "goto error".
      Reviewed-by: 's avatarLaszlo Ersek <lersek@redhat.com>
      Signed-off-by: 's avatarPaolo Bonzini <pbonzini@redhat.com>
    • Veronia Bahaa's avatar
      util: move declarations out of qemu-common.h · f348b6d1
      Veronia Bahaa authored
      Move declarations out of qemu-common.h for functions declared in
      utils/ files: e.g. include/qemu/path.h for utils/path.c.
      Move inline functions out of qemu-common.h and into new files (e.g.
      Signed-off-by: 's avatarVeronia Bahaa <veroniabahaa@gmail.com>
      Signed-off-by: 's avatarPaolo Bonzini <pbonzini@redhat.com>
    • Markus Armbruster's avatar
      include/qemu/osdep.h: Don't include qapi/error.h · da34e65c
      Markus Armbruster authored
      Commit 57cb38b3 included qapi/error.h into qemu/osdep.h to get the
      Error typedef.  Since then, we've moved to include qemu/osdep.h
      everywhere.  Its file comment explains: "To avoid getting into
      possible circular include dependencies, this file should not include
      any other QEMU headers, with the exceptions of config-host.h,
      compiler.h, os-posix.h and os-win32.h, all of which are doing a
      similar job to this file and are under similar constraints."
      qapi/error.h doesn't do a similar job, and it doesn't adhere to
      similar constraints: it includes qapi-types.h.  That's in excess of
      100KiB of crap most .c files don't actually need.
      Add the typedef to qemu/typedefs.h, and include that instead of
      qapi/error.h.  Include qapi/error.h in .c files that need it and don't
      get it now.  Include qapi-types.h in qom/object.h for uint16List.
      Update scripts/clean-includes accordingly.  Update it further to match
      reality: replace config.h by config-target.h, add sysemu/os-posix.h,
      sysemu/os-win32.h.  Update the list of includes in the qemu/osdep.h
      comment quoted above similarly.
      This reduces the number of objects depending on qapi/error.h from "all
      of them" to less than a third.  Unfortunately, the number depending on
      qapi-types.h shrinks only a little.  More work is needed for that one.
      Signed-off-by: 's avatarMarkus Armbruster <armbru@redhat.com>
      [Fix compilation without the spice devel packages. - Paolo]
      Signed-off-by: 's avatarPaolo Bonzini <pbonzini@redhat.com>
  11. 15 Mar, 2016 3 commits
    • Paolo Bonzini's avatar
      exec: fix early return from ram_block_add · 39c350ee
      Paolo Bonzini authored
      After reporting an error, ram_block_add was going on with the registration
      of the RAMBlock.  The visible effect is that it unlocked the ramlist
      mutex twice.
      Fixes: 528f46afReviewed-by: 's avatarFam Zheng <famz@redhat.com>
      Signed-off-by: 's avatarPaolo Bonzini <pbonzini@redhat.com>
    • Markus Armbruster's avatar
      exec: Fix memory allocation when memory path isn't on hugetlbfs · e1fb6471
      Markus Armbruster authored
      gethugepagesize() works reliably only when its argument is on
      hugetlbfs.  When it's not, it returns the filesystem's "optimal
      transfer block size", which may or may not be the actual page size
      you'll get when you mmap().
      If the value is too small or not a power of two, we fail
      qemu_ram_mmap()'s assertions.  These were added in commit 794e8f30
      (v2.5.0).  The bug's impact before that is currently unknown.  Seems
      fairly unlikely at least when the normal page size is 4KiB.
      Else, if the value is too large, we align more strictly than
      gethugepagesize() goes back to commit c902760f (v0.13).  That commit
      clearly intended gethugepagesize() to be used on hugetlbfs only.  Not
      only was it named accordingly, it also printed a warning when used on
      anything else.  However, the commit neglected to spell out the
      restriction in user documentation of -mem-path.
      Commit bfc2a1a1 (v2.5.0) dropped the warning as bogus "because QEMU
      functions perfectly well with the path on a regular tmpfs filesystem".
      It sure does when you're sufficiently lucky.  In my testing, I was
      lucky, too.
      Fix by switching to qemu_fd_getpagesize().  Rename the variable
      holding its result from hpagesize to page_size.
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: 's avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1457378754-21649-3-git-send-email-armbru@redhat.com>
      Signed-off-by: 's avatarPaolo Bonzini <pbonzini@redhat.com>
    • Markus Armbruster's avatar
      exec: Fix memory allocation when memory path names new file · fd97fd44
      Markus Armbruster authored
      Commit 8d31d6b6 extended file_ram_alloc() to accept file names in
      addition to directory names.  Even though it passes O_CREAT to open(),
      it actually works only for existing files.  Reproducer adapted from
      the commit's qemu-doc.texi update:
          $ qemu-system-x86_64 -object memory-backend-file,size=2M,mem-path=/dev/hugepages/my-shmem-file,id=mb1
          qemu-system-x86_64: -object memory-backend-file,size=2M,mem-path=/dev/hugepages/my-shmem-file,id=mb1: failed to get page size of file /dev/hugepages/my-shmem-file: No such file or directory
      This is because we first get the page size for @path, then open the
      actual file.  Unwise even before the flawed commit, because the
      directory could change in between, invalidating the page size.
      Unlikely to bite in practice.
      Rearrange the code to create the file (if necessary) before getting
      its page size.  Carefully avoid TOCTTOU conditions with a method
      suggested by Paolo Bonzini.
      While there, replace "hugepages" by "guest RAM" in error messages,
      because host memory backends can be used for purposes other than huge
      pages, e.g. /dev/shm/ shared memory.  Help text of -mem-path agrees.
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: 's avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1457378754-21649-2-git-send-email-armbru@redhat.com>
      Signed-off-by: 's avatarPaolo Bonzini <pbonzini@redhat.com>
  12. 07 Mar, 2016 6 commits
  13. 25 Feb, 2016 2 commits
    • Gonglei's avatar
      memory: optimize qemu_get_ram_ptr and qemu_ram_ptr_length · 3655cb9c
      Gonglei authored
      these two functions consume too much cpu overhead to
      find the RAMBlock by ram address.
      After this patch, we can pass the RAMBlock pointer
      to them so that they don't need to find the RAMBlock
      anymore most of the time. We can get better performance
      in address translation processing.
      Signed-off-by: 's avatarGonglei <arei.gonglei@huawei.com>
      Message-Id: <1455935721-8804-3-git-send-email-arei.gonglei@huawei.com>
      Signed-off-by: 's avatarPaolo Bonzini <pbonzini@redhat.com>
    • Gonglei's avatar
      exec: store RAMBlock pointer into memory region · 58eaa217
      Gonglei authored
      Each RAM memory region has a unique corresponding RAMBlock.
      In the current realization, the memory region only stored
      the ram_addr which means the offset of RAM address space,
      We need to qurey the global ram.list to find the ram block
      by ram_addr if we want to get the ram block, which is very
      Now, we store the RAMBlock pointer into memory region
      structure. So, if we know the mr, we can easily get the
      Signed-off-by: 's avatarGonglei <arei.gonglei@huawei.com>
      Message-Id: <1456130097-4208-2-git-send-email-arei.gonglei@huawei.com>
      Signed-off-by: 's avatarPaolo Bonzini <pbonzini@redhat.com>
  14. 11 Feb, 2016 2 commits
  15. 09 Feb, 2016 1 commit
    • Stefan Hajnoczi's avatar
      memory: RCU ram_list.dirty_memory[] for safe RAM hotplug · 5b82b703
      Stefan Hajnoczi authored
      Although accesses to ram_list.dirty_memory[] use atomics so multiple
      threads can safely dirty the bitmap, the data structure is not fully
      thread-safe yet.
      This patch handles the RAM hotplug case where ram_list.dirty_memory[] is
      grown.  ram_list.dirty_memory[] is change from a regular bitmap to an
      RCU array of pointers to fixed-size bitmap blocks.  Threads can continue
      accessing bitmap blocks while the array is being extended.  See the
      comments in the code for an in-depth explanation of struct
      I have tested that live migration with virtio-blk dataplane works.
      Signed-off-by: 's avatarStefan Hajnoczi <stefanha@redhat.com>
      Message-Id: <1453728801-5398-2-git-send-email-stefanha@redhat.com>
      Signed-off-by: 's avatarPaolo Bonzini <pbonzini@redhat.com>
  16. 03 Feb, 2016 1 commit
  17. 29 Jan, 2016 1 commit
    • Peter Maydell's avatar
      exec: Clean up includes · 7b31bbc2
      Peter Maydell authored
      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: 's avatarPeter Maydell <peter.maydell@linaro.org>
      Message-id: 1453832250-766-4-git-send-email-peter.maydell@linaro.org
  18. 21 Jan, 2016 2 commits