Patchwork hw/qxl: another missing unlock

login
register
mail settings
Submitter Alon Levy
Date Jan. 25, 2011, 2:42 p.m.
Message ID <1295966534-13121-1-git-send-email-alevy@redhat.com>
Download mbox | patch
Permalink /patch/80371/
State New
Headers show

Comments

Alon Levy - Jan. 25, 2011, 2:42 p.m.
We need to unlock the mutex before waiting on read via
the worker call since the worker will try to lock and hang
otherwise.

Signed-off-by: Alon Levy <alevy@redhat.com>
---
 hw/qxl.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
Gerd Hoffmann - Jan. 27, 2011, 8:17 a.m.
On 01/25/11 15:42, Alon Levy wrote:
> We need to unlock the mutex before waiting on read via
> the worker call since the worker will try to lock and hang
> otherwise.
>
> Signed-off-by: Alon Levy<alevy@redhat.com>
> ---
>   hw/qxl.c |    2 ++
>   1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/hw/qxl.c b/hw/qxl.c
> index 117f7c8..00c31c7 100644
> --- a/hw/qxl.c
> +++ b/hw/qxl.c
> @@ -791,7 +791,9 @@ static void qxl_add_memslot(PCIQXLDevice *d, uint32_t slot_id, uint64_t delta)
>              __FUNCTION__, memslot.slot_id,
>              memslot.virt_start, memslot.virt_end);
>
> +    qxl_unlock_iothread(&d->ssd);
>       d->ssd.worker->add_memslot(d->ssd.worker,&memslot);
> +    qxl_lock_iothread(&d->ssd);
>       d->guest_slots[slot_id].ptr = (void*)memslot.virt_start;
>       d->guest_slots[slot_id].size = memslot.virt_end - memslot.virt_start;
>       d->guest_slots[slot_id].delta = delta;

added to spice patch queue

thanks,
   Gerd

Patch

diff --git a/hw/qxl.c b/hw/qxl.c
index 117f7c8..00c31c7 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -791,7 +791,9 @@  static void qxl_add_memslot(PCIQXLDevice *d, uint32_t slot_id, uint64_t delta)
            __FUNCTION__, memslot.slot_id,
            memslot.virt_start, memslot.virt_end);
 
+    qxl_unlock_iothread(&d->ssd);
     d->ssd.worker->add_memslot(d->ssd.worker, &memslot);
+    qxl_lock_iothread(&d->ssd);
     d->guest_slots[slot_id].ptr = (void*)memslot.virt_start;
     d->guest_slots[slot_id].size = memslot.virt_end - memslot.virt_start;
     d->guest_slots[slot_id].delta = delta;