All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [5578] Increase default IO timeout from 10ms to 5s
Date: Mon, 03 Nov 2008 22:50:54 +0100	[thread overview]
Message-ID: <490F723E.7070308@web.de> (raw)
In-Reply-To: <490F60E4.1040304@web.de>

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

Jan Kiszka wrote:
> Anthony Liguori wrote:
>> Jan Kiszka wrote:
>>> Anthony Liguori wrote:
>>>  
>>>> If anyone notices a slow down, I'd check this revision.  There may be
>>>> broken bits of code out there that depends on wake up rate.  I've done a
>>>> fair bit of testing and haven't found any but you never know.
>>>>     
>>> OK, here is one brokenness for you: Musicpal (qemu-arm-system) becomes
>>> unusable, sounds is stopping for seconds, even keyboard input is
>>> inpossible, including switching to the monitor console. What should I
>>> check for? Note that this board uses a ptimer to a PIT to the guest. May
>>> this make a difference here?
>>>   

I think I understood the problem:

[...]
timer_gettime(0, {it_interval={0, 0}, it_value={0, 0}}) = 0
timer_settime(0, 0, {it_interval={0, 0}, it_value={0, 250000}}, NULL) = 0
--- SIGALRM (Alarm clock) @ 0 (0) ---
rt_sigreturn(0xca8d90)                  = 0
select(24, [0 5 6 8 23], [], [], {0, 0}) = 0 (Timeout)
ioctl(20, 0x4122, 0xbb)                 = 0
ioctl(20, 0x4122, 0x54)                 = 0
ioctl(20, 0x4122, 0x3)                  = 0
ioctl(20, 0x4122, 0)                    = 0
ioctl(20, 0x4122, 0xac)                 = 0
ioctl(20, 0x4122, 0)                    = 0
ioctl(20, 0x4122, 0x400)                = 0
ioctl(21, USBDEVFS_IOCTL, 0xd64080)     = 0
ioctl(20, 0x4122, 0xc000000000020400)   = 0
semop(34242562, 0x7fff65de5960, 2)      = 0
semop(34242562, 0x7fff65de5970, 1)      = 0
read(19, "\1\0\0\0\0\201\377\377\321Z\2\0\0\0\0\0\'PO&\0\0\0\0\1\0\0\0\377\377\377\377", 128) = 32
timer_gettime(0, {it_interval={0, 0}, it_value={0, 0}}) = 0
timer_settime(0, 0, {it_interval={0, 0}, it_value={0, 250000}}, NULL) = 0
--- SIGALRM (Alarm clock) @ 0 (0) ---
rt_sigreturn(0xca8d90)                  = 1
select(24, [0 5 6 8 23], [], [], {5, 0}^C <unfinished ...>


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

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.

Jan


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

  reply	other threads:[~2008-11-03 21:51 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 [this message]
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
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=490F723E.7070308@web.de \
    --to=jan.kiszka@web.de \
    --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.