qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Marian Krcmarik <mkrcmari@redhat.com>,
	Alon Levy <alevy@redhat.com>, qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] monitor: Protect outbuf from concurrent access
Date: Thu, 1 Sep 2011 20:47:51 +0100	[thread overview]
Message-ID: <20110901194751.GT14462@redhat.com> (raw)
In-Reply-To: <20110901163545.71ba1515@doriath>

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
> QEMU.
> 
> 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
surprises.

> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>

  Signed-off-by: Daniel P. Berrange <berrange@redhat.com>


Regards,
Daniel
-- 
|: 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	other threads:[~2011-09-01 19:47 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-01 19:35 [Qemu-devel] [PATCH] monitor: Protect outbuf from concurrent access Luiz Capitulino
2011-09-01 19:47 ` Daniel P. Berrange [this message]
2011-09-01 21:03 ` Jan Kiszka
2011-09-02  1:34 ` Anthony Liguori
2011-09-02  9:41   ` Daniel P. Berrange
2011-09-02 11:26     ` Jan Kiszka
2011-09-02 13:39   ` Gerd Hoffmann
2011-09-02 14:03     ` Anthony Liguori
2011-09-02 14:24     ` Luiz Capitulino
2011-09-02 14:28     ` Anthony Liguori
2011-09-02 15:18       ` Gerd Hoffmann
2011-09-02 15:20         ` Anthony Liguori
2011-09-02 15:31         ` Paolo Bonzini
2011-09-02 15:37           ` Anthony Liguori
2011-09-05  7: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=20110901194751.GT14462@redhat.com \
    --to=berrange@redhat.com \
    --cc=alevy@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=mkrcmari@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).