1. 14 7月, 2020 1 次提交
  2. 13 7月, 2020 2 次提交
  3. 23 6月, 2020 1 次提交
  4. 11 6月, 2020 1 次提交
  5. 11 4月, 2020 1 次提交
  6. 17 3月, 2020 1 次提交
  7. 25 2月, 2020 1 次提交
    • B
      mem-prealloc: optimize large guest startup · 037fb5eb
      bauerchen 提交于
      [desc]:
          Large memory VM starts slowly when using -mem-prealloc, and
          there are some areas to optimize in current method;
      
          1、mmap will be used to alloc threads stack during create page
          clearing threads, and it will attempt mm->mmap_sem for write
          lock, but clearing threads have hold read lock, this competition
          will cause threads createion very slow;
      
          2、methods of calcuating pages for per threads is not well;if we use
          64 threads to split 160 hugepage,63 threads clear 2page,1 thread
          clear 34 page,so the entire speed is very slow;
      
          to solve the first problem,we add a mutex in thread function,and
          start all threads when all threads finished createion;
          and the second problem, we spread remainder to other threads,in
          situation that 160 hugepage and 64 threads, there are 32 threads
          clear 3 pages,and 32 threads clear 2 pages.
      
      [test]:
          320G 84c VM start time can be reduced to 10s
          680G 84c VM start time can be reduced to 18s
      Signed-off-by: Nbauerchen <bauerchen@tencent.com>
      Reviewed-by: NPan Rui <ruippan@tencent.com>
      Reviewed-by: NIvan Ren <ivanren@tencent.com>
      [Simplify computation of the number of pages per thread. - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      037fb5eb
  8. 26 10月, 2019 1 次提交
    • W
      core: replace getpagesize() with qemu_real_host_page_size · 038adc2f
      Wei Yang 提交于
      There are three page size in qemu:
      
        real host page size
        host page size
        target page size
      
      All of them have dedicate variable to represent. For the last two, we
      use the same form in the whole qemu project, while for the first one we
      use two forms: qemu_real_host_page_size and getpagesize().
      
      qemu_real_host_page_size is defined to be a replacement of
      getpagesize(), so let it serve the role.
      
      [Note] Not fully tested for some arch or device.
      Signed-off-by: NWei Yang <richardw.yang@linux.intel.com>
      Message-Id: <20191013021145.16011-3-richardw.yang@linux.intel.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      038adc2f
  9. 16 9月, 2019 1 次提交
    • S
      memory: fetch pmem size in get_file_size() · 72d41eb4
      Stefan Hajnoczi 提交于
      Neither stat(2) nor lseek(2) report the size of Linux devdax pmem
      character device nodes.  Commit 314aec4a
      ("hostmem-file: reject invalid pmem file sizes") added code to
      hostmem-file.c to fetch the size from sysfs and compare against the
      user-provided size=NUM parameter:
      
        if (backend->size > size) {
            error_setg(errp, "size property %" PRIu64 " is larger than "
                       "pmem file \"%s\" size %" PRIu64, backend->size,
                       fb->mem_path, size);
            return;
        }
      
      It turns out that exec.c:qemu_ram_alloc_from_fd() already has an
      equivalent size check but it skips devdax pmem character devices because
      lseek(2) returns 0:
      
        if (file_size > 0 && file_size < size) {
            error_setg(errp, "backing store %s size 0x%" PRIx64
                       " does not match 'size' option 0x" RAM_ADDR_FMT,
                       mem_path, file_size, size);
            return NULL;
        }
      
      This patch moves the devdax pmem file size code into get_file_size() so
      that we check the memory size in a single place:
      qemu_ram_alloc_from_fd().  This simplifies the code and makes it more
      general.
      
      This also fixes the problem that hostmem-file only checks the devdax
      pmem file size when the pmem=on parameter is given.  An unchecked
      size=NUM parameter can lead to SIGBUS in QEMU so we must always fetch
      the file size for Linux devdax pmem character device nodes.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Message-Id: <20190830093056.12572-1-stefanha@redhat.com>
      Reviewed-by: NEduardo Habkost <ehabkost@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      72d41eb4
  10. 16 8月, 2019 1 次提交
  11. 12 6月, 2019 1 次提交
    • M
      Include qemu-common.h exactly where needed · a8d25326
      Markus Armbruster 提交于
      No header includes qemu-common.h after this commit, as prescribed by
      qemu-common.h's file comment.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20190523143508.25387-5-armbru@redhat.com>
      [Rebased with conflicts resolved automatically, except for
      include/hw/arm/xlnx-zynqmp.h hw/arm/nrf51_soc.c hw/arm/msf2-soc.c
      block/qcow2-refcount.c block/qcow2-cluster.c block/qcow2-cache.c
      target/arm/cpu.h target/lm32/cpu.h target/m68k/cpu.h target/mips/cpu.h
      target/moxie/cpu.h target/nios2/cpu.h target/openrisc/cpu.h
      target/riscv/cpu.h target/tilegx/cpu.h target/tricore/cpu.h
      target/unicore32/cpu.h target/xtensa/cpu.h; bsd-user/main.c and
      net/tap-bsd.c fixed up]
      a8d25326
  12. 26 4月, 2019 1 次提交
  13. 11 3月, 2019 2 次提交
  14. 05 2月, 2019 1 次提交
    • M
      mmap-alloc: fix hugetlbfs misaligned length in ppc64 · 7265c2b9
      Murilo Opsfelder Araujo 提交于
      The commit 7197fb40 ("util/mmap-alloc:
      fix hugetlb support on ppc64") fixed Huge TLB mappings on ppc64.
      
      However, we still need to consider the underlying huge page size
      during munmap() because it requires that both address and length be a
      multiple of the underlying huge page size for Huge TLB mappings.
      Quote from "Huge page (Huge TLB) mappings" paragraph under NOTES
      section of the munmap(2) manual:
      
        "For munmap(), addr and length must both be a multiple of the
        underlying huge page size."
      
      On ppc64, the munmap() in qemu_ram_munmap() does not work for Huge TLB
      mappings because the mapped segment can be aligned with the underlying
      huge page size, not aligned with the native system page size, as
      returned by getpagesize().
      
      This has the side effect of not releasing huge pages back to the pool
      after a hugetlbfs file-backed memory device is hot-unplugged.
      
      This patch fixes the situation in qemu_ram_mmap() and
      qemu_ram_munmap() by considering the underlying page size on ppc64.
      
      After this patch, memory hot-unplug releases huge pages back to the
      pool.
      
      Fixes: 7197fb40Signed-off-by: NMurilo Opsfelder Araujo <muriloo@linux.ibm.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      7265c2b9
  15. 04 2月, 2019 1 次提交
    • M
      mmap-alloc: fix hugetlbfs misaligned length in ppc64 · 53adb9d4
      Murilo Opsfelder Araujo 提交于
      The commit 7197fb40 ("util/mmap-alloc:
      fix hugetlb support on ppc64") fixed Huge TLB mappings on ppc64.
      
      However, we still need to consider the underlying huge page size
      during munmap() because it requires that both address and length be a
      multiple of the underlying huge page size for Huge TLB mappings.
      Quote from "Huge page (Huge TLB) mappings" paragraph under NOTES
      section of the munmap(2) manual:
      
        "For munmap(), addr and length must both be a multiple of the
        underlying huge page size."
      
      On ppc64, the munmap() in qemu_ram_munmap() does not work for Huge TLB
      mappings because the mapped segment can be aligned with the underlying
      huge page size, not aligned with the native system page size, as
      returned by getpagesize().
      
      This has the side effect of not releasing huge pages back to the pool
      after a hugetlbfs file-backed memory device is hot-unplugged.
      
      This patch fixes the situation in qemu_ram_mmap() and
      qemu_ram_munmap() by considering the underlying page size on ppc64.
      
      After this patch, memory hot-unplug releases huge pages back to the
      pool.
      
      Fixes: 7197fb40Signed-off-by: NMurilo Opsfelder Araujo <muriloo@linux.ibm.com>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      53adb9d4
  16. 15 1月, 2019 1 次提交
  17. 06 11月, 2018 1 次提交
    • B
      oslib-posix: Use MAP_STACK in qemu_alloc_stack() on OpenBSD · fc3d1bad
      Brad Smith 提交于
      Use MAP_STACK in qemu_alloc_stack() on OpenBSD.
      
      Added to our 6.4 release.
      
      MAP_STACK      Indicate that the mapping is used as a stack.  This
                     flag must be used in combination with MAP_ANON and
                     MAP_PRIVATE.
      
      Implement MAP_STACK option for mmap().  Synchronous faults (pagefault and
      syscall) confirm the stack register points at MAP_STACK memory, otherwise
      SIGSEGV is delivered. sigaltstack() and pthread_attr_setstack() are modified
      to create a MAP_STACK sub-region which satisfies alignment requirements.
      Observe that MAP_STACK can only be set/cleared by mmap(), which zeroes the
      contents of the region -- there is no mprotect() equivalent operation, so
      there is no MAP_STACK-adding gadget.
      Signed-off-by: NBrad Smith <brad@comstyle.com>
      Reviewed-by: NKamil Rytarowski <n54@gmx.com>
      Reviewed-by: NPeter Maydell <peter.maydell@linaro.org>
      Message-id: 20181019125239.GA13884@humpty.home.comstyle.com
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      fc3d1bad
  18. 03 10月, 2018 2 次提交
    • M
      util: use fcntl() for qemu_write_pidfile() locking · 35f7f3fb
      Marc-André Lureau 提交于
      Daniel Berrangé suggested to use fcntl() locks rather than lockf().
      
      'man lockf':
      
         On Linux, lockf() is just an interface on top of fcntl(2) locking.
         Many other systems implement lockf() in this way, but note that
         POSIX.1 leaves the relationship between lockf() and fcntl(2) locks
         unspecified.  A portable application should probably avoid mixing
         calls to these interfaces.
      
      IOW, if its just a shim around fcntl() on many systems, it is clearer
      if we just use fcntl() directly, as we then know how fcntl() locks will
      behave if they're on a network filesystem like NFS.
      Suggested-by: NDaniel P. Berrangé <berrange@redhat.com>
      Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <20180831145314.14736-3-marcandre.lureau@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      35f7f3fb
    • M
      util: add qemu_write_pidfile() · 9e6bdef2
      Marc-André Lureau 提交于
      There are variants of qemu_create_pidfile() in qemu-pr-helper and
      qemu-ga. Let's have a common implementation in libqemuutil.
      
      The code is initially based from pr-helper write_pidfile(), with
      various improvements and suggestions from Daniel Berrangé:
      
        QEMU will leave the pidfile existing on disk when it exits which
        initially made me think it avoids the deletion race. The app
        managing QEMU, however, may well delete the pidfile after it has
        seen QEMU exit, and even if the app locks the pidfile before
        deleting it, there is still a race.
      
        eg consider the following sequence
      
              QEMU 1        libvirtd        QEMU 2
      
        1.    lock(pidfile)
      
        2.    exit()
      
        3.                 open(pidfile)
      
        4.                 lock(pidfile)
      
        5.                                  open(pidfile)
      
        6.                 unlink(pidfile)
      
        7.                 close(pidfile)
      
        8.                                  lock(pidfile)
      
        IOW, at step 8 the new QEMU has successfully acquired the lock, but
        the pidfile no longer exists on disk because it was deleted after
        the original QEMU exited.
      
        While we could just say no external app should ever delete the
        pidfile, I don't think that is satisfactory as people don't read
        docs, and admins don't like stale pidfiles being left around on
        disk.
      
        To make this robust, I think we might want to copy libvirt's
        approach to pidfile acquisition which runs in a loop and checks that
        the file on disk /after/ acquiring the lock matches the file that
        was locked. Then we could in fact safely let QEMU delete its own
        pidfiles on clean exit..
      Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <20180831145314.14736-2-marcandre.lureau@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      9e6bdef2
  19. 19 2月, 2018 1 次提交
    • M
      mem: add share parameter to memory-backend-ram · 06329cce
      Marcel Apfelbaum 提交于
      Currently only file backed memory backend can
      be created with a "share" flag in order to allow
      sharing guest RAM with other processes in the host.
      
      Add the "share" flag also to RAM Memory Backend
      in order to allow remapping parts of the guest RAM
      to different host virtual addresses. This is needed
      by the RDMA devices in order to remap non-contiguous
      QEMU virtual addresses to a contiguous virtual address range.
      
      Moved the "share" flag to the Host Memory base class,
      modified phys_mem_alloc to include the new parameter
      and a new interface memory_region_init_ram_shared_nomigrate.
      
      There are no functional changes if the new flag is not used.
      Reviewed-by: NEduardo Habkost <ehabkost@redhat.com>
      Signed-off-by: NMarcel Apfelbaum <marcel@redhat.com>
      06329cce
  20. 10 2月, 2018 1 次提交
  21. 03 11月, 2017 1 次提交
  22. 20 10月, 2017 1 次提交
  23. 30 8月, 2017 1 次提交
  24. 21 7月, 2017 1 次提交
    • P
      util/oslib-posix.c: Avoid warning on NetBSD · 02ffa034
      Peter Maydell 提交于
      On NetBSD the compiler warns:
      util/oslib-posix.c: In function 'sigaction_invoke':
      util/oslib-posix.c:589:5: warning: missing braces around initializer [-Wmissing-braces]
           siginfo_t si = { 0 };
           ^
      util/oslib-posix.c:589:5: warning: (near initialization for 'si.si_pad') [-Wmissing-braces]
      
      because on this platform siginfo_t is defined as
        typedef union siginfo {
                char    si_pad[128];    /* Total size; for future expansion */
                struct _ksiginfo _info;
        } siginfo_t;
      
      Avoid this warning by initializing the struct with {} instead;
      this is a GCC extension but we use it all over the codebase already.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-id: 1500568341-8389-1-git-send-email-peter.maydell@linaro.org
      02ffa034
  25. 11 7月, 2017 1 次提交
  26. 07 6月, 2017 2 次提交
  27. 25 5月, 2017 1 次提交
  28. 24 3月, 2017 1 次提交
  29. 18 3月, 2017 1 次提交
  30. 15 3月, 2017 1 次提交
  31. 14 3月, 2017 1 次提交
    • J
      mem-prealloc: reduce large guest start-up and migration time. · 1e356fc1
      Jitendra Kolhe 提交于
      Using "-mem-prealloc" option for a large guest leads to higher guest
      start-up and migration time. This is because with "-mem-prealloc" option
      qemu tries to map every guest page (create address translations), and
      make sure the pages are available during runtime. virsh/libvirt by
      default, seems to use "-mem-prealloc" option in case the guest is
      configured to use huge pages. The patch tries to map all guest pages
      simultaneously by spawning multiple threads. Currently limiting the
      change to QEMU library functions on POSIX compliant host only, as we are
      not sure if the problem exists on win32. Below are some stats with
      "-mem-prealloc" option for guest configured to use huge pages.
      
      ------------------------------------------------------------------------
      Idle Guest      | Start-up time | Migration time
      ------------------------------------------------------------------------
      Guest stats with 2M HugePage usage - single threaded (existing code)
      ------------------------------------------------------------------------
      64 Core - 4TB   | 54m11.796s    | 75m43.843s
      64 Core - 1TB   | 8m56.576s     | 14m29.049s
      64 Core - 256GB | 2m11.245s     | 3m26.598s
      ------------------------------------------------------------------------
      Guest stats with 2M HugePage usage - map guest pages using 8 threads
      ------------------------------------------------------------------------
      64 Core - 4TB   | 5m1.027s      | 34m10.565s
      64 Core - 1TB   | 1m10.366s     | 8m28.188s
      64 Core - 256GB | 0m19.040s     | 2m10.148s
      -----------------------------------------------------------------------
      Guest stats with 2M HugePage usage - map guest pages using 16 threads
      -----------------------------------------------------------------------
      64 Core - 4TB   | 1m58.970s     | 31m43.400s
      64 Core - 1TB   | 0m39.885s     | 7m55.289s
      64 Core - 256GB | 0m11.960s     | 2m0.135s
      -----------------------------------------------------------------------
      
      Changed in v2:
       - modify number of memset threads spawned to min(smp_cpus, 16).
       - removed 64GB memory restriction for spawning memset threads.
      
      Changed in v3:
       - limit number of threads spawned based on
         min(sysconf(_SC_NPROCESSORS_ONLN), 16, smp_cpus)
       - implement memset thread specific siglongjmp in SIGBUS signal_handler.
      
      Changed in v4
       - remove sigsetjmp/siglongjmp and SIGBUS unblock/block for main thread
         as main thread no longer touches any pages.
       - simplify code my returning memset_thread_failed status from
         touch_all_pages.
      Signed-off-by: NJitendra Kolhe <jitendra.kolhe@hpe.com>
      Message-Id: <1487907103-32350-1-git-send-email-jitendra.kolhe@hpe.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      1e356fc1
  32. 03 3月, 2017 1 次提交
  33. 22 11月, 2016 1 次提交
  34. 28 10月, 2016 1 次提交
  35. 04 10月, 2016 1 次提交
  36. 29 9月, 2016 1 次提交