From: "Kim, Dongwon" <dongwon.kim@intel.com>
To: "Marc-André Lureau" <marcandre.lureau@gmail.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
Peter Xu <peterx@redhat.com>
Subject: Re: [PATCH] ui/gtk: Wait until the current guest frame is rendered before switching to RUN_STATE_SAVE_VM
Date: Wed, 12 Jun 2024 11:50:17 -0700 [thread overview]
Message-ID: <d1534c51-bb11-4439-afc9-0a95f2dc4cf5@intel.com> (raw)
In-Reply-To: <CAJ+F1C+L=5cSPhEXrAczfN27sXEH_2Xwohk7Bt2r4KmhteDguQ@mail.gmail.com>
On 6/11/2024 10:44 PM, Marc-André Lureau wrote:
> Hi
>
> On Wed, Jun 12, 2024 at 5:29 AM Kim, Dongwon <dongwon.kim@intel.com
> <mailto:dongwon.kim@intel.com>> wrote:
>
> Hi,
>
> From: Marc-André Lureau <marcandre.lureau@gmail.com
> <mailto:marcandre.lureau@gmail.com>>
> Sent: Wednesday, June 5, 2024 12:56 AM
> To: Kim, Dongwon <dongwon.kim@intel.com <mailto:dongwon.kim@intel.com>>
> Cc: qemu-devel@nongnu.org <mailto:qemu-devel@nongnu.org>; Peter Xu
> <peterx@redhat.com <mailto:peterx@redhat.com>>
> Subject: Re: [PATCH] ui/gtk: Wait until the current guest frame is
> rendered before switching to RUN_STATE_SAVE_VM
>
> Hi
>
> On Tue, Jun 4, 2024 at 9:49 PM Kim, Dongwon
> <mailto:dongwon.kim@intel.com <mailto:dongwon.kim@intel.com>> wrote:
> On 6/4/2024 4:12 AM, Marc-André Lureau wrote:
> > Hi
> >
> > On Thu, May 30, 2024 at 2:44 AM <mailto:dongwon.kim@intel.com
> <mailto:dongwon.kim@intel.com>
> > <mailto:mailto <mailto:mailto>:dongwon.kim@intel.com
> <mailto:dongwon.kim@intel.com>>> wrote:
> >
> > From: Dongwon <mailto:dongwon.kim@intel.com
> <mailto:dongwon.kim@intel.com> <mailto:mailto
> <mailto:mailto>:dongwon.kim@intel.com <mailto:dongwon.kim@intel.com>>>
> >
> > Make sure rendering of the current frame is finished before
> switching
> > the run state to RUN_STATE_SAVE_VM by waiting for egl-sync
> object to be
> > signaled.
> >
> >
> > Can you expand on what this solves?
>
> In current scheme, guest waits for the fence to be signaled for each
> frame it submits before moving to the next frame. If the guest’s state
> is saved while it is still waiting for the fence, The guest will
> continue to wait for the fence that was signaled while ago when it is
> restored to the point. One way to prevent it is to get it finish the
> current frame before changing the state.
>
> After the UI sets a fence, hw_ops->gl_block(true) gets called, which
> will block virtio-gpu/virgl from processing commands (until the
> fence is signaled and gl_block/false called again).
>
> But this "blocking" state is not saved. So how does this affect
> save/restore? Please give more details, thanks
>
> Yeah sure. "Blocking" state is not saved but guest's state is saved
> while it was still waiting for the response for its last
> resource-flush virtio msg. This virtio response, by the way is set
> to be sent to the guest when the pipeline is unblocked (and when the
> fence is signaled.). Once the guest's state is saved, current
> instance of guest will be continued and receives the response as
> usual. The problem is happening when we restore the saved guest's
> state again because what guest does will be waiting for the response
> that was sent a while ago to the original instance.
>
>
> Where is the pending response saved? Can you detail how you test this?
>
There is no pending response for the guest's restored point, which is a
problem. The response is sent out after saving is done.
Normal cycle :
resource-flush (scanout flush) -> gl block -> render -> gl unblock
(after fence is signaled) -> pending response sent out to the guest ->
guest (virtio-gpu drv) processes the next scanout frame -> (next cycle)
resource-flush -> gl block ......
When vm state is saved in the middle :
resource-flush (scanout-flush) -> gl block -> saving vm-state -> render
-> gl unblock -> pending response (resp #1) sent out to the guest ->
guest (virtio-gpu drv) processes the next scanout frame -> (next cycle)
resource-flush -> gl block ......
Now, we restore the vm-state we saved
vm-state is restored -> guest (virtio-gpu drv) can't move on as this
state is still waiting for the response (resp #1)
So we need to make sure vm-state is saved after the cycle is completed.
This situation would be only happening if you use blob=true with
virtio-gpu drv as KMS on the linux guest. Do you have any similar setup?
> thanks
>
> --
> Marc-André Lureau
next prev parent reply other threads:[~2024-06-12 18:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-29 22:42 [PATCH] ui/gtk: Wait until the current guest frame is rendered before switching to RUN_STATE_SAVE_VM dongwon.kim
2024-06-04 11:12 ` Marc-André Lureau
2024-06-04 17:49 ` Kim, Dongwon
2024-06-05 7:55 ` Marc-André Lureau
2024-06-12 1:29 ` Kim, Dongwon
2024-06-12 5:44 ` Marc-André Lureau
2024-06-12 18:50 ` Kim, Dongwon [this message]
2024-06-13 13:16 ` Marc-André Lureau
2024-06-13 17:27 ` Kim, Dongwon
2024-06-14 9:25 ` Marc-André Lureau
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=d1534c51-bb11-4439-afc9-0a95f2dc4cf5@intel.com \
--to=dongwon.kim@intel.com \
--cc=marcandre.lureau@gmail.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).