merge x86 vmalloc and arm/powerpc alloc
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest18 patches 5 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/18 | lib: simplify alloc_opsarm/ lib/ lib/ +5 more | +59 | 0 replies | |
| 2/18 | lib: start moving vmalloc to generic codelib/ lib/ lib/ +7 more | +51 | 0 replies | |
| 3/18 | lib: move page allocator here from x86lib/ lib/ lib/ +17 more | +166 | 0 replies | |
| 4/18 | alloc_page: fix off-by-onelib/ | +2 | 0 replies | |
| 5/18 | x86: leave VM setup out of vtd_initlib/ x86/ | +3 | 0 replies | |
| 6/18 | x86: prepare for extending setup.clib/ x86/ x86/ | +36 | 0 replies | |
| 7/18 | x86: use alloc_physlib/ lib/ lib/ +7 more | +46 | 0 replies | |
| 8/18 | alloc: implement freearm/ lib/ lib/ +2 more | +86 | 0 replies | |
| 9/18 | x86: introduce pgd_t and pteval_tlib/ lib/ lib/ | +44 | 0 replies | |
| 10/18 | x86: turn virt_to_phys_cr3 into virt_to_pte_physlib/ lib/ lib/ +1 more | +5 | 0 replies | |
| 11/18 | vmalloc: convert to alloc_opslib/ lib/ lib/ +10 more | +76 | 0 replies | |
| 12/18 | arm64: use adrp instead of adrarm/ | +14 | 0 replies | |
| 13/18 | arm: make pgtable.h private to mmu.clib/ lib/ lib/ +3 more | +11 | 0 replies | |
| 14/18 | arm: get rid of pudlib/ lib/ lib/ +3 more | +16 | 0 replies | |
| 15/18 | arm: use better-matching types for virtual and physical addresseslib/ lib/ | +20 | 0 replies | |
| 16/18 | arm: only align CPU stacks to one pagelib/ | +1 | 3 replies | |
| 17/18 | arm: do not allocate virtio buffers from the stacklib/ | +8 | 2 replies | |
| 18/18 | arm: enable vmallocarm/ arm/ lib/ +5 more | +70 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
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