diff options
author | Dominik Dingel <dingel@linux.vnet.ibm.com> | 2016-04-25 13:55:38 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2016-05-23 16:53:42 +0200 |
commit | d2f39add725e2be849f5fb014a72368f711056fc (patch) | |
tree | f6eb2641919e12ab6a9b3ed8f74616aa6de2b8a8 /exec.c | |
parent | e081c24d30c1e7b29eb4450aa16d6a0da5782797 (diff) |
exec.c: Ensure right alignment also for file backed ram
While in the anonymous ram case we already take care of the right alignment
such an alignment gurantee does not exist for file backed ram allocation.
Instead, pagesize is used for alignment. On s390 this is not enough for gmap,
as we need to satisfy an alignment up to segments.
Reported-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Signed-off-by: Dominik Dingel <dingel@linux.vnet.ibm.com>
Message-Id: <1461585338-45863-1-git-send-email-dingel@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'exec.c')
-rw-r--r-- | exec.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1299,7 +1299,7 @@ static void *file_ram_alloc(RAMBlock *block, } page_size = qemu_fd_getpagesize(fd); - block->mr->align = page_size; + block->mr->align = MAX(page_size, QEMU_VMALLOC_ALIGN); if (memory < page_size) { error_setg(errp, "memory size 0x" RAM_ADDR_FMT " must be equal to " @@ -1320,7 +1320,8 @@ static void *file_ram_alloc(RAMBlock *block, perror("ftruncate"); } - area = qemu_ram_mmap(fd, memory, page_size, block->flags & RAM_SHARED); + area = qemu_ram_mmap(fd, memory, block->mr->align, + block->flags & RAM_SHARED); if (area == MAP_FAILED) { error_setg_errno(errp, errno, "unable to map backing store for guest RAM"); |