unicorn/qemu/util
Christoffer Dall 6180cbd477
util: align memory allocations to 2M on AArch64
For KVM to use Transparent Huge Pages (THP) we have to ensure that the
alignment of the userspace address of the KVM memory slot and the IPA
that the guest sees for a memory region have the same offset from the 2M
huge page size boundary.

One way to achieve this is to always align the IPA region at a 2M
boundary and ensure that the mmap alignment is also at 2M.

Unfortunately, we were only doing this for __arm__, not for __aarch64__,
so add this simple condition.

This fixes a performance regression using KVM/ARM on AArch64 platforms
that showed a performance penalty of more than 50%, introduced by the
following commit:

9fac18f (oslib: allocate PROT_NONE pages on top of RAM, 2015-09-10)

We were only lucky before the above commit, because we were allocating
large regions and naturally getting a 2M alignment on those allocations
then.

Backports commit ee1e0f8e5d3682c561edcdceccff72b9d9b16d8b from qemu
2018-02-23 13:56:59 -05:00
..
bitmap.c util: Clean up includes 2018-02-19 01:27:55 -05:00
bitops.c util: Clean up includes 2018-02-19 01:27:55 -05:00
crc32c.c util: Clean up includes 2018-02-19 01:27:55 -05:00
cutils.c util: move declarations out of qemu-common.h 2018-02-22 09:25:48 -05:00
error.c include/qemu/osdep.h: Don't include qapi/error.h 2018-02-21 23:08:18 -05:00
getauxval.c util: Clean up includes 2018-02-19 01:27:55 -05:00
host-utils.c util: Clean up includes 2018-02-19 01:27:55 -05:00
Makefile.objs exec: factor out duplicate mmap code 2018-02-17 15:24:03 -05:00
mmap-alloc.c util: Clean up includes 2018-02-19 01:27:55 -05:00
module.c util: Clean up includes 2018-02-19 01:27:55 -05:00
oslib-posix.c util: align memory allocations to 2M on AArch64 2018-02-23 13:56:59 -05:00
oslib-win32.c util: move declarations out of qemu-common.h 2018-02-22 09:25:48 -05:00
qemu-error.c util: Clean up includes 2018-02-19 01:27:55 -05:00
qemu-thread-posix.c util: Clean up includes 2018-02-19 01:27:55 -05:00
qemu-thread-win32.c util: Clean up includes 2018-02-19 01:27:55 -05:00
qemu-timer-common.c util: Clean up includes 2018-02-19 01:27:55 -05:00