[PATCH kvm-unit-tests 00/18] 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.

Changes from yesterday's RFC include:

- code style fixes when code was moved

- spinlocks in the page allocator

- an extra patch "x86: introduce pgd_t and pteval_t" to avoid abusing
  unsigned long / u64, and in general paying more attention to types

- quite a few bugfixes

- the final 7 patches that port ARM tests to use the new mechanism

- tested on i386 and PPC too

Possible extensions include implementing the new API for PPC/s390 (probably
using a soft TLB approach, similar to Linux, for PPC hashed page tables),
and supporting sub-page allocation in malloc.

Paolo

Paolo Bonzini (18):
  lib: simplify alloc_ops
  lib: start moving vmalloc to generic code
  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: introduce pgd_t and pteval_t
  x86: turn virt_to_phys_cr3 into virt_to_pte_phys
  vmalloc: convert to alloc_ops
  arm64: use adrp instead of adr
  arm: make pgtable.h private to mmu.c
  arm: get rid of pud
  arm: use better-matching types for virtual and physical addresses
  arm: only align CPU stacks to one page
  arm: do not allocate virtio buffers from the stack
  arm: enable vmalloc

 arm/Makefile.common           |   4 +
 arm/cstart64.S                |  25 ++--
 arm/sieve.c                   |   1 +
 lib/alloc.c                   | 202 ++++++++------------------------
 lib/alloc.h                   |  90 +--------------
 lib/alloc_page.c              | 131 +++++++++++++++++++++
 lib/alloc_page.h              |  16 +++
 lib/alloc_phys.c              | 132 +++++++++++++++++++++
 lib/alloc_phys.h              |  45 ++++++++
 lib/arm/asm/mmu-api.h         |  15 ++-
 lib/arm/asm/mmu.h             |   1 -
 lib/arm/asm/page.h            |   4 -
 lib/arm/asm/pgtable.h         |  36 +++---
 lib/arm/asm/thread_info.h     |   2 +-
 lib/arm/bitops.c              |   1 +
 lib/arm/mmu.c                 | 104 +++++++++++------
 lib/arm/setup.c               |   3 +-
 lib/arm64/asm/mmu.h           |   1 -
 lib/arm64/asm/page.h          |  12 +-
 lib/arm64/asm/pgtable-hwdef.h |  17 +--
 lib/arm64/asm/pgtable.h       |  15 +--
 lib/chr-testdev.c             |  17 ++-
 lib/libcflat.h                |   2 +
 lib/powerpc/setup.c           |   1 +
 lib/virtio-mmio.c             |   4 +-
 lib/vmalloc.c                 | 102 ++++++++++++++++
 lib/vmalloc.h                 |  17 +++
 lib/x86/asm/page.h            |   3 +
 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                  | 262 +++++++-----------------------------------
 lib/x86/vm.h                  |  41 +++----
 powerpc/Makefile.common       |   1 +
 s390x/Makefile                |   2 +-
 x86/Makefile.common           |   4 +
 x86/asyncpf.c                 |   7 +-
 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              |   2 +
 x86/sieve.c                   |   6 +-
 x86/svm.c                     |   1 +
 x86/taskswitch.c              |   1 +
 x86/taskswitch2.c             |   2 +
 x86/vmx.c                     |   1 +
 x86/vmx_tests.c               |   2 +
 57 files changed, 777 insertions(+), 647 deletions(-)
 create mode 120000 arm/sieve.c
 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