• Konstantin Ozerkov's avatar
    ALSA: intel8x0: Improve performance in virtual environment · 228cf793
    Konstantin Ozerkov authored
    v3: detection code is x86 and KVM specific, hide it under ifdef
    v2: add detection for virtual environments (KVM and Parallels)
    
    This patch is intended to improve performance in virtualized environments
    like Parallels Desktop or KVM/VirtualBox/QEMU (virtual ICH/AC97 audio).
    
    I/O access is very time-expensive operation in virtual world: VCPU
    can be rescheduled and in the worst case we get more than 10ms delay on
    each I/O access.
    
    In the virtual environment loop exit rule
    (old_civ == current_civ && old_picb == current_picb) is never satisfied,
    because old_picb is never the same as current_picb due to delay inspired
    by reading current_civ. As a result loop ended by timeout and we get 10x
    more I/O operations.
    
    Experimental data from Prallels Desktop 7, RHEL6 guest (I/O ops per
    second):
    
    Original code:
    In Port    Counter         Callback
       f014      41550         fffff00000179d00 ac97_bm_read_civ+0x000
       f018      41387         fffff0000017a580 ac97_bm_read_picb+0x000
    
    With patch:
    In Port    Counter         Callback
       f014       4090         fffff00000179d00 ac97_bm_read_civ+0x000
       f018       1964         fffff0000017a580 ac97_bm_read_picb+0x000
    Signed-off-by: default avatarKonstantin Ozerkov <kozerkov@parallels.com>
    Signed-off-by: default avatarDenis V. Lunev <den@openvz.org>
    Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
    228cf793
intel8x0.c 91.4 KB