unicorn/qemu/include/qemu
Murilo Opsfelder Araujo 0010078e4b
mmap-alloc: fix hugetlbfs misaligned length in ppc64
The commit 7197fb4058bcb68986bae2bb2c04d6370f3e7218 ("util/mmap-alloc:
fix hugetlb support on ppc64") fixed Huge TLB mappings on ppc64.

However, we still need to consider the underlying huge page size
during munmap() because it requires that both address and length be a
multiple of the underlying huge page size for Huge TLB mappings.
Quote from "Huge page (Huge TLB) mappings" paragraph under NOTES
section of the munmap(2) manual:

"For munmap(), addr and length must both be a multiple of the
underlying huge page size."

On ppc64, the munmap() in qemu_ram_munmap() does not work for Huge TLB
mappings because the mapped segment can be aligned with the underlying
huge page size, not aligned with the native system page size, as
returned by getpagesize().

This has the side effect of not releasing huge pages back to the pool
after a hugetlbfs file-backed memory device is hot-unplugged.

This patch fixes the situation in qemu_ram_mmap() and
qemu_ram_munmap() by considering the underlying page size on ppc64.

After this patch, memory hot-unplug releases huge pages back to the
pool.

Fixes: 7197fb4058bcb68986bae2bb2c04d6370f3e7218

Backports commit 53adb9d43e1abba187387a51f238e878e934c647 from qemu
2019-02-05 16:52:39 -05:00
..
atomic.h atomics: Set ATOMIC_REG_SIZE=8 for MIPS n32 2019-01-05 07:26:14 -05:00
atomic128.h tcg: Split CONFIG_ATOMIC128 2018-10-23 15:17:39 -04:00
bitmap.h bitmap: provide to_le/from_le helpers 2018-03-05 01:11:13 -05:00
bitops.h i386: Fix up the Node id for CPUID_8000_001E 2018-07-03 00:31:38 -04:00
bswap.h bswap: Add new stn_*_p() and ldn_*_p() memory access functions 2018-06-15 12:17:21 -04:00
compiler.h qemu/compiler: Include <intrin.h> on MSVC 2019-01-30 13:25:26 -05:00
cpuid.h util: Introduce include/qemu/cpuid.h 2018-03-09 12:12:00 -05:00
crc32c.h import 2015-08-21 15:04:50 +08:00
cutils.h cutils: Fix qemu_strtosz() & friends to reject non-finite sizes 2018-12-18 04:48:12 -05:00
fprintf-fn.h Clean up decorations and whitespace around header guards 2018-02-25 04:26:02 -05:00
host-utils.h qemu/host-utils: Handle ctpop8/16/32/64 on MSVC 2019-01-30 13:29:58 -05:00
int128.h qemu/int128: Disable assert in int128.h 2018-09-03 09:54:59 -04:00
log.h tcg: Optionally log FPU state in TCG -d cpu logging 2018-05-15 22:31:08 -04:00
mmap-alloc.h mmap-alloc: fix hugetlbfs misaligned length in ppc64 2019-02-05 16:52:39 -05:00
module.h cleanup qemu/include/qemu/module.h 2017-01-25 00:20:08 +08:00
osdep.h osdep: Conditionally include non-Windows headers 2019-01-28 09:24:20 -05:00
queue.h tcg: Dynamically allocate TCGOps 2018-03-05 16:34:40 -05:00
range.h Don't talk about the LGPL if the file is licensed under the GPL 2019-02-03 17:55:28 -05:00
sys_membarrier.h membarrier: add --enable-membarrier 2018-03-17 19:30:43 -04:00
thread-posix.h Clean up ill-advised or unusual header guards 2018-02-25 04:22:46 -05:00
thread-win32.h Clean up ill-advised or unusual header guards 2018-02-25 04:22:46 -05:00
thread.h Clean up ill-advised or unusual header guards 2018-02-25 04:22:46 -05:00
timer.h Drop remaining bits of ia64 host support 2018-03-09 11:54:57 -05:00
typedefs.h move ObjectClass to typedefs.h 2018-12-11 20:37:04 -05:00
units.h include: Add IEC binary prefixes in qemu/units.h 2018-07-03 19:47:19 -04:00
xxhash.h xxhash: match output against the original xxhash32 2018-12-18 06:09:01 -05:00