qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Bing Bu Cao <caobingbu@gmail.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 4/4] spice: drop obsolete iothread locking
Date: Wed, 17 Oct 2012 17:32:33 +0800	[thread overview]
Message-ID: <507E7B31.3010905@gmail.com> (raw)
In-Reply-To: <1304069912-21629-5-git-send-email-kraxel@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 3835 bytes --]

Hi,Gerd

I found the lock has been revert in qemu-kvm repository and
qemu-kvm on RHEL6.3 with spice/qxl has one problem:


Doing some display configuration (such as changing resolution) in guest 
will involve in deadlock in guest,meanwhile
which affect the host hang for a long while.


I wonder whether this patch should be revert back in qemu-kvm again?
Actually, I have no idea why added in QEMU but not in qemu-kvm? :)


On 04/29/2011 05:38 PM, Gerd Hoffmann wrote:
> We don't use qemu internals from spice server context any more.
> Thus we don't also need to grab the iothread mutex from spice
> server context.  And we don't have to temporarely release the
> lock to avoid deadlocks.  Drop all the calls.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>   hw/qxl.c           |    8 --------
>   ui/spice-display.c |    6 ------
>   2 files changed, 0 insertions(+), 14 deletions(-)
>
> diff --git a/hw/qxl.c b/hw/qxl.c
> index 4dfddf0..2bb36c6 100644
> --- a/hw/qxl.c
> +++ b/hw/qxl.c
> @@ -666,10 +666,8 @@ static void qxl_hard_reset(PCIQXLDevice *d, int loadvm)
>       dprint(d, 1, "%s: start%s\n", __FUNCTION__,
>              loadvm ? " (loadvm)" : "");
>   
> -    qemu_mutex_unlock_iothread();
>       d->ssd.worker->reset_cursor(d->ssd.worker);
>       d->ssd.worker->reset_image_cache(d->ssd.worker);
> -    qemu_mutex_lock_iothread();
>       qxl_reset_surfaces(d);
>       qxl_reset_memslots(d);
>   
> @@ -799,9 +797,7 @@ static void qxl_reset_surfaces(PCIQXLDevice *d)
>   {
>       dprint(d, 1, "%s:\n", __FUNCTION__);
>       d->mode = QXL_MODE_UNDEFINED;
> -    qemu_mutex_unlock_iothread();
>       d->ssd.worker->destroy_surfaces(d->ssd.worker);
> -    qemu_mutex_lock_iothread();
>       memset(&d->guest_surfaces.cmds, 0, sizeof(d->guest_surfaces.cmds));
>   }
>   
> @@ -870,9 +866,7 @@ static void qxl_destroy_primary(PCIQXLDevice *d)
>       dprint(d, 1, "%s\n", __FUNCTION__);
>   
>       d->mode = QXL_MODE_UNDEFINED;
> -    qemu_mutex_unlock_iothread();
>       d->ssd.worker->destroy_primary_surface(d->ssd.worker, 0);
> -    qemu_mutex_lock_iothread();
>   }
>   
>   static void qxl_set_mode(PCIQXLDevice *d, int modenr, int loadvm)
> @@ -942,10 +936,8 @@ static void ioport_write(void *opaque, uint32_t addr, uint32_t val)
>       case QXL_IO_UPDATE_AREA:
>       {
>           QXLRect update = d->ram->update_area;
> -        qemu_mutex_unlock_iothread();
>           d->ssd.worker->update_area(d->ssd.worker, d->ram->update_surface,
>                                      &update, NULL, 0, 0);
> -        qemu_mutex_lock_iothread();
>           break;
>       }
>       case QXL_IO_NOTIFY_CMD:
> diff --git a/ui/spice-display.c b/ui/spice-display.c
> index 1e1a35d..34201cd 100644
> --- a/ui/spice-display.c
> +++ b/ui/spice-display.c
> @@ -176,18 +176,14 @@ void qemu_spice_create_host_primary(SimpleSpiceDisplay *ssd)
>       surface.mem        = (intptr_t)ssd->buf;
>       surface.group_id   = MEMSLOT_GROUP_HOST;
>   
> -    qemu_mutex_unlock_iothread();
>       ssd->worker->create_primary_surface(ssd->worker, 0, &surface);
> -    qemu_mutex_lock_iothread();
>   }
>   
>   void qemu_spice_destroy_host_primary(SimpleSpiceDisplay *ssd)
>   {
>       dprint(1, "%s:\n", __FUNCTION__);
>   
> -    qemu_mutex_unlock_iothread();
>       ssd->worker->destroy_primary_surface(ssd->worker, 0);
> -    qemu_mutex_lock_iothread();
>   }
>   
>   void qemu_spice_vm_change_state_handler(void *opaque, int running, int reason)
> @@ -197,9 +193,7 @@ void qemu_spice_vm_change_state_handler(void *opaque, int running, int reason)
>       if (running) {
>           ssd->worker->start(ssd->worker);
>       } else {
> -        qemu_mutex_unlock_iothread();
>           ssd->worker->stop(ssd->worker);
> -        qemu_mutex_lock_iothread();
>       }
>       ssd->running = running;
>   }


[-- Attachment #2: Type: text/html, Size: 4410 bytes --]

  reply	other threads:[~2012-10-17  9:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-29  9:38 [Qemu-devel] [PATCH 0/4] spice: fix locking Gerd Hoffmann
2011-04-29  9:38 ` [Qemu-devel] [PATCH 1/4] Make spice dummy functions inline to fix calls not checking return values Gerd Hoffmann
2011-04-29  9:38 ` [Qemu-devel] [PATCH 2/4] spice: don't create updates in spice server context Gerd Hoffmann
2011-04-29 11:18   ` Alon Levy
2011-04-29 11:56     ` Gerd Hoffmann
2011-04-29  9:38 ` [Qemu-devel] [PATCH 3/4] spice: don't call displaystate callbacks from " Gerd Hoffmann
2011-04-29  9:38 ` [Qemu-devel] [PATCH 4/4] spice: drop obsolete iothread locking Gerd Hoffmann
2012-10-17  9:32   ` Bing Bu Cao [this message]
2011-04-29 11:20 ` [Qemu-devel] [PATCH 0/4] spice: fix locking Alon Levy
2011-04-29 22:33   ` Alon Levy
  -- strict thread matches above, loose matches on Subject: below --
2011-05-03 15:06 [Qemu-devel] [PULL] " Gerd Hoffmann
2011-05-03 15:06 ` [Qemu-devel] [PATCH 4/4] spice: drop obsolete iothread locking 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=507E7B31.3010905@gmail.com \
    --to=caobingbu@gmail.com \
    --cc=kraxel@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).