Skip to content

merge x86 vmalloc and arm/powerpc alloc

Paolo Bonzini kvm 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest18 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/18lib: simplify alloc_opsarm/Makefile.common lib/alloc.h lib/alloc_phys.c +5 more+59 -1270 replies
2/18lib: start moving vmalloc to generic codelib/vmalloc.c lib/vmalloc.h lib/x86/vm.c +7 more+51 -210 replies
3/18lib: move page allocator here from x86lib/alloc_page.c lib/alloc_page.h lib/x86/intel-iommu.c +17 more+166 -1120 replies
4/18alloc_page: fix off-by-onelib/alloc_page.c+2 -10 replies
5/18x86: leave VM setup out of vtd_initlib/x86/intel-iommu.c x86/intel-iommu.c+3 -40 replies
6/18x86: prepare for extending setup.clib/x86/setup.c x86/cstart.S x86/cstart64.S+36 -170 replies
7/18x86: use alloc_physlib/alloc_page.c lib/alloc_phys.c lib/alloc_phys.h +7 more+46 -210 replies
8/18alloc: implement freearm/Makefile.common lib/alloc.c lib/alloc.h +2 more+86 -380 replies
9/18x86: introduce pgd_t and pteval_tlib/x86/asm/page.h lib/x86/vm.c lib/x86/vm.h+44 -490 replies
10/18x86: turn virt_to_phys_cr3 into virt_to_pte_physlib/vmalloc.h lib/x86/vm.c lib/x86/vm.h +1 more+5 -40 replies
11/18vmalloc: convert to alloc_opslib/alloc.c lib/alloc.h lib/vmalloc.c +10 more+76 -640 replies
12/18arm64: use adrp instead of adrarm/cstart64.S+14 -110 replies
13/18arm: make pgtable.h private to mmu.clib/arm/asm/mmu-api.h lib/arm/asm/mmu.h lib/arm/asm/pgtable.h +3 more+11 -60 replies
14/18arm: get rid of pudlib/arm/asm/page.h lib/arm/asm/pgtable.h lib/arm/mmu.c +3 more+16 -520 replies
15/18arm: use better-matching types for virtual and physical addresseslib/arm/asm/mmu-api.h lib/arm/mmu.c+20 -240 replies
16/18arm: only align CPU stacks to one pagelib/arm/asm/thread_info.h+1 -13 replies
17/18arm: do not allocate virtio buffers from the stacklib/chr-testdev.c+8 -92 replies
18/18arm: enable vmallocarm/Makefile.common arm/sieve.c lib/arm/asm/mmu-api.h +5 more+70 -230 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH kvm-unit-tests 00/18] merge x86 vmalloc and arm/powerpc alloc

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
Signature · 1 line
2.14.2