ia64/xen-unstable

changeset 15247:340dbdb9cfec

Fix the very-slow-IDE-IO-speed issue of Qemu 0.90

c/s 15021 updated Qemu to 0.90. In the new Qemu's ide.c, asynchronous
IO (AIO) is used to replace the previous DMA thread; here when an AIO
request is completed, dom0 sends a signal SIGUSR2 to Qemu (see
block-raw.c: qemu_aio_init(),raw_aio_setup()), then the signal
interrupts the select() in main_loop_wait() at once, next,
qemu_aio_poll() is called to reap a completed AIO request.

However, in certain Linux distributions (i.e., x86_64 RHEL 4u4), if
Qemu is spawned by the python script image.py of Control Panel, the
SIGUSR2 of Qemu is blocked by default due to some reasons (i.e. it
seems Python 2.3.4 has this issue; 2.4.2 is ok); so in most cases the
select() in main_loop_wait() can only time out in 10ms, then the
qemu_aio_poll() is called - this results in a very slow disk IO
speed...

This patch ensures aio_sig_num is unblocked when the AIO is used in
Qemu 0.90.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
author kfraser@localhost.localdomain
date Thu May 31 10:30:15 2007 +0100 (2007-05-31)
parents dc25aedfa4f3
children d1d5ceb3c3ff
files tools/ioemu/block-raw.c
line diff
     1.1 --- a/tools/ioemu/block-raw.c	Thu May 31 09:49:53 2007 +0100
     1.2 +++ b/tools/ioemu/block-raw.c	Thu May 31 10:30:15 2007 +0100
     1.3 @@ -189,9 +189,15 @@ static void aio_signal_handler(int signu
     1.4  void qemu_aio_init(void)
     1.5  {
     1.6      struct sigaction act;
     1.7 +    sigset_t set;
     1.8  
     1.9      aio_initialized = 1;
    1.10      
    1.11 +    /* Ensure aio_sig_num is not blocked */ 
    1.12 +    sigemptyset(&set);
    1.13 +    sigaddset(&set, aio_sig_num);
    1.14 +    sigprocmask(SIG_UNBLOCK, &set, NULL);
    1.15 +
    1.16      sigfillset(&act.sa_mask);
    1.17      act.sa_flags = 0; /* do not restart syscalls to interrupt select() */
    1.18      act.sa_handler = aio_signal_handler;