qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Amit Shah <amit.shah@redhat.com>,
	pbonzini@redhat.com, imammedo@redhat.com, qemu-devel@nongnu.org,
	Juan Quintela <quintela@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 0/8] acpi: make ROMs resizeable
Date: Thu, 18 Dec 2014 23:49:10 +0200	[thread overview]
Message-ID: <20141218214910.GA7416@redhat.com> (raw)
In-Reply-To: <20141218201626.GO4744@work-vm>

On Thu, Dec 18, 2014 at 08:16:26PM +0000, Dr. David Alan Gilbert wrote:
> * Michael S. Tsirkin (mst@redhat.com) wrote:
> > On Thu, Dec 18, 2014 at 06:49:09PM +0000, Dr. David Alan Gilbert wrote:
> > > * Michael S. Tsirkin (mst@redhat.com) wrote:
> 
> > > I'm generally happy with this set for what you're using it for,
> > > except that I'd like some big hairy warnings in comments
> > > near the resize functions to make it clear when it's safe
> > > to do it.
> > 
> > Really always: whenever resize callback updates all
> > guest visible state.
> 
> The outgoing side worries me due to previous painful encounters
> with arch_init.c's migration_dirty_pages.  It's a counter that
> knows exactly how many pages it has and it gets incremented/decremented
> and *must* be right otherwise the migration never ends.
> It's derived from used_pages in your world, so that would change.

Yes but we handle it correctly:
+    cpu_physical_memory_clear_dirty_range(block->offset, block->used_length);
+    block->used_length = newsize;
+    cpu_physical_memory_set_dirty_range(block->offset, block->used_length);
so the counter will be updated.

> That's just the one that comes to mind;
> A comment saying 'Don't use during an outgoing migration'
> would cover that - but I'm not that confident there aren't other uses
> we have to be careful of.
> 
> > > What I don't really understand is how it would work for anything mapped
> > > into guest address space, how that mapping would be updated.
> > > 
> > > Dave
> > 
> > That would be a job of the resize function: it can update kvm.
> 
> Yes I guess so, I'm just not sure what the guest is going to think about it.
> 
> Dave

I get it.  I think the correct requirement is this:

/*  Only legal before guest might have detected the memory size: e.g. on
 *  incoming migration, or right after reset.
 *  As memory core doesn't know how is memory accessed, it is up to
 *  resize callback to add assertions to detect misuse, if necessary.
 */

Would this comment address your concerns?

> > 
> > > > 
> > > > Michael S. Tsirkin (8):
> > > >   cpu: add cpu_physical_memory_clear_dirty_range_nocode
> > > >   memory: add memory_region_set_size
> > > >   exec: cpu_physical_memory_set/clear_dirty_range
> > > >   exec: split length -> used_length/max_length
> > > >   exec: qemu_ram_alloc_resizeable, qemu_ram_resize
> > > >   arch_init: support resizing on incoming migration
> > > >   memory: API to allocate resizeable RAM MR
> > > >   acpi-build: make ROMs RAM blocks resizeable
> > > > 
> > > >  hw/lm32/lm32_hwsetup.h  |   3 +-
> > > >  include/exec/cpu-all.h  |  12 +++--
> > > >  include/exec/memory.h   |  34 +++++++++++++
> > > >  include/exec/ram_addr.h |  22 +++++++--
> > > >  include/hw/loader.h     |   4 +-
> > > >  arch_init.c             |  28 ++++++-----
> > > >  exec.c                  | 129 +++++++++++++++++++++++++++++++++++++-----------
> > > >  hw/core/loader.c        |  18 +++++--
> > > >  hw/i386/acpi-build.c    |  19 +++++--
> > > >  memory.c                |  33 +++++++++++++
> > > >  10 files changed, 242 insertions(+), 60 deletions(-)
> > > > 
> > > > -- 
> > > > MST
> > > > 
> > > --
> > > Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
> --
> Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

      reply	other threads:[~2014-12-18 21:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-16 16:14 [Qemu-devel] [PATCH v2 0/8] acpi: make ROMs resizeable Michael S. Tsirkin
2014-12-16 16:14 ` [Qemu-devel] [PATCH v2 1/8] cpu: add cpu_physical_memory_clear_dirty_range_nocode Michael S. Tsirkin
2014-12-16 16:15 ` [Qemu-devel] [PATCH v2 2/8] memory: add memory_region_set_size Michael S. Tsirkin
2014-12-16 16:15 ` [Qemu-devel] [PATCH v2 3/8] exec: cpu_physical_memory_set/clear_dirty_range Michael S. Tsirkin
2014-12-16 16:15 ` [Qemu-devel] [PATCH v2 4/8] exec: split length -> used_length/max_length Michael S. Tsirkin
2014-12-16 16:15 ` [Qemu-devel] [PATCH v2 5/8] exec: qemu_ram_alloc_resizeable, qemu_ram_resize Michael S. Tsirkin
2014-12-16 16:15 ` [Qemu-devel] [PATCH v2 6/8] arch_init: support resizing on incoming migration Michael S. Tsirkin
2014-12-16 16:15 ` [Qemu-devel] [PATCH v2 7/8] memory: API to allocate resizeable RAM MR Michael S. Tsirkin
2014-12-16 16:15 ` [Qemu-devel] [PATCH v2 8/8] acpi-build: make ROMs RAM blocks resizeable Michael S. Tsirkin
2014-12-18 18:49 ` [Qemu-devel] [PATCH v2 0/8] acpi: make ROMs resizeable Dr. David Alan Gilbert
2014-12-18 19:43   ` Michael S. Tsirkin
2014-12-18 20:16     ` Dr. David Alan Gilbert
2014-12-18 21:49       ` Michael S. Tsirkin [this message]

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=20141218214910.GA7416@redhat.com \
    --to=mst@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /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).