[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] exec.c: Ensure right alignment also for file ba
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH] exec.c: Ensure right alignment also for file backed ram |
Date: |
Thu, 24 Mar 2016 12:35:10 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 |
On 23/03/2016 22:32, Dominik Dingel wrote:
> - page_size = qemu_fd_getpagesize(fd);
> - block->mr->align = page_size;
> + alignment = MAX(qemu_fd_getpagesize(fd), QEMU_VMALLOC_ALIGN);
> + block->mr->align = alignment;
>
> - if (memory < page_size) {
> + if (memory < alignment) {
> error_setg(errp, "memory size 0x" RAM_ADDR_FMT " must be equal to "
> - "or larger than page size 0x%" PRIx64,
> - memory, page_size);
> + "or larger than needed alignment 0x%" PRIx64,
> + memory, alignment);
> goto error;
> }
Why is this part necessary? On x86 you can have 1 megabyte of RAM,
but QEMU_VMALLOC_ALIGN is 2MB.
Paolo
> - memory = ROUND_UP(memory, page_size);
> + memory = ROUND_UP(memory, alignment);
>