Stefano Stabellini
2010-Nov-26 14:58 UTC
[Xen-devel] [PATCH] qemu-xen: use dynticks instead of a static 10ms timeout
qemu-xen: use dynticks instead of a static 10ms timeout Use dynticks instead of polling the timers every 10ms. This allows a qemu running in dom0 to wake up only when the next timer goes off (that is every 100ms, because of the buffer_io_timer) instead of every 10ms. For the moment stubdoms still run with the old 10ms timeout because minios doesn''t support the posix timer_create interface yet. Also disable the nographic_timer when CONFIG_DM because it is only useful with tcg. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> --- diff --git a/i386-dm/helper2.c b/i386-dm/helper2.c index ce73421..94237b6 100644 --- a/i386-dm/helper2.c +++ b/i386-dm/helper2.c @@ -572,8 +572,13 @@ int main_loop(void) while (1) { while (!(vm_running && xen_pause_requested)) +#ifdef CONFIG_STUBDOM /* Wait up to 10 msec. */ main_loop_wait(10); +#else + /* Wait up to 10s. */ + main_loop_wait(10000); +#endif fprintf(logfile, "device model saving state\n"); diff --git a/vl.c b/vl.c index d465a09..9c08fcb 100644 --- a/vl.c +++ b/vl.c @@ -942,7 +942,7 @@ static void win32_rearm_timer(struct qemu_alarm_timer *t); static int unix_start_timer(struct qemu_alarm_timer *t); static void unix_stop_timer(struct qemu_alarm_timer *t); -#if defined(__linux__) && !defined(CONFIG_DM) +#if defined(__linux__) static int dynticks_start_timer(struct qemu_alarm_timer *t); static void dynticks_stop_timer(struct qemu_alarm_timer *t); @@ -1025,7 +1025,7 @@ static void init_icount_adjust(void) static struct qemu_alarm_timer alarm_timers[] = { #ifndef _WIN32 -#if defined(__linux__) && !defined(CONFIG_DM) +#if defined(__linux__) {"dynticks", ALARM_FLAG_DYNTICKS, dynticks_start_timer, dynticks_stop_timer, dynticks_rearm_timer, NULL}, /* HPET - if available - is preferred */ @@ -1327,7 +1327,6 @@ static int timer_load(QEMUFile *f, void *opaque, int version_id) return 0; } -#ifndef CONFIG_DM /* ends just before fcntl_setfl */ #ifdef _WIN32 void CALLBACK host_alarm_handler(UINT uTimerID, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2) @@ -1436,7 +1435,6 @@ static uint64_t qemu_next_deadline_dyntick(void) return delta; } #endif -#endif #ifndef _WIN32 @@ -1455,7 +1453,6 @@ static int fcntl_setfl(int fd, int flag) return 0; } -#ifndef CONFIG_DM /* ends after end of win32_rearm_timer */ #if defined(__linux__) #define RTC_FREQ 1024 @@ -1632,6 +1629,7 @@ static void dynticks_rearm_timer(struct qemu_alarm_timer *t) #endif /* defined(__linux__) */ +#ifndef CONFIG_STUBDOM static int unix_start_timer(struct qemu_alarm_timer *t) { struct sigaction act; @@ -1665,8 +1663,11 @@ static void unix_stop_timer(struct qemu_alarm_timer *t) memset(&itv, 0, sizeof(itv)); setitimer(ITIMER_REAL, &itv, NULL); } +#else +static int unix_start_timer(struct qemu_alarm_timer *t) { return 0; } +static void unix_stop_timer(struct qemu_alarm_timer *t) { } +#endif -#endif /* !defined(_WIN32) */ static void try_to_rearm_timer(void *opaque) { @@ -6017,10 +6018,12 @@ int main(int argc, char **argv, char **envp) dcl = dcl->next; } +#ifndef CONFIG_DM if (nographic || (vnc_display && !sdl)) { nographic_timer = qemu_new_timer(rt_clock, nographic_update, NULL); qemu_mod_timer(nographic_timer, qemu_get_clock(rt_clock)); } +#endif text_consoles_set_display(display_state); qemu_chr_initial_reset(); @@ -6155,6 +6158,3 @@ int main(int argc, char **argv, char **envp) return 0; } - -static int unix_start_timer(struct qemu_alarm_timer *t) { return 0; } -static void unix_stop_timer(struct qemu_alarm_timer *t) { } _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Jackson
2011-Jan-11 18:52 UTC
Re: [Xen-devel] [PATCH] qemu-xen: use dynticks instead of a static 10ms timeout
Stefano Stabellini writes ("[Xen-devel] [PATCH] qemu-xen: use dynticks instead of a static 10ms timeout"):> qemu-xen: use dynticks instead of a static 10ms timeoutThanks, I have applied this patch, and sorry for the delay. Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel