Received: from eggs.gnu.org ([2001:4830:134:3::10]:48552) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bzLUU-0004XP-Lb for qemu-devel@nongnu.org; Wed, 26 Oct 2016 06:31:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bzLUP-0002As-PF for qemu-devel@nongnu.org; Wed, 26 Oct 2016 06:31:26 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:49694) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bzLUP-0002Af-HW for qemu-devel@nongnu.org; Wed, 26 Oct 2016 06:31:21 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u9QASXXV137516 for ; Wed, 26 Oct 2016 06:31:20 -0400 Received: from e06smtp08.uk.ibm.com (e06smtp08.uk.ibm.com [195.75.94.104]) by mx0a-001b2d01.pphosted.com with ESMTP id 26aqyt8m9g-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 26 Oct 2016 06:31:20 -0400 Received: from localhost by e06smtp08.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 26 Oct 2016 11:31:17 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 6B9EA2190063 for ; Wed, 26 Oct 2016 11:30:30 +0100 (BST) Received: from d06av09.portsmouth.uk.ibm.com (d06av09.portsmouth.uk.ibm.com [9.149.37.250]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u9QAVEsF15663384 for ; Wed, 26 Oct 2016 10:31:14 GMT Received: from d06av09.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u9QAVEiP020774 for ; Wed, 26 Oct 2016 04:31:14 -0600 References: <20161024124937.17239-1-haozhong.zhang@intel.com> <93154c1b-84bf-1922-c495-867d78866730@redhat.com> From: Christian Borntraeger Date: Wed, 26 Oct 2016 12:31:13 +0200 MIME-Version: 1.0 In-Reply-To: <93154c1b-84bf-1922-c495-867d78866730@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Message-Id: <6a85b533-ba52-b0b1-9580-ff79081c70cf@de.ibm.com> Subject: Re: [Qemu-devel] [PATCH] exec.c: workaround regression caused by alignment change in d2f39ad List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , Haozhong Zhang , qemu-devel@nongnu.org Cc: chao.p.peng@intel.com, Peter Crosthwaite , Dominik Dingel , anthony.xu@intel.com, Igor Mammedov , Richard Henderson On 10/24/2016 02:58 PM, Paolo Bonzini wrote: > > > 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 >> Reported-by: "Xu, Anthony" >> --- >> 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. Thanks. Acked-by: Christian Borntraeger > > Paolo > >> >> if (memory < block->page_size) { >> error_setg(errp, "memory size 0x" RAM_ADDR_FMT " must be equal to " >> > >