qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Anthony Perard <anthony.perard@citrix.com>,
	Jan Kiszka <jan.kiszka@siemens.com>,
	Xen Devel <xen-devel@lists.xensource.com>,
	QEMU-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH V2 5/5] vga-cirrus: Workaround during restore when using Xen.
Date: Thu, 05 Jan 2012 17:19:58 +0200	[thread overview]
Message-ID: <4F05BF9E.7000203@redhat.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1201051427340.3150@kaball-desktop>

On 01/05/2012 04:34 PM, Stefano Stabellini wrote:
> On Thu, 5 Jan 2012, Avi Kivity wrote:
> > On 01/05/2012 03:17 PM, Stefano Stabellini wrote:
> > > > > The "solution" I am proposing is introducing an early_savevm set of
> > > > > save/restore functions so that at restore time we can get to know at
> > > > > what address the videoram is mapped into the guest address space. Once we
> > > > > know the address we can remap it into qemu's address space and/or move it
> > > > > to another guest physical address.
> > > > 
> > > > Why can we not simply track it?  For every MemoryRegion, have a field
> > > > called xen_address which tracks its location in the Xen address space
> > > > (as determined by the last call to xen_set_memory or qemu_ram_alloc). 
> > > > xen_address would be maintained by callbacks called from the memory API
> > > > into xen-all.c.
> > >
> > > Nice and simple, I like it.
> > > However we would still need an early_savevm mechanism to save and restore the
> > > MemoryRegions, unless they already gets saved and restored somehow?
> > 
> > MemoryRegions are instantiated by the devices, so they should be there
> > (creating a MemoryRegion == calling qemu_ram_alloc() in the old days)
>
> If the MemoryRegions are re-created by the devices, then we need another
> mechanism to find out where the videoram is.
> What I am saying is that the suggestion of having a xen_address field
> for every MemoryRegion would make the code cleaner but it would not
> solve the save/restore issue described in the previous email.

Okay, I think I understand now.

You're not really allocating memory on restore, you're attaching to
already allocated memory, and you need a handle to it, passed from the
save side.

One way is to add early-save/restore like you suggest.  Another is to
make the attach late.  Can we defer it until after restore is complete
and we know everything?

This involves:
- adding vmstate to xen-all.c so it can migrate the xen vram address
- making sure the memory core doesn't do mappings during restore (can be
done by wrapping restore with
memory_region_transaction_begin()/memory_region_transaction_commit();
beneficial to normal qemu migrations as well)
- updating the mapped address during restore

I think this is cleaner than introducing a new migration stage, but the
implementation may prove otherwise.

> > 
> > xen_register_framebuffer() is slightly less hacky.
>
> I agree, however xen_register_framebuffer is called after
> memory_region_init_ram, so the allocation would have been made already.

xen_ram_alloc(MemoryRegion *mr)
{
    if (in_restore && mr == framebuffer && !framebuffer_addr_known) {
        return;
    }
}

xen_framebuffer_address_post_load()
{
    framebuffer_addr_known = true;
    if (framebuffer) {
        framebuffer->xen_address = framebuffer_addr;
    }
}

(ugly way of avoiding a dependency, but should work)

-- 
error compiling committee.c: too many arguments to function

  reply	other threads:[~2012-01-05 15:20 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-09 21:54 [Qemu-devel] [PATCH V2 0/5] Have a working migration with Xen Anthony PERARD
2011-12-09 21:54 ` [Qemu-devel] [PATCH V2 1/5] vl.c: Do not save RAM state when Xen is used Anthony PERARD
2011-12-15 15:12   ` Anthony Liguori
2011-12-18 17:44     ` Avi Kivity
2011-12-20 16:46       ` Anthony PERARD
2011-12-09 21:54 ` [Qemu-devel] [PATCH V2 2/5] xen mapcache: Check if a memory space has moved Anthony PERARD
2011-12-12 12:53   ` Stefano Stabellini
2011-12-09 21:54 ` [Qemu-devel] [PATCH V2 3/5] Introduce premigrate RunState Anthony PERARD
2011-12-15 15:14   ` Anthony Liguori
2011-12-15 16:31     ` Luiz Capitulino
2011-12-19 17:27       ` Anthony PERARD
2012-01-03 19:05         ` Luiz Capitulino
2012-01-05 12:26           ` Anthony PERARD
2011-12-09 21:54 ` [Qemu-devel] [PATCH V2 4/5] xen: Change memory access behavior during migration Anthony PERARD
2011-12-12 12:55   ` Stefano Stabellini
2011-12-09 21:54 ` [Qemu-devel] [PATCH V2 5/5] vga-cirrus: Workaround during restore when using Xen Anthony PERARD
2011-12-10 10:45   ` Jan Kiszka
2011-12-12 13:18     ` Stefano Stabellini
2011-12-12 14:03       ` Jan Kiszka
2011-12-12 14:41         ` Stefano Stabellini
2011-12-12 15:03           ` Jan Kiszka
2011-12-12 15:32             ` Stefano Stabellini
2011-12-13 11:55               ` [Qemu-devel] early_savevm (was: [PATCH V2 5/5] vga-cirrus: Workaround during restore when using Xen.) Stefano Stabellini
2011-12-13 12:35                 ` [Qemu-devel] early_savevm Jan Kiszka
2011-12-13 13:59                   ` Stefano Stabellini
2011-12-18 17:43                 ` Avi Kivity
2012-01-11 17:55                 ` Anthony Liguori
2011-12-18 17:41               ` [Qemu-devel] [PATCH V2 5/5] vga-cirrus: Workaround during restore when using Xen Avi Kivity
2012-01-04 16:38                 ` Stefano Stabellini
2012-01-04 17:23                   ` Avi Kivity
2012-01-05 12:30                     ` Stefano Stabellini
2012-01-05 12:50                       ` Avi Kivity
2012-01-05 13:17                         ` Stefano Stabellini
2012-01-05 13:32                           ` Avi Kivity
2012-01-05 14:34                             ` Stefano Stabellini
2012-01-05 15:19                               ` Avi Kivity [this message]
2012-01-05 15:53                                 ` Stefano Stabellini
2012-01-05 16:33                                   ` Avi Kivity
2012-01-05 17:21                                     ` Stefano Stabellini
2012-01-05 17:50                                       ` Avi Kivity
2012-01-05 18:49                                         ` Jan Kiszka
2012-01-06 10:50                                           ` Stefano Stabellini
2012-01-06 13:30                                             ` Jan Kiszka
2012-01-06 14:40                                               ` Stefano Stabellini
2012-01-08 10:39                                                 ` Avi Kivity
2012-01-09 15:25                                                   ` Stefano Stabellini
2012-01-09 15:28                                                     ` Jan Kiszka
2012-01-09 15:36                                                       ` Avi Kivity
2012-01-06 15:58                                               ` Peter Maydell
2012-01-06 16:50                                                 ` Jan Kiszka
2012-01-06 12:19                                           ` Avi Kivity
2012-01-06 12:22                                             ` Jan Kiszka
2012-01-06 12:47                                               ` Avi Kivity
2011-12-12 12:58   ` Stefano Stabellini

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=4F05BF9E.7000203@redhat.com \
    --to=avi@redhat.com \
    --cc=anthony.perard@citrix.com \
    --cc=jan.kiszka@siemens.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xensource.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).