qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	Avi Kivity <avi@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v4 0/6] save/restore on Xen
Date: Mon, 23 Jan 2012 18:13:42 +0100	[thread overview]
Message-ID: <4F1D9546.4040801@siemens.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1201231554550.3196@kaball-desktop>

On 2012-01-23 17:16, Stefano Stabellini wrote:
> On Mon, 23 Jan 2012, Jan Kiszka wrote:
>> On 2012-01-23 15:46, Stefano Stabellini wrote:
>>> On Mon, 23 Jan 2012, Jan Kiszka wrote:
>>>> On 2012-01-23 12:59, Stefano Stabellini wrote:
>>>>> On Mon, 23 Jan 2012, Jan Kiszka wrote:
>>>>>>>> Or what is the ordering
>>>>>>>> of init, RAM restore, and initial device reset now?
>>>>>>>
>>>>>>> RAM restore (done by Xen)
>>>>>>>
>>>>>>> physmap rebuild (done by xen_hvm_init in qemu)
>>>>>>> pc_init()
>>>>>>> qemu_system_reset()
>>>>>>> load_vmstate()
>>>>>>
>>>>>> Hmm, are you sure that this is the only case where a device init or
>>>>>> reset handler writes to already restored guest memory? Preloading the
>>>>>> RAM this way is a non-standard scenario for QEMU, thus conceptually
>>>>>> fragile. Does restoring happen before QEMU is even started, or can this
>>>>>> point be controlled from QEMU?
>>>>>
>>>>> Consider that this only happens with non-MMIO device memory, in practice
>>>>> only videoram.
>>>>> Vmware VGA does not memset the videoram in the reset handler, while QXL
>>>>> already has the following:
>>>>>
>>>>>     /* pre loadvm reset must not touch QXLRam.  This lives in
>>>>>      * device memory, is migrated together with RAM and thus
>>>>>      * already loaded at this point */ if (!loadvm) {
>>>>>      qxl_reset_state(d); }
>>>>
>>>> Yes, but QEMU restores the RAM _after_ device reset, not before it.
>>>> That's the problem with the Xen way - it is against the current
>>>> QEMU standard.
>>>
>>> QEMU doesn't save/restore the RAM (and the videoram) at all on Xen.
>>
>> But it does otherwise, and that's the scenario the code you cited was
>> written for. It won't work as is under Xen.
> 
> Ah, I see your point now.
> In that regard, is the comment above even correct?
> I am referring to "migrated together with RAM and thus already loaded at
> this point"?

The comment is correct. It refers to the invocation of the function from
the vmload handler. Here, a flag is passed that says "don't overwrite".

> 
> 
>>> To reply to your previous question more clearly: at restore time Qemu on
>>> Xen would run in a non-standard scenario; the restore of the RAM happens
>>> before QEMU is even started.
>>>
>>> That is unfortunate but it would be very hard to change (I can give you
>>> more details if you are interested in the reasons why it would be so
>>> difficult).
>>
>> If you can't change this, you need to properly introduce this new
>> scenario - pre-initialized RAM - to the QEMU device model. Or you will
>> see breakage outside cirrus sooner or later as well. So it might be good
>> to explain the reason why it can't be changed under Xen when motivating
>> this concept extension to QEMU.
>  
> OK.
> Are you thinking about introducing this concept as a new runstate?
> This special runstate could be set at restore time only on Xen.
> 
> 
> BTW the main reasons for having Xen saving the RAM are:
> 
> - the need to support PV guests, that often run without Qemu;
> - the current save format, that is built around the fact that Xen saves the memory;
> - the fact that Qemu might be running in a very limited stub-domain.

Your problem is not the fact that guest RAM is restored by an external
component. Your problem is that QEMU has no control over the when. If
you fix this, you could coordinate the restoring with the initial device
reset and would solve all potential current and future issues, not only
this single cirrus related one.

Jan

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux

  parent reply	other threads:[~2012-01-23 17:14 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-20 17:20 [Qemu-devel] [PATCH v4 0/6] save/restore on Xen Stefano Stabellini
2012-01-20 17:21 ` [Qemu-devel] [PATCH v4 1/6] vl.c: do not save the RAM state when Xen is enabled Stefano Stabellini
2012-01-23 15:58   ` Anthony Liguori
2012-01-20 17:21 ` [Qemu-devel] [PATCH v4 2/6] xen mapcache: check if memory region has moved Stefano Stabellini
2012-01-20 17:21 ` [Qemu-devel] [PATCH v4 3/6] Set runstate to INMIGRATE earlier Stefano Stabellini
2012-01-20 17:21 ` [Qemu-devel] [PATCH v4 4/6] cirrus_vga: do not reset videoram on resume Stefano Stabellini
2012-01-20 17:21 ` [Qemu-devel] [PATCH v4 5/6] xen: record physmap changes to xenstore Stefano Stabellini
2012-01-20 17:21 ` [Qemu-devel] [PATCH v4 6/6] xen: change memory access behavior during migration Stefano Stabellini
2012-01-20 17:59 ` [Qemu-devel] [PATCH v4 0/6] save/restore on Xen Jan Kiszka
2012-01-23 10:47   ` Stefano Stabellini
2012-01-23 11:50     ` Jan Kiszka
2012-01-23 11:59       ` Stefano Stabellini
2012-01-23 12:10         ` Jan Kiszka
2012-01-23 14:46           ` Stefano Stabellini
2012-01-23 15:46             ` Jan Kiszka
2012-01-23 16:16               ` Stefano Stabellini
2012-01-23 16:22                 ` Anthony Liguori
2012-01-23 17:13                 ` Jan Kiszka [this message]
2012-01-23 17:18                   ` Anthony Liguori
2012-01-23 17:31                     ` Jan Kiszka
2012-01-23 17:36                       ` Anthony Liguori
2012-01-24 10:21                         ` Gerd Hoffmann
2012-01-24 11:13                           ` Avi Kivity
2012-01-24 12:00                             ` Stefano Stabellini
2012-01-24 15:39                               ` Avi Kivity
2012-01-24 13:18                             ` Anthony Liguori
2012-01-24 15:43                               ` Avi Kivity
2012-01-24 13:25                           ` Anthony Liguori
2012-01-24 15:47                             ` Avi Kivity
2012-01-24 11:10                     ` Avi Kivity
2012-01-24 11:27                       ` Paolo Bonzini
2012-01-24 11:32                         ` Avi Kivity
2012-01-24 11:44                           ` Paolo Bonzini
2012-01-24 15:48                             ` Avi Kivity
2012-01-24 11:52                           ` Stefano Stabellini
2012-01-24 13:15                             ` Anthony Liguori
2012-01-24 13:14                       ` Anthony Liguori
2012-01-24 15:56                         ` Avi Kivity
2012-01-24 17:51                           ` Anthony Liguori
2012-01-23 16:00     ` Anthony Liguori
2012-01-23 16:46       ` Stefano Stabellini
2012-01-23 16:54         ` Anthony Liguori
2012-01-23 17:05           ` Stefano Stabellini
2012-01-23 17:07             ` Anthony Liguori
  -- strict thread matches above, loose matches on Subject: below --
2012-01-25 13:04 Stefano Stabellini
2012-01-31 15:50 ` Stefano Stabellini
2012-02-13 12:20   ` Stefano Stabellini
2012-02-21 10:22     ` 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=4F1D9546.4040801@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=avi@redhat.com \
    --cc=kraxel@redhat.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).