Subject: Re: [X2Go-Dev] Bug#526: Bug#526: Included PulseAudio consumes too much CPU when launched with high priority

From: Michael DePaulo <[email-masked]>
Date: Mon, 30 Jun 2014 10:11:03 -0400

Hi Nable,

1. thank you for the patch. Command line testing shows that it does
lower the priority for PulseAudio 5.0 on Windows to "normal".
PulseAudio 1.1 ignores the argument and remains at "high" priority,
even though --help states that it recognizes the argument. 0.9.6
defaults to normal priority anyway. None of them refuse to start when
the argument is passed though.

2. I will incorporate your patch (it's only 1 line after all,) but
after talking with the PulseAudio developers, I will extend it so that
"normal" priority will only be set on Windows XP and Server 2003 /
Server 2003 R2. On Windows Vista / server 2008 and later, we will
continue to default to "high" priority.
(You are welcome to extend the patch to do this, or I will do extend
it later today or tomorrow.)

3. Right now I cannot test the patch with x2goclient because the
WIndows build VM has a networking problem. Mike#1 will fix that
problem sometime this week.

4. My testing reveals the following:
a. I am able to reproduce this bug. See setup #2 below.
b. I encountered a different bug with the virtual hardware (setup #1),
which is fixed by switching to a different sound driver (setup #2). I
will clone this bug report for my setup #1 bug.
c. This bug does not result in high CPU usage until audio is playing,
unlike my bug.
d. Manually  lowering the priority in task manager does appear to be a
valid workaround.

5. All my test details:

setup #1:
Note: default sound driver. I think I have a driverpacks.net driver
pack installed though, so it may not be the default driver for XP
without said driver pack.
Host & Hypervisor: Fedora 20 w/ KVM/virt-manager
VM accessed via: VirtViewer 0.6.0 64-bit for Windows w/ the SPICE protocol
Guest OS: Windows XP SP3 32-bit
vCPUs : 2 (host has 4 cores, core i5 750)
Sound setting in virt-manager: ac97
Sound adapter according to Windows: Intel(r) AC'97 Audio Controller -
SIgmaTel Codec
Driver Provider: SigmaTel
Driver Date: 12/20/2001
Driver Version: 5.10.0.7159

Results with: PulseaAudio 5.0, PulseAudio 1.1, and PulseAudio 0.9.6
launched from the command-line:
The combined CPU usage of pulseaudio.exe + "System" is very high, even
at normal priority, and the VM is extremely slow overall. This occurs
before any sound as playing. In other words, as the process is
started, the CPU usage immediately goes up and the VM immediately
becomes extremely slow. The combined CPU usage is always greater than
or equal to 1 CPU core.See #1 for notes on the behavior of the
priority. And yes, "System" CPU usage is normally 0% or just above 0%,
when pulseaudio.exe is not running.
The attached logs are from said results.

Results with x2goclient 4.0.2.0 (PulseAudio 5.0):
X2Go client GUI is extremely slow for same reason as on the
command-line. Cannot test any further.

setup #2
Note: same as before, except for a different sound driver:
Host & Hypervisor: Fedora 20 w/ KVM/virt-manager
VM accessed via: VirtViewer 0.6.0 64-bit for Windows w/ the SPICE protocol
Guest OS: Windows XP SP3 32-bit
vCPUs : 2 (host has 4 cores, core i5 750)
Sound setting in virt-manager: ac97
Sound adapter according to Windows: Intel(r) 82801AA AC'97 Audio Controller
Driver Provider: Microsoft
Driver Date: 7/1/2001
Driver Version: 5.1.2535.0

Results with: PulseaAudio 5.0, PulseAudio 1.1, and PulseAudio 0.9.6
launched from the command-line:
Whether I have normal priority or high priority, there is no high CPU
usage for either process, and no VM slowdown.

Results with x2goclient 4.0.2.0 (PulseAudio 5.0):
I reproduced this bug reported by Nable. I also observed that lowering
PulseAudio to normal fixes the problem. Only 1 vCPU was maxed out for
me (Nable had single core.) Also, unlike my problem with setup #1, the
VM is not extremely slow. Also, unlike my problem setup #1, CPU usage
is not high until audio is playing. Also, unlike my problem on
setup#1, "System's usage is 0% or a few % like normal.  There seems to
be a 1 second delay in audio, but that may be due to me accessing the
VM over Virt-Viewer. Also, the delay occurs at high priority.

-Mike#2

On Sun, Jun 29, 2014 at 11:47 AM, Nable 80
<[email-masked]> wrote:
> Hi Mike!
>
>> Our PA expert will take a look at that (I hope!).
> I've attached possible workaround, although I'm not sure if it's acceptable.
>
> _______________________________________________
> x2go-dev mailing list
> [email-masked]
> http://lists.x2go.org/listinfo/x2go-dev