qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] timer: fix qemu_poll_ns early timeout on window


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH] timer: fix qemu_poll_ns early timeout on windows
Date: Mon, 28 Apr 2014 11:10:43 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0

Il 18/04/2014 10:29, Alex Bligh ha scritto:
I suspect the easiest fix (certainly for debug purposes) would be to make all
polls for non-zero time at least 10ms long. IE after the assignment of 'ms',
do something like

#ifdef BROKEN_POLL
    if (ms < 10) {
        ms = 10;
#endif
    }

If you're actually saying g_poll has 10 millisecond resolution, or rounds down,
then the appropriate course of action would be to change the rounding line to

    ms = (ns + 10*SCALE_MS - 1) / (10*SCALE_MS);

where g_poll is broken like this.

As I say, I have no Windows box to test this on, but I hope that's helpful.

Unfortunately that would probably break guests.

Windows's default poll resolution is indeed around 10 ms, and that's where glib comes from. But it can be lowered with timeBeginPeriod and timeEndPeriod, which is what QEMU does (note: the functions are basically nops with WINE, but if you remove them things actually break on Windows).

But it's unlikely that glib will change their code, which also makes sense in the common case where you don't call timeBeginPeriod/timeEndPeriod. So I think Stanislav's patch makes sense.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]