[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 02/42] exec: Fix memory allocation when memor
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH v2 02/42] exec: Fix memory allocation when memory path isn't on hugetlbfs |
Date: |
Tue, 15 Mar 2016 17:56:52 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 |
On 15/03/2016 17:41, Markus Armbruster wrote:
> Paolo Bonzini <address@hidden> writes:
>
>> On 07/03/2016 20:25, Markus Armbruster wrote:
>>> gethugepagesize() works reliably only when its argument is on
>>> hugetlbfs. When it's not, it returns the filesystem's "optimal
>>> transfer block size", which may or may not be the actual page size
>>> you'll get when you mmap().
>>>
>>> If the value is too small or not a power of two, we fail
>>> qemu_ram_mmap()'s assertions. These were added in commit 794e8f3
>>> (v2.5.0). The bug's impact before that is currently unknown. Seems
>>> fairly unlikely at least when the normal page size is 4KiB.
>>>
>>> Else, if the value is too large, we align more strictly than
>>> necessary.
>>>
>>> gethugepagesize() goes back to commit c902760 (v0.13). That commit
>>> clearly intended gethugepagesize() to be used on hugetlbfs only. Not
>>> only was it named accordingly, it also printed a warning when used on
>>> anything else. However, the commit neglected to spell out the
>>> restriction in user documentation of -mem-path.
>>>
>>> Commit bfc2a1a (v2.5.0) dropped the warning as bogus "because QEMU
>>> functions perfectly well with the path on a regular tmpfs filesystem".
>>> It sure does when you're sufficiently lucky. In my testing, I was
>>> lucky, too.
>>>
>>> Fix by switching to qemu_fd_getpagesize(). Rename the variable
>>> holding its result from hpagesize to page_size.
>>>
>>> Cc: Paolo Bonzini <address@hidden>
>>> Signed-off-by: Markus Armbruster <address@hidden>
> [...]
>>
>> Queued, thanks.
>
> Not in master, yet. What repo+branch should I use as base for v3?
I'll send a pull request later today, keep an eye on it.
Paolo
- Re: [Qemu-devel] [PATCH v2 04/42] ivshmem-server: Fix and clean up command line help, (continued)
- [Qemu-devel] [PATCH v2 13/42] ivshmem: Add missing newlines to debug printfs, Markus Armbruster, 2016/03/07
- [Qemu-devel] [PATCH v2 01/42] exec: Fix memory allocation when memory path names new file, Markus Armbruster, 2016/03/07
- [Qemu-devel] [PATCH v2 09/42] ivshmem-test: Improve test case /ivshmem/single, Markus Armbruster, 2016/03/07
- [Qemu-devel] [PATCH v2 14/42] ivshmem: Compile debug prints unconditionally to prevent bit-rot, Markus Armbruster, 2016/03/07
- [Qemu-devel] [PATCH v2 08/42] tests/libqos/pci-pc: Fix qpci_pc_iomap() to map BARs aligned, Markus Armbruster, 2016/03/07
- [Qemu-devel] [PATCH v2 19/42] ivshmem: Failed realize() can leave migration blocker behind, Markus Armbruster, 2016/03/07
- [Qemu-devel] [PATCH v2 02/42] exec: Fix memory allocation when memory path isn't on hugetlbfs, Markus Armbruster, 2016/03/07
- [Qemu-devel] [PATCH v2 21/42] ivshmem: Clean up MSI-X conditions, Markus Armbruster, 2016/03/07
- [Qemu-devel] [PATCH v2 03/42] target-ppc: Document TOCTTOU in hugepage support, Markus Armbruster, 2016/03/07
- [Qemu-devel] [PATCH v2 06/42] qemu-doc: Fix ivshmem huge page example, Markus Armbruster, 2016/03/07
- [Qemu-devel] [PATCH v2 35/42] ivshmem: Inline check_shm_size() into its only caller, Markus Armbruster, 2016/03/07
- [Qemu-devel] [PATCH v2 20/42] ivshmem: Clean up register callbacks, Markus Armbruster, 2016/03/07
- [Qemu-devel] [PATCH v2 05/42] ivshmem-server: Don't overload POSIX shmem and file name, Markus Armbruster, 2016/03/07