From: Paolo Bonzini <pbonzini@redhat.com>
To: Haozhong Zhang <haozhong.zhang@intel.com>, qemu-devel@nongnu.org
Cc: Igor Mammedov <imammedo@redhat.com>,
Peter Crosthwaite <crosthwaite.peter@gmail.com>,
Richard Henderson <rth@twiddle.net>,
Dominik Dingel <dingel@linux.vnet.ibm.com>,
chao.p.peng@intel.com, anthony.xu@intel.com
Subject: Re: [Qemu-devel] [PATCH] exec.c: workaround regression caused by alignment change in d2f39ad
Date: Mon, 24 Oct 2016 14:58:50 +0200 [thread overview]
Message-ID: <93154c1b-84bf-1922-c495-867d78866730@redhat.com> (raw)
In-Reply-To: <20161024124937.17239-1-haozhong.zhang@intel.com>
On 24/10/2016 14:49, Haozhong Zhang wrote:
> Commit d2f39ad "exec.c: Ensure right alignment also for file backed ram"
> added an additional alignment requirement on the size of backend file
> besides the previous page size. On x86, the alignment is changed from
> 4KB in QEMU 2.6 to 2MB in QEMU 2.7.
>
> This change breaks certain usages in QEMU 2.7 on x86, e.g.
> -object memory-backend-file,id=mem1,mem-path=/tmp/,size=$SZ
> -device pc-dimm,id=dimm1,memdev=mem1
> where $SZ is multiple of 4KB but not 2MB (e.g. 1023M). QEMU 2.7
> reports the following error message and aborts:
> qemu-system-x86_64: -device pc-dimm,memdev=mem1,id=nv1: backend memory size must be multiple of 0x200000
>
> The same regression may also happen in other platforms as indicated by
> Igor Mammedov. This change is however necessary for s390 according to
> the commit message of d2f39ad, so we workaround the regression by taking
> the change only on s390.
>
> Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
> Reported-by: "Xu, Anthony" <anthony.xu@intel.com>
> ---
> exec.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/exec.c b/exec.c
> index e63c5a1..55915ea 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -1254,7 +1254,11 @@ static void *file_ram_alloc(RAMBlock *block,
> }
>
> block->page_size = qemu_fd_getpagesize(fd);
> +#if defined(__s390x__)
> block->mr->align = MAX(block->page_size, QEMU_VMALLOC_ALIGN);
> +#else
> + block->mr->align = block->page_size;
> +#endif
Better:
block->mr->align = block->page_size;
#ifdef __s390x__
if (kvm_enabled()) {
block->mr->align = MAX(block->mr->align, QEMU_VMALLOC_ALIGN);
}
#endif
Queued with this change.
Paolo
>
> if (memory < block->page_size) {
> error_setg(errp, "memory size 0x" RAM_ADDR_FMT " must be equal to "
>
next prev parent reply other threads:[~2016-10-24 12:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-24 12:49 [Qemu-devel] [PATCH] exec.c: workaround regression caused by alignment change in d2f39ad Haozhong Zhang
2016-10-24 12:58 ` Paolo Bonzini [this message]
2016-10-26 10:31 ` Christian Borntraeger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=93154c1b-84bf-1922-c495-867d78866730@redhat.com \
--to=pbonzini@redhat.com \
--cc=anthony.xu@intel.com \
--cc=chao.p.peng@intel.com \
--cc=crosthwaite.peter@gmail.com \
--cc=dingel@linux.vnet.ibm.com \
--cc=haozhong.zhang@intel.com \
--cc=imammedo@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).