Received: from eggs.gnu.org ([2001:4830:134:3::10]:49291) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bye1l-0002z0-Hr for qemu-devel@nongnu.org; Mon, 24 Oct 2016 08:06:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bye1i-0001B6-E8 for qemu-devel@nongnu.org; Mon, 24 Oct 2016 08:06:53 -0400 Received: from mga09.intel.com ([134.134.136.24]:46100) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bye1i-0001Ar-4W for qemu-devel@nongnu.org; Mon, 24 Oct 2016 08:06:50 -0400 Date: Mon, 24 Oct 2016 20:06:46 +0800 From: Haozhong Zhang Message-ID: <20161024120646.4qadki3ostu4mayx@hz-desktop> References: <20161021082801.dglwfsocljohquok@hz-desktop> <20161024134455.64508943@nial.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20161024134455.64508943@nial.brq.redhat.com> Subject: Re: [Qemu-devel] Regression caused by d2f39ad "exec.c: Ensure right alignment also for file backed ram" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: qemu-devel@nongnu.org, chao.p.peng@intel.com, Eduardo Habkost , Peter Crosthwaite , Dominik Dingel , anthony.xu@intel.com, Paolo Bonzini , Richard Henderson On 10/24/16 13:44 +0200, Igor Mammedov wrote: >On Fri, 21 Oct 2016 16:28:01 +0800 >Haozhong Zhang wrote: > >> Hi, >> >> Commit d2f39ad "exec.c: Ensure right alignment also for file backed >> ram" added an additional alignment requirement besides to the previous >> page size for the size of the backend file. On x86, the alignment >> requirement for the size of the backend file is changed from 4KB in >> QEMU 2.6 to 2MB in QEMU 2.7. >> >> This change immediately breaks the usage of "-object memory-backend-file,...,size=$SIZE" >> on x86, where $SIZE is multiple of 4KB but not 2MB. It works on QEMU 2.6. >> Could this be considered as a regression? >> >> The commit message shows it's for s390. I'm wondering whether the same >> regression happens on s390 and ARM. If not, could I fix the regression >> on x86 by keeping using the original alignment only on x86, e.g. >I don't see a nice way to work around this regression, so perhaps >we should tree 2.7 as broken (wrt migration when *dimm devices with file >backends with pagesize < 2Mb are used) and unbreak 2.8 and onwards. > >Could you send a proper patch to list with commit message >explaining what is broken and how + CLI example. > Sure, I'll send a patch later. >> >> modified exec.c >> @@ -1254,7 +1254,11 @@ static void *file_ram_alloc(RAMBlock *block, >> } >> >> block->page_size = qemu_fd_getpagesize(fd); >> +#if defined(__x86_64__) || defined(__i386__) >> + block->mr->align = block->page_size; >> +#else >> block->mr->align = MAX(block->page_size, QEMU_VMALLOC_ALIGN); >maybe it's worth to do other way around i.e. for special s390 case >do above and for the rest leave page_size alignment? > > >> +#endif >> >> if (memory < block->page_size) { >> error_setg(errp, "memory size 0x" RAM_ADDR_FMT " must be equal to " >> >> >> Thanks, >> Haozhong >> >