qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: andrzej zaborowski <balrogg@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Re: [5578] Increase default IO timeout from 10ms to 5s
Date: Tue, 04 Nov 2008 09:22:44 +0100	[thread overview]
Message-ID: <49100654.6020108@web.de> (raw)
In-Reply-To: <fb249edb0811040007h46171c0o7547b70596691ebb@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1804 bytes --]

andrzej zaborowski wrote:
> 2008/11/3 Anthony Liguori <anthony@codemonkey.ws>:
>> Jan Kiszka wrote:
>>> Jan Kiszka wrote:
>>>
>>> There is a race between the alarm_timer firing SIGALRM and
>>> main_loop_wait reaching the safe harbor of select (with that infamous 5
>>> second timeout). If the signal comes when already blocked in select, it
>>> will properly resume the latter immediately. But if the timer fired
>>> BEFORE that point, host_alarm_handler will only set a flag that the host
>>> timer has fired, the actual rearming will be done AFTER return from
>>> select. Ooops....
>>>
>> Ah, so before this was causing the timer to potentially come 10ms later than
>> it should have.  I was hoping that this change would shake out this stuff
>> :-)
>>
>>> So, select should actually include the host timer as event. timerfd?
>>> Unfortunately a recent Linux-only feature :-/. I don't think we can
>>> rearm the timer from within the signal handler, at least not without
>>> running all the pending qemu timers. And that is surely not a signal
>>> handler job (qemu timer handler aren't thread-safe in general).
>>>
>>> Anyone any ideas? /me is thinking a bit more about it as well.
> 
> The select() man page on Linux mentions this race explicitely and
> explains that pselect() is a solution.
> 
>> host_alarm_handler should write to a file descriptor instead of setting a
>> flag.  That file descriptor should then be select()'d on (just like we do
>> for SIGUSR2 in block-raw-posix.c).
> 
> Or you can do this.

I think this is safer. Or what's the state of pselect on all supported
platforms (including WIN32)? My man page even warns that the Linux
kernel is not implementing it yet, though I don't think this still
applies to recent 2.6.2x kernels.

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]

  reply	other threads:[~2008-11-04  8:22 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-31 18:40 [Qemu-devel] [5578] Increase default IO timeout from 10ms to 5s Anthony Liguori
2008-10-31 18:52 ` Anthony Liguori
2008-11-02 19:08   ` [Qemu-devel] " Jan Kiszka
2008-11-03 20:04     ` Anthony Liguori
2008-11-03 20:36       ` Jan Kiszka
2008-11-03 21:50         ` Jan Kiszka
2008-11-03 22:00           ` Anthony Liguori
2008-11-03 22:03             ` Jan Kiszka
2008-11-04  8:07             ` andrzej zaborowski
2008-11-04  8:22               ` Jan Kiszka [this message]
2008-11-04  8:33                 ` andrzej zaborowski
2008-11-04 11:32                   ` Jamie Lokier
2008-11-04 16:22                     ` M. Warner Losh
2008-11-04 17:10                       ` Jan Kiszka
2008-11-04 17:55                         ` M. Warner Losh
2008-11-04 19:08                           ` Jan Kiszka
2008-11-05 15:00                       ` Jamie Lokier
2008-11-05 16:10                         ` M. Warner Losh
2008-11-05 18:21                           ` Jan Kiszka
2008-11-05 18:41                             ` Daniel P. Berrange
2008-11-05 20:16                             ` andrzej zaborowski
2008-11-05 20:28                               ` Daniel P. Berrange
2008-11-05 23:38                                 ` Jamie Lokier
2008-11-06  0:53                           ` Jamie Lokier
2008-11-06  5:19                             ` M. Warner Losh
2008-11-04  8:29           ` Avi Kivity
2008-10-31 19:41 ` [Qemu-devel] " Jamie Lokier
2008-10-31 20:13   ` Anthony Liguori

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=49100654.6020108@web.de \
    --to=jan.kiszka@web.de \
    --cc=balrogg@gmail.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).