qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Haozhong Zhang <haozhong.zhang@intel.com>
Cc: qemu-devel@nongnu.org, chao.p.peng@intel.com,
	Eduardo Habkost <ehabkost@redhat.com>,
	Peter Crosthwaite <crosthwaite.peter@gmail.com>,
	Dominik Dingel <dingel@linux.vnet.ibm.com>,
	anthony.xu@intel.com, Paolo Bonzini <pbonzini@redhat.com>,
	Richard Henderson <rth@twiddle.net>,
	Xiao Guangrong <guangrong.xiao@linux.intel.com>
Subject: Re: [Qemu-devel] Regression caused by d2f39ad "exec.c: Ensure right alignment also for file backed ram"
Date: Fri, 21 Oct 2016 14:44:54 +0200	[thread overview]
Message-ID: <20161021144454.381fd7cd@nial.brq.redhat.com> (raw)
In-Reply-To: <695474a1-1a40-8b1d-42bb-013e7d4119a4@intel.com>

On Fri, 21 Oct 2016 16:39:08 +0800
Haozhong Zhang <haozhong.zhang@intel.com> wrote:

> On 10/21/2016 04:28 PM, 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"  
> 
> I forgot the frontend part, the broken usage should be
>     -object memory-backend-file,id=mem1,mem-path=$FILE,size=$SIZE
>     -device nvdimm,id=nv1,memdev=mem1
> where $SIZE is multiple of 4KB but not 2MB.
> 
> It works on QEMU 2.6, but fails on 2.7 when pc_dimm_memory_plug() tries
> to plug the nvdimm device.
it affect's not only nvdimm but also pc-dimm, 

qemu -m 1G,slots=10,maxmem=10G \
  -object memory-backend-file,id=mem1,mem-path=/tmp,size=0x3e2000
  -device pc-dimm,memdev=mem1
qemu: -device pc-dimm,memdev=mem1: backend memory size must be multiple of 0x200000

As for nvdimms d2f39ad commit changes auto-generated GPA
when 'addr' property is not provided

pre bug:
mhp_pc_dimm_assigned_address 0x100000000
mhp_pc_dimm_assigned_slot 0x0
mhp_pc_dimm_assigned_address 0x1003e2000
mhp_pc_dimm_assigned_slot 0x1

vs post bug:
mhp_pc_dimm_assigned_address 0x100000000
mhp_pc_dimm_assigned_slot 0
mhp_pc_dimm_assigned_address 0x100200000
mhp_pc_dimm_assigned_slot 1

or if 'addr' is provided, qemu will fail with

"address must be aligned to 0x200000 bytes"

so migration from qemu-2.6 and older builds to 2.7 and later isn't possible due to
inability to start target with 2.6-page_based alignment.

> 
> Haozhong
> 
> > 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.
> >
> > 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);
> > +#endif
> >
> >     if (memory < block->page_size) {
> >         error_setg(errp, "memory size 0x" RAM_ADDR_FMT " must be equal
> > to "
> >
> >
> > Thanks,
> > Haozhong
> >  
> 

  reply	other threads:[~2016-10-21 12:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-21  8:28 [Qemu-devel] Regression caused by d2f39ad "exec.c: Ensure right alignment also for file backed ram" Haozhong Zhang
2016-10-21  8:39 ` Haozhong Zhang
2016-10-21 12:44   ` Igor Mammedov [this message]
2016-10-21 14:12 ` Igor Mammedov
2016-10-24 11:44 ` Igor Mammedov
2016-10-24 12:06   ` Haozhong Zhang
2016-10-24 12:33   ` Dominik Dingel
2016-10-24 12:57     ` Paolo Bonzini

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=20161021144454.381fd7cd@nial.brq.redhat.com \
    --to=imammedo@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=ehabkost@redhat.com \
    --cc=guangrong.xiao@linux.intel.com \
    --cc=haozhong.zhang@intel.com \
    --cc=pbonzini@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).