[PATCH RFC kvm-unit-tests 00/10] merge x86 vmalloc and arm/powerpc alloc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This series unifies the memory allocators in kvm-unit-tests:

- x86 startup code sets up phys_alloc using the e801 memory map
  information from multiboot.  phys_alloc remains active until
  the tests call setup_vm.  phys_alloc is very simple and is
  not able to free any memory.

- a new MMU-friendly alloc_ops implementation is provided based on
  lib/x86/vm.c.  The new alloc_ops relies on a physical page allocator
  (in lib/alloc_page.c), which is initialized from the final phys_alloc
  state, and a virtual address allocator.  The alloc_ops get physical
  pages and maps them into a contiguous virtual address space range.

The entry points for the architecture-dependent APIs are setup_mmu,
install_page and virt_to_pte_phys.  lib/x86/vm.c implements them
together with other x86-specific functions.

TODO: test ARM and PPC; implement the new API for ARM/PPC/s390 (probably
using a soft TLB approach, similar to Linux, for PPC hashed page tables);
support sub-page allocation in the new alloc_ops.

Paolo

Paolo Bonzini (10):
  lib: simplify alloc_ops
  lib: move vmalloc here from x86
  lib: move page allocator here from x86
  alloc_page: fix off-by-one
  x86: leave VM setup out of vtd_init
  x86: prepare for extending setup.c
  x86: use alloc_phys
  alloc: implement free
  x86: turn virt_to_phys_cr3 into virt_to_pte_phys
  vmalloc: convert to alloc_ops

 arm/Makefile.common      |   2 +-
 lib/alloc.c              | 203 +++++++++++-----------------------------------
 lib/alloc.h              |  90 ++-------------------
 lib/alloc_page.c         | 116 +++++++++++++++++++++++++++
 lib/alloc_page.h         |  16 ++++
 lib/alloc_phys.c         | 132 ++++++++++++++++++++++++++++++
 lib/alloc_phys.h         |  45 +++++++++++
 lib/arm/setup.c          |   1 +
 lib/libcflat.h           |   2 +
 lib/powerpc/setup.c      |   1 +
 lib/vmalloc.c            |  98 +++++++++++++++++++++++
 lib/vmalloc.h            |  11 +++
 lib/x86/asm/page.h       |   4 +
 lib/x86/intel-iommu.c    |   4 +-
 lib/x86/intel-iommu.h    |   1 -
 lib/x86/io.c             |   2 +-
 lib/x86/isr.c            |   5 +-
 lib/x86/setup.c          |  49 +++++++++---
 lib/x86/vm.c             | 204 ++++-------------------------------------------
 lib/x86/vm.h             |  12 ---
 powerpc/Makefile.common  |   2 +-
 s390x/Makefile           |   2 +-
 x86/Makefile.common      |   4 +
 x86/asyncpf.c            |   6 +-
 x86/cstart.S             |   4 +-
 x86/cstart64.S           |   4 +-
 x86/emulator.c           |   2 +
 x86/eventinj.c           |   4 +-
 x86/hypercall.c          |   1 +
 x86/hyperv_clock.c       |   1 +
 x86/hyperv_connections.c |   1 +
 x86/hyperv_stimer.c      |   1 +
 x86/hyperv_synic.c       |   1 +
 x86/intel-iommu.c        |   5 ++
 x86/pmu.c                |   4 +-
 x86/rmap_chain.c         |   1 +
 x86/sieve.c              |   6 +-
 x86/svm.c                |   1 +
 x86/taskswitch.c         |   1 +
 x86/taskswitch2.c        |   1 +
 x86/vmx.c                |   1 +
 x86/vmx_tests.c          |   2 +
 42 files changed, 575 insertions(+), 478 deletions(-)
 create mode 100644 lib/alloc_page.c
 create mode 100644 lib/alloc_page.h
 create mode 100644 lib/alloc_phys.c
 create mode 100644 lib/alloc_phys.h
 create mode 100644 lib/vmalloc.c
 create mode 100644 lib/vmalloc.h

-- 
2.14.2




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux