From: Anthony Liguori <anthony@codemonkey.ws>
To: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: xen-devel@lists.xensource.com, qemu-devel@nongnu.org,
Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Xen-devel] Re: [Qemu-devel] [PATCH 01/13] Handle terminating signals.
Date: Tue, 26 Aug 2008 10:36:18 -0500 [thread overview]
Message-ID: <48B422F2.1090900@codemonkey.ws> (raw)
In-Reply-To: <18612.8502.305043.233934@mariner.uk.xensource.com>
Ian Jackson wrote:
> Anthony Liguori writes ("Re: [Xen-devel] Re: [Qemu-devel] [PATCH 01/13] Handle terminating signals."):
>
>> Then you need a pipe per-signal and you can't accurately simulate
>> threadfd() (since you can't communicate siginfo).
>>
>
> No, you don't need a pipe per signal. You only need multiple pipes if
> you have multiple different event loops which are each capable of
> handling only a subset of the signals, _and_ you're unwilling to use
> an atomic flag variable (eg, cpu_interrupt) or its equivalent.
>
> But we already have cpu_interrupt, and of course the aio completion
> system has its own recording of what's going on. So that does not
> apply to qemu.
>
> All that's needed is a reliable, race-free, way of avoiding spuriously
> blocking in a syscall when an event occurs between checking the state
> variables (aio_error, cpu interrupt check) and the call to select().
> One fd is sufficient for that.
>
> Just to make that concrete, even if we extended my patch to use its
> mechanism for SIGINT et al I don't think a second pipe would be
> needed.
>
In KVM, we do use the signal number to determine action. We could use
globals but since we're multi-threaded, that gets pretty nasty. The
same would apply to a threaded QEMU.
>> I don't see threads as a problem. Are you concerned about mini-OS?
>>
>
> Minios certainly doesn't currently have any threads and it would
> probably be a severe pain to introduce them. That's just one example
> of a portability problem.
>
We're definitely not going to avoid threads forever in QEMU. KVM
requires threads to support multiple VCPUs. Threads are also needed to
support true SMP with TCG.
And right now, implementing a thread pool is the only sane way to get
reasonable disk IO in userspace.
I share your concerns about threading, which is why we have to use them
in a very careful way. My signalfd() patch uses them in a very isolated
way that is pretty easily verified.
You could always add proper signalfd() support to minios. You can also
certainly implement a signalfd() emulation that uses pipe(). signalfd()
is really the right solution to this problem (and it doesn't require
threads by default).
Regards,
Anthony Liguori
> Ian.
>
WARNING: multiple messages have this Message-ID (diff)
From: Anthony Liguori <anthony@codemonkey.ws>
To: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: xen-devel@lists.xensource.com, qemu-devel@nongnu.org,
Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: Re: [Qemu-devel] [PATCH 01/13] Handle terminating signals.
Date: Tue, 26 Aug 2008 10:36:18 -0500 [thread overview]
Message-ID: <48B422F2.1090900@codemonkey.ws> (raw)
In-Reply-To: <18612.8502.305043.233934@mariner.uk.xensource.com>
Ian Jackson wrote:
> Anthony Liguori writes ("Re: [Xen-devel] Re: [Qemu-devel] [PATCH 01/13] Handle terminating signals."):
>
>> Then you need a pipe per-signal and you can't accurately simulate
>> threadfd() (since you can't communicate siginfo).
>>
>
> No, you don't need a pipe per signal. You only need multiple pipes if
> you have multiple different event loops which are each capable of
> handling only a subset of the signals, _and_ you're unwilling to use
> an atomic flag variable (eg, cpu_interrupt) or its equivalent.
>
> But we already have cpu_interrupt, and of course the aio completion
> system has its own recording of what's going on. So that does not
> apply to qemu.
>
> All that's needed is a reliable, race-free, way of avoiding spuriously
> blocking in a syscall when an event occurs between checking the state
> variables (aio_error, cpu interrupt check) and the call to select().
> One fd is sufficient for that.
>
> Just to make that concrete, even if we extended my patch to use its
> mechanism for SIGINT et al I don't think a second pipe would be
> needed.
>
In KVM, we do use the signal number to determine action. We could use
globals but since we're multi-threaded, that gets pretty nasty. The
same would apply to a threaded QEMU.
>> I don't see threads as a problem. Are you concerned about mini-OS?
>>
>
> Minios certainly doesn't currently have any threads and it would
> probably be a severe pain to introduce them. That's just one example
> of a portability problem.
>
We're definitely not going to avoid threads forever in QEMU. KVM
requires threads to support multiple VCPUs. Threads are also needed to
support true SMP with TCG.
And right now, implementing a thread pool is the only sane way to get
reasonable disk IO in userspace.
I share your concerns about threading, which is why we have to use them
in a very careful way. My signalfd() patch uses them in a very isolated
way that is pretty easily verified.
You could always add proper signalfd() support to minios. You can also
certainly implement a signalfd() emulation that uses pipe(). signalfd()
is really the right solution to this problem (and it doesn't require
threads by default).
Regards,
Anthony Liguori
> Ian.
>
next prev parent reply other threads:[~2008-08-26 15:37 UTC|newest]
Thread overview: 214+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-21 16:27 [Qemu-devel] [PATCH 00/13] merge some xen bits into qemu Gerd Hoffmann
2008-08-21 16:27 ` Gerd Hoffmann
2008-08-21 16:27 ` [Qemu-devel] [PATCH 01/13] Handle terminating signals Gerd Hoffmann
2008-08-21 16:27 ` Gerd Hoffmann
2008-08-21 20:11 ` [Qemu-devel] " Anthony Liguori
[not found] ` <m2n.s.1KWGbo-001Nr9@chiark.greenend.org.uk>
2008-08-26 10:44 ` Ian Jackson
2008-08-26 12:16 ` Gerd Hoffmann
2008-08-26 12:36 ` Ian Jackson
2008-08-26 12:58 ` Gerd Hoffmann
2008-08-26 17:55 ` Jamie Lokier
2008-08-26 17:55 ` Jamie Lokier
2008-08-26 13:17 ` [Qemu-devel] " Anthony Liguori
2008-08-26 13:38 ` [Xen-devel] " Ian Jackson
2008-08-26 13:38 ` Ian Jackson
2008-08-26 14:52 ` [Xen-devel] " Avi Kivity
2008-08-26 14:52 ` Avi Kivity
2008-08-26 17:49 ` [Xen-devel] " Jamie Lokier
2008-08-26 17:49 ` [Xen-devel] " Jamie Lokier
2008-08-26 15:04 ` [Xen-devel] Re: [Qemu-devel] " Anthony Liguori
2008-08-26 15:04 ` Anthony Liguori
2008-08-26 15:08 ` [Xen-devel] " Ian Jackson
2008-08-26 15:08 ` Ian Jackson
2008-08-26 15:20 ` [Xen-devel] " Anthony Liguori
2008-08-26 15:20 ` Anthony Liguori
2008-08-26 15:28 ` [Xen-devel] " Ian Jackson
2008-08-26 15:28 ` Ian Jackson
2008-08-26 15:36 ` Anthony Liguori [this message]
2008-08-26 15:36 ` Anthony Liguori
2008-08-26 17:47 ` [Xen-devel] " Jamie Lokier
2008-08-26 17:47 ` [Xen-devel] " Jamie Lokier
2008-08-26 18:03 ` [Xen-devel] Re: [Qemu-devel] " Jamie Lokier
2008-08-26 18:03 ` [Xen-devel] " Jamie Lokier
2008-08-26 18:50 ` [Xen-devel] Re: [Qemu-devel] " Anthony Liguori
2008-08-26 18:50 ` Anthony Liguori
2008-08-27 9:46 ` [Xen-devel] " Ian Jackson
2008-08-27 9:46 ` Ian Jackson
2008-08-27 16:27 ` [Xen-devel] " Jamie Lokier
2008-08-27 16:27 ` [Xen-devel] " Jamie Lokier
2008-08-27 16:35 ` [Xen-devel] Re: [Qemu-devel] " Ian Jackson
2008-08-27 16:35 ` Ian Jackson
2008-08-27 17:55 ` [Xen-devel] " Anthony Liguori
2008-08-27 17:55 ` Anthony Liguori
2008-08-27 18:41 ` [Xen-devel] " Jamie Lokier
2008-08-27 18:41 ` [Xen-devel] " Jamie Lokier
2008-08-28 9:34 ` [Xen-devel] Re: [Qemu-devel] " Ian Jackson
2008-08-28 9:34 ` Ian Jackson
2008-09-07 2:41 ` [Xen-devel] " Anthony Liguori
2008-09-07 2:41 ` Anthony Liguori
2008-08-26 15:36 ` [Xen-devel] " Samuel Thibault
2008-08-26 15:36 ` Samuel Thibault
2008-08-26 15:21 ` [Xen-devel] " Anthony Liguori
2008-08-26 15:21 ` Anthony Liguori
[not found] ` <m2n.s.1KXzwZ-002RA9@chiark.greenend.org.uk>
2008-08-26 15:23 ` [Xen-devel] " Ian Jackson
2008-08-26 15:23 ` Ian Jackson
2008-08-26 15:29 ` [Xen-devel] " Avi Kivity
2008-08-26 15:29 ` Avi Kivity
[not found] ` <m2n.s.1KY0XT-002RJM@chiark.greenend.org.uk>
2008-08-26 15:38 ` [Xen-devel] " Ian Jackson
2008-08-26 15:38 ` Ian Jackson
2008-08-26 16:12 ` [Xen-devel] " Avi Kivity
2008-08-26 16:12 ` Avi Kivity
2008-08-26 16:14 ` [Xen-devel] " Julian Seward
2008-08-26 16:14 ` [Xen-devel] " Julian Seward
2008-08-26 16:39 ` [Xen-devel] Re: [Qemu-devel] " Anthony Liguori
2008-08-26 16:39 ` Anthony Liguori
2008-08-27 8:05 ` [Xen-devel] " Avi Kivity
2008-08-27 8:05 ` Avi Kivity
2008-08-27 8:49 ` [Xen-devel] " Alan Cox
2008-08-27 8:49 ` Alan Cox
2008-08-27 9:10 ` [Xen-devel] " Avi Kivity
2008-08-27 9:10 ` Avi Kivity
2008-08-27 9:16 ` [Xen-devel] " Keir Fraser
2008-08-27 9:16 ` Keir Fraser
2008-08-27 9:12 ` [Xen-devel] " Gleb Natapov
2008-08-27 9:12 ` [Xen-devel] " Gleb Natapov
[not found] ` <m2n.s.1KXz4u-002Qvq@chiark.greenend.org.uk>
2008-08-26 14:55 ` [Xen-devel] Re: [Qemu-devel] " Ian Jackson
2008-08-26 14:55 ` Ian Jackson
2008-08-21 16:27 ` [Qemu-devel] [PATCH 02/13] add DisplayState->idle Gerd Hoffmann
2008-08-21 16:27 ` Gerd Hoffmann
2008-08-21 16:33 ` [Qemu-devel] " Samuel Thibault
2008-08-21 16:33 ` Samuel Thibault
2008-08-21 20:12 ` [Qemu-devel] " Anthony Liguori
2008-08-21 16:27 ` [Qemu-devel] [PATCH 03/13] add container_of() macro to osdep.h Gerd Hoffmann
2008-08-21 16:27 ` Gerd Hoffmann
2008-08-21 20:12 ` [Qemu-devel] " Anthony Liguori
2008-08-21 16:27 ` [Qemu-devel] [PATCH 04/13] move GUI_REFRESH_INTERVAL define from vl.c to console.h Gerd Hoffmann
2008-08-21 16:27 ` Gerd Hoffmann
2008-08-21 20:12 ` [Qemu-devel] " Anthony Liguori
2008-08-21 16:27 ` [Qemu-devel] [PATCH 05/13] xen: groundwork for xen support Gerd Hoffmann
2008-08-21 16:27 ` Gerd Hoffmann
2008-08-21 20:18 ` [Qemu-devel] " Anthony Liguori
2008-08-21 16:27 ` [Qemu-devel] [PATCH 06/13] xen: backend driver core Gerd Hoffmann
2008-08-21 16:27 ` Gerd Hoffmann
2008-08-21 16:27 ` [Qemu-devel] [PATCH 07/13] xen: add console backend driver Gerd Hoffmann
2008-08-21 16:27 ` Gerd Hoffmann
2008-08-21 16:27 ` [Qemu-devel] [PATCH 08/13] xen: add framebuffer " Gerd Hoffmann
2008-08-21 16:27 ` Gerd Hoffmann
2008-08-21 16:27 ` [Qemu-devel] [PATCH 09/13] xen: add block device " Gerd Hoffmann
2008-08-21 16:27 ` Gerd Hoffmann
2008-08-21 16:27 ` [Qemu-devel] [PATCH 10/13] xen: add net " Gerd Hoffmann
2008-08-21 16:27 ` Gerd Hoffmann
2008-08-21 16:27 ` [Qemu-devel] [PATCH 11/13] xen: blk & nic configuration via cmd line Gerd Hoffmann
2008-08-21 16:27 ` Gerd Hoffmann
2008-08-21 16:27 ` [Qemu-devel] [PATCH 12/13] set vnc password from xenstore Gerd Hoffmann
2008-08-21 16:27 ` Gerd Hoffmann
2008-08-21 20:14 ` [Qemu-devel] " Anthony Liguori
2008-08-21 20:19 ` [Xen-devel] " Daniel P. Berrange
2008-08-21 20:19 ` Daniel P. Berrange
2008-08-21 20:22 ` [Xen-devel] " Anthony Liguori
2008-08-21 20:22 ` Anthony Liguori
2008-08-21 20:26 ` [Xen-devel] " Daniel P. Berrange
2008-08-21 20:26 ` Daniel P. Berrange
2008-08-21 21:34 ` [Xen-devel] " Gerd Hoffmann
2008-08-21 21:34 ` Gerd Hoffmann
2008-08-21 21:48 ` [Xen-devel] " Daniel P. Berrange
2008-08-21 21:48 ` Daniel P. Berrange
2008-08-21 22:36 ` [Xen-devel] " Anthony Liguori
2008-08-21 22:36 ` Anthony Liguori
2008-08-24 9:03 ` [Xen-devel] " Avi Kivity
2008-08-22 7:04 ` Gerd Hoffmann
2008-08-22 7:04 ` Gerd Hoffmann
2008-08-22 19:11 ` [Xen-devel] " Jamie Lokier
2008-08-22 19:11 ` [Xen-devel] " Jamie Lokier
2008-08-22 19:01 ` [Xen-devel] Re: [Qemu-devel] " Jamie Lokier
2008-08-22 19:01 ` [Xen-devel] " Jamie Lokier
2008-08-21 22:34 ` [Xen-devel] Re: [Qemu-devel] " Anthony Liguori
2008-08-21 22:34 ` Anthony Liguori
2008-08-22 8:27 ` [Xen-devel] " Gerd Hoffmann
2008-08-22 8:27 ` Gerd Hoffmann
2008-08-24 8:57 ` [Xen-devel] " Avi Kivity
2008-08-24 8:57 ` Avi Kivity
2008-08-24 9:59 ` [Xen-devel] " Jamie Lokier
2008-08-24 9:59 ` [Xen-devel] " Jamie Lokier
2008-08-24 10:07 ` [Xen-devel] Re: [Qemu-devel] " Avi Kivity
2008-08-24 10:07 ` Avi Kivity
2008-08-24 12:48 ` [Xen-devel] " Jamie Lokier
2008-08-24 12:48 ` [Xen-devel] " Jamie Lokier
2008-08-21 20:59 ` [Xen-devel] Re: [Qemu-devel] " Jamie Lokier
2008-08-21 20:59 ` [Xen-devel] " Jamie Lokier
2008-08-21 21:29 ` [Xen-devel] Re: [Qemu-devel] " Gerd Hoffmann
2008-08-21 21:29 ` Gerd Hoffmann
2008-08-26 10:13 ` [Xen-devel] " Ian Jackson
2008-08-26 10:13 ` Ian Jackson
2008-08-21 20:17 ` [Qemu-devel] Re: [Xen-devel] " Daniel P. Berrange
2008-08-21 20:17 ` Daniel P. Berrange
2008-08-21 21:25 ` [Qemu-devel] Re: [Xen-devel] " Gerd Hoffmann
2008-08-21 21:25 ` Gerd Hoffmann
[not found] ` <m2n.s.1KWHfl-001Ntw@chiark.greenend.org.uk>
2008-08-26 10:47 ` [Qemu-devel] Re: [Xen-devel] " Ian Jackson
2008-08-26 10:47 ` [Qemu-devel] " Ian Jackson
2008-08-21 16:27 ` [Qemu-devel] [PATCH 13/13] xen: pv domain builder Gerd Hoffmann
2008-08-21 16:27 ` Gerd Hoffmann
[not found] ` <m2n.s.1KWDD7-002TB9@chiark.greenend.org.uk>
2008-08-26 10:31 ` [Qemu-devel] [PATCH 05/13] xen: groundwork for xen support Ian Jackson
2008-08-26 12:34 ` Gerd Hoffmann
2008-08-26 12:57 ` [Xen-devel] " Daniel P. Berrange
2008-08-26 12:57 ` Daniel P. Berrange
2008-08-26 13:20 ` [Xen-devel] " Gerd Hoffmann
2008-08-26 13:20 ` Gerd Hoffmann
2008-08-26 13:23 ` [Xen-devel] " Daniel P. Berrange
2008-08-26 13:23 ` Daniel P. Berrange
2008-08-26 13:33 ` [Xen-devel] " Ian Jackson
2008-08-26 13:33 ` Ian Jackson
2008-08-26 14:14 ` [Xen-devel] " Daniel P. Berrange
2008-08-26 14:14 ` Daniel P. Berrange
2008-08-26 14:31 ` [Xen-devel] " Gerd Hoffmann
2008-08-26 14:31 ` Gerd Hoffmann
2008-08-26 14:40 ` [Xen-devel] " Daniel P. Berrange
2008-08-26 14:40 ` Daniel P. Berrange
2008-08-26 14:49 ` [Xen-devel] " Gerd Hoffmann
2008-08-26 14:49 ` Gerd Hoffmann
2008-08-26 14:53 ` [Xen-devel] " Daniel P. Berrange
2008-08-26 14:53 ` Daniel P. Berrange
2008-08-26 19:24 ` [Xen-devel] " Gerd Hoffmann
2008-08-26 19:24 ` Gerd Hoffmann
2008-08-26 14:53 ` [Xen-devel] " Ian Jackson
2008-08-26 14:53 ` Ian Jackson
2008-08-27 8:51 ` [Xen-devel] " Gerd Hoffmann
2008-08-27 8:51 ` Gerd Hoffmann
2008-08-27 9:53 ` [Xen-devel] " Ian Jackson
2008-08-27 9:53 ` Ian Jackson
2008-08-27 9:56 ` [Xen-devel] " Daniel P. Berrange
2008-08-27 9:56 ` Daniel P. Berrange
2008-08-27 10:00 ` [Xen-devel] " Ian Jackson
2008-08-27 10:00 ` Ian Jackson
2008-08-27 10:23 ` [Xen-devel] " Daniel P. Berrange
2008-08-27 10:23 ` Daniel P. Berrange
2008-08-27 10:37 ` [Xen-devel] " Gerd Hoffmann
2008-08-27 10:37 ` Gerd Hoffmann
2008-08-27 10:44 ` [Xen-devel] " Daniel P. Berrange
2008-08-27 10:44 ` Daniel P. Berrange
2008-08-27 11:01 ` [Xen-devel] " Gerd Hoffmann
2008-08-27 11:01 ` Gerd Hoffmann
[not found] ` <m2n.s.1KXzR5-002R2A@chiark.greenend.org.uk>
2008-08-26 15:05 ` [Xen-devel] " Ian Jackson
2008-08-26 15:05 ` Ian Jackson
2008-08-26 15:09 ` [Xen-devel] " Daniel P. Berrange
2008-08-26 15:09 ` Daniel P. Berrange
2008-08-26 13:24 ` [Xen-devel] " Ian Jackson
2008-08-26 13:24 ` Ian Jackson
2008-08-26 13:50 ` [Xen-devel] " Daniel P. Berrange
2008-08-26 13:50 ` Daniel P. Berrange
[not found] ` <m2n.s.1KWDfC-002TCd@chiark.greenend.org.uk>
[not found] ` <m2n.s.1KWDGv-002TBJ@chiark.greenend.org.uk>
[not found] ` <m2n.s.1KWDEt-002TBA@chiark.greenend.org.uk>
2008-08-26 10:42 ` [Qemu-devel] [PATCH 13/13] xen: pv domain builder Ian Jackson
2008-08-26 10:50 ` [Xen-devel] " Samuel Thibault
2008-08-26 10:50 ` Samuel Thibault
2008-08-26 13:43 ` [Xen-devel] " Ian Jackson
2008-08-26 13:43 ` Ian Jackson
2008-08-26 21:00 ` [Xen-devel] " Markus Armbruster
2008-08-26 21:00 ` Markus Armbruster
2008-08-26 12:55 ` Gerd Hoffmann
2008-08-26 13:14 ` Ian Jackson
2008-08-26 13:53 ` Gerd Hoffmann
2008-08-26 14:19 ` Ian Jackson
2008-08-26 20:00 ` [Xen-devel] " Gerd Hoffmann
2008-08-26 20:00 ` Gerd Hoffmann
2008-08-27 9:48 ` [Xen-devel] " Ian Jackson
2008-08-27 9:48 ` Ian Jackson
2008-08-26 13:56 ` 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=48B422F2.1090900@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=Ian.Jackson@eu.citrix.com \
--cc=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=xen-devel@lists.xensource.com \
/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.