[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] monitor: Protect outbuf from concurrent access

From: Daniel P. Berrange
Subject: Re: [Qemu-devel] [PATCH] monitor: Protect outbuf from concurrent access
Date: Thu, 1 Sep 2011 20:47:51 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Sep 01, 2011 at 04:35:45PM -0300, Luiz Capitulino wrote:
> Sometimes, when having lots of VMs running on a RHEV host and the user
> attempts to close a SPICE window, libvirt will get corrupted json from
> After some investigation, I found out that the problem is that different
> SPICE threads are calling monitor functions (such as
> monitor_protocol_event()) in parallel which causes concurrent access
> to the monitor's internal buffer outbuf[].
> This fixes the problem by protecting accesses to outbuf[] with a mutex.
> Honestly speaking, I'm not completely sure this the best thing to do
> because the monitor itself and other qemu subsystems are not thread safe,
> so having subsystems like SPICE assuming the contrary seems a bit
> catastrophic to me...
> Anyways, this commit fixes the problem at hand.

IMHO this patch should be applied to stable-0.15 as is, since it is
an important fix for SPICE, and this highly targetted mutex lock has
low-risk of regressions elsewhere.

I'd also apply it for master now, but at the same time perhaps start
work on adding broader locking that covers all APIs that monitor.c
exposes to internal QEMU code, so we're future proofed against other

> Signed-off-by: Luiz Capitulino <address@hidden>

  Signed-off-by: Daniel P. Berrange <address@hidden>

|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

reply via email to

[Prev in Thread] Current Thread [Next in Thread]