qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alon Levy <alevy@redhat.com>
To: Yonit Halperin <yhalperi@redhat.com>
Cc: qemu-devel@nongnu.org, spice-devel@freedesktop.org, kraxel@redhat.com
Subject: Re: [Qemu-devel] [PATCH] qxl: fix guest cursor tracking
Date: Tue, 18 Oct 2011 19:54:38 +0200	[thread overview]
Message-ID: <20111018175438.GM3233@bow.tlv.redhat.com> (raw)
In-Reply-To: <1318957134-2923-1-git-send-email-yhalperi@redhat.com>

On Tue, Oct 18, 2011 at 06:58:54PM +0200, Yonit Halperin wrote:
> (1) If the guest cursor command is empty, don't reload it after migration.
> (2) Cleaning the guest cursor when it is released by
>     the spice server. In addition, explicitly reset the
>     cursor in spice upon destroying the primary surface
>     (was done by spice-server implicitly). This will prevent
>     access to pci memory that was released.
> 

Reviewed-by: Alon Levy <alevy@redhat.com>

> RHBZ: 744518
> 
> Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
> ---
>  hw/qxl.c |   16 ++++++++++++----
>  1 files changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/qxl.c b/hw/qxl.c
> index 03848ed..c9b60a2 100644
> --- a/hw/qxl.c
> +++ b/hw/qxl.c
> @@ -238,6 +238,9 @@ void qxl_spice_reset_image_cache(PCIQXLDevice *qxl)
>  void qxl_spice_reset_cursor(PCIQXLDevice *qxl)
>  {
>      qxl->ssd.worker->reset_cursor(qxl->ssd.worker);
> +    qemu_mutex_lock(&qxl->track_lock);
> +    qxl->guest_cursor = 0;
> +    qemu_mutex_unlock(&qxl->track_lock);
>  }
>  
>  
> @@ -402,7 +405,9 @@ static void qxl_track_command(PCIQXLDevice *qxl, struct QXLCommandExt *ext)
>      {
>          QXLCursorCmd *cmd = qxl_phys2virt(qxl, ext->cmd.data, ext->group_id);
>          if (cmd->type == QXL_CURSOR_SET) {
> +            qemu_mutex_lock(&qxl->track_lock);
>              qxl->guest_cursor = ext->cmd.data;
> +            qemu_mutex_unlock(&qxl->track_lock);
>          }
>          break;
>      }
> @@ -1067,6 +1072,7 @@ static int qxl_destroy_primary(PCIQXLDevice *d, qxl_async_io async)
>  
>      d->mode = QXL_MODE_UNDEFINED;
>      qemu_spice_destroy_primary_surface(&d->ssd, 0, async);
> +    qxl_spice_reset_cursor(d);
>      return 1;
>  }
>  
> @@ -1710,10 +1716,12 @@ static int qxl_post_load(void *opaque, int version)
>              cmds[out].group_id = MEMSLOT_GROUP_GUEST;
>              out++;
>          }
> -        cmds[out].cmd.data = d->guest_cursor;
> -        cmds[out].cmd.type = QXL_CMD_CURSOR;
> -        cmds[out].group_id = MEMSLOT_GROUP_GUEST;
> -        out++;
> +        if (d->guest_cursor) {
> +            cmds[out].cmd.data = d->guest_cursor;
> +            cmds[out].cmd.type = QXL_CMD_CURSOR;
> +            cmds[out].group_id = MEMSLOT_GROUP_GUEST;
> +            out++;
> +        }
>          qxl_spice_loadvm_commands(d, cmds, out);
>          g_free(cmds);
>  
> -- 
> 1.7.6.4
> 

  reply	other threads:[~2011-10-18 17:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-18 16:58 [Qemu-devel] [PATCH] qxl: fix guest cursor tracking Yonit Halperin
2011-10-18 17:54 ` Alon Levy [this message]
2011-10-19 12:48 ` Gerd Hoffmann

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=20111018175438.GM3233@bow.tlv.redhat.com \
    --to=alevy@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=spice-devel@freedesktop.org \
    --cc=yhalperi@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).