qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2] exec.c: Ensure right alignment also for file


From: Dominik Dingel
Subject: Re: [Qemu-devel] [PATCH v2] exec.c: Ensure right alignment also for file backed ram
Date: Wed, 13 Apr 2016 09:19:35 +0200

On Tue, 12 Apr 2016 23:45:18 +0200
Paolo Bonzini <address@hidden> wrote:

> 
> 
> On 07/04/2016 23:31, Dominik Dingel wrote:
> > diff --git a/exec.c b/exec.c
> > index c4f9036..1ae98e4 100644
> > --- a/exec.c
> > +++ b/exec.c
> > @@ -1241,6 +1241,7 @@ static void *file_ram_alloc(RAMBlock *block,
> >      void *area;
> >      int fd = -1;
> >      int64_t page_size;
> > +    int64_t alignment;
> >  
> >      if (kvm_enabled() && !kvm_has_sync_mmu()) {
> >          error_setg(errp,
> > @@ -1296,7 +1297,8 @@ static void *file_ram_alloc(RAMBlock *block,
> >      }
> >  
> >      page_size = qemu_fd_getpagesize(fd);
> > -    block->mr->align = page_size;
> > +    alignment = MAX(page_size, QEMU_VMALLOC_ALIGN);
> > +    block->mr->align = alignment;
> >  
> >      if (memory < page_size) {
> >          error_setg(errp, "memory size 0x" RAM_ADDR_FMT " must be equal to "
> > @@ -1305,7 +1307,7 @@ static void *file_ram_alloc(RAMBlock *block,
> >          goto error;
> >      }
> >  
> > -    memory = ROUND_UP(memory, page_size);
> > +    memory = ROUND_UP(memory, alignment);
> 
> I think this change is not necessary either; it is enough to change the
> qemu_ram_mmap below.

You are right "memory" will never be back propagated to anything related to 
memory slots.
On which we have such a size constraint.

Thanks,
        Dominik




reply via email to

[Prev in Thread] Current Thread [Next in Thread]