From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:51961) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RB9bt-0003Zp-T6 for qemu-devel@nongnu.org; Tue, 04 Oct 2011 14:20:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RB9br-00076P-6v for qemu-devel@nongnu.org; Tue, 04 Oct 2011 14:20:57 -0400 Received: from mail-yw0-f45.google.com ([209.85.213.45]:45133) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RB9br-00076H-2X for qemu-devel@nongnu.org; Tue, 04 Oct 2011 14:20:55 -0400 Received: by ywm39 with SMTP id 39so929023ywm.4 for ; Tue, 04 Oct 2011 11:20:54 -0700 (PDT) Message-ID: <4E8B4E82.1000009@codemonkey.ws> Date: Tue, 04 Oct 2011 13:20:50 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <1317739882-4809-1-git-send-email-anthony.perard@citrix.com> <1317739882-4809-3-git-send-email-anthony.perard@citrix.com> <4E8B4203.8040207@web.de> In-Reply-To: <4E8B4203.8040207@web.de> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH RFC V1 02/11] qemu-timer: Introduce qemu_run_one_timer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: Anthony PERARD , Alex Williamson , Xen Devel , QEMU-devel , Stefano Stabellini On 10/04/2011 12:27 PM, Jan Kiszka wrote: > On 2011-10-04 16:51, Anthony PERARD wrote: >> Used by the Xen PCI Passthrough code to run the timer about the power >> state transition. >> >> Signed-off-by: Anthony PERARD >> --- >> qemu-timer.c | 15 +++++++++++++++ >> qemu-timer.h | 3 +++ >> 2 files changed, 18 insertions(+), 0 deletions(-) >> >> diff --git a/qemu-timer.c b/qemu-timer.c >> index 46dd483..15e659b 100644 >> --- a/qemu-timer.c >> +++ b/qemu-timer.c >> @@ -1163,3 +1163,18 @@ int qemu_calculate_timeout(void) >> return 1000; >> } >> >> +/* run the specified timer */ >> +void qemu_run_one_timer(QEMUTimer *ts) >> +{ >> + uint64_t current_time; >> + >> + /* remove timer from the list before calling the callback */ >> + qemu_del_timer(ts); >> + >> + while ((current_time = qemu_get_clock_ms(rt_clock))< ts->expire_time) >> + /* sleep until the expire time */ >> + usleep((ts->expire_time - current_time) * 1000); >> + >> + /* run the callback */ >> + ts->cb(ts->opaque); >> +} > > This looks funny. I can't imagine that this could ever fit into the > standard (asynchronous) QEMU execution model for I/O. Keep it private to > Xen? I think it's funny for Xen too. Why in the world would you need this? Regards, Anthony Liguroi > Jan >