All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [patch 1/2] qemu: sem/thread helpers
Date: Wed, 11 Mar 2009 11:33:50 -0500	[thread overview]
Message-ID: <49B7E7EE.4020702@us.ibm.com> (raw)
In-Reply-To: <20090311161942.482576079@localhost.localdomain>

Marcelo Tosatti wrote:
> Index: qemu/Makefile.target
> ===================================================================
> --- qemu.orig/Makefile.target
> +++ qemu/Makefile.target
> @@ -500,7 +500,7 @@ endif #CONFIG_BSD_USER
>  # System emulator target
>  ifndef CONFIG_USER_ONLY
>
> -OBJS=vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o machine.o
> +OBJS=vl.o qemu-thread.o osdep.o monitor.o pci.o loader.o isa_mmio.o machine.o
>  # virtio has to be here due to weird dependency between PCI and virtio-net.
>  # need to fix this properly
>  OBJS+=virtio.o virtio-blk.o virtio-balloon.o virtio-net.o virtio-console.o
> Index: qemu/vl.c
> ===================================================================
> --- qemu.orig/vl.c
> +++ qemu/vl.c
> @@ -36,6 +36,7 @@
>  #include "gdbstub.h"
>  #include "qemu-timer.h"
>  #include "qemu-char.h"
> +#include "qemu-thread.h"
>  #include "cache-utils.h"
>  #include "block.h"
>  #include "audio/audio.h"
> @@ -263,6 +264,8 @@ static QEMUTimer *nographic_timer;
>
>  uint8_t qemu_uuid[16];
>
> +QemuSem qemu_sem;
> +
>  /***********************************************************/
>  /* x86 ISA bus support */
>
> @@ -3650,7 +3653,10 @@ void main_loop_wait(int timeout)
>          slirp_select_fill(&nfds, &rfds, &wfds, &xfds);
>      }
>  #endif
> +
> +    qemu_sem_unlock(&qemu_sem);
>      ret = select(nfds + 1, &rfds, &wfds, &xfds, &tv);
> +    qemu_sem_lock(&qemu_sem);
>   

I've looked at this a number of times, so I feel comfortable with this, 
but I think it's subtle enough that it deserves a comment.

main_loop_wait() *must* not assume any global state is consistent across 
select() invocations.  We should make that very clear as it's a detail 
that can be easily missed.

Regards,

Anthony Liguori

  reply	other threads:[~2009-03-11 16:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-11 16:16 [Qemu-devel] [patch 0/2] RFC: separate thread for IO Marcelo Tosatti
2009-03-11 16:16 ` [Qemu-devel] [patch 1/2] qemu: sem/thread helpers Marcelo Tosatti
2009-03-11 16:33   ` Anthony Liguori [this message]
2009-03-11 16:48   ` Paul Brook
2009-03-11 16:56     ` Anthony Liguori
2009-03-11 16:58     ` Marcelo Tosatti
2009-03-18 18:47     ` Marcelo Tosatti
2009-03-15 14:15   ` Avi Kivity
2009-03-17 17:42     ` Marcelo Tosatti
2009-03-17 23:07       ` Paul Brook
2009-03-17 23:43         ` Marcelo Tosatti
2009-03-11 16:16 ` [Qemu-devel] [patch 2/2] qemu: separate thread for io Marcelo Tosatti

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=49B7E7EE.4020702@us.ibm.com \
    --to=aliguori@us.ibm.com \
    --cc=mtosatti@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.