On Fri, September 27, 2013 4:19 pm, Artem Bityutskiy wrote:
> On Wed, 2013-09-25 at 02:49 +1000, Patrick Shirkey wrote:
>> Hi,
>>
>> A quick update for those who are following this thread.
>>
>> We are tracing the audio latency when running a combination of JACK and
>> PA.
>>
>> We are currently looking at the PA Stream Buffer as a potential
>> bottleneck.
>>
>> During testing I have seen latency as low as 4ms round trip but also as
>> high as 1300ms and the results are not stable on my hda_intel sound
>> device.
>
> I think you earlier said you are using an x68 desktop for testing. What
> I'd try to do is to prevent deep C-states. Indeed, a package you run
> pulseaudio/jack/other related process is able to enter a deep C-state,
> there is an exit latency associated with it.
>
> To put the long story short, there is the /dev/cpu_dma_latency file,
> where you can write the latency you can tolerate (in ms). The kernel
> will translate this to the deepest C-state the processor can enter.
>
> You can write 0 there, which will mean that CPU won't ever enter any
> C-state and will busy-loop when idle. Bad for power consumption. But you
> can just experiment if this helps to lessen the latency divination that
> you observe.
>
> You can write a larger number, then CPU will enter C1 at least, which is
> already a lot better for PM.
>
> You can verify which C-states you hit with the 'turbostat' tool or
> powertop. The former comes, I think, from kernel-tools package in
> Fedora. Play with latency number and use them to check which C-states
> this corresponds to.
>
> Ah, and there is a trick. You should open /dev/cpu_dma_latency, write
> your latency (as ascii or binary, both are ok), and _do not close it_.
> As soon as you close it, the kernel will switch to the default latency
> constraint.
>
> Also, advanced drivers usually use the kernel PMQoS infrastructure and
> instruct the system when they cannot tolerate high latency.
>
> When I do 'git grep PM_QOS_CPU_DMA_LATENCY' in the kernel, I do not see
> the HDA driver doing this.
>
> Anyway, this may not solve the issue, but I'd suggest to try out if it
> at least partially helps. And I am very interested to hear if it does or
> not, or may be you already tried this out.
>
I can't get turbostat with apt on debian as it has been removed from the
acpica-tools package.
Using powertop I see these stats with /dev/cpu_dma_latency set to 0:
Overview
mmary: 230.5 wakeups/second, 0.0 GPU ops/seconds, 0.0 VFS ops/sec and
5.3% CPU use
Usage Events/s Category Description
1.6 ms/s 13.3 Process /usr/bin/jackdbus auto
100.0% Device Audio codec hwC0D1: LSI
3.0 ms/s 90.3 Interrupt [46] snd_hda_intel
4.1 ms/s 26.0 Process ecasound
-f:32,2,48000 -b:64 -i alsa -o alsa
1.7 ms/s 25.7 Timer hrtimer_wakeup
5.9 ms/s 23.0 Process pulseaudio -D
3.6 ms/s 20.4 Timer tick_sched_timer
2.9 ms/s 8.4 Process jack_iodelay
4.1 ms/s 4.6 Interrupt [6] tasklet(softirq)
3.6 ms/s 3.6 Process /usr/bin/gnome-shell
4.2 ms/s 3.4 Process /usr/bin/Xorg :0 -br
-verbose -novtswitch -auth
/var/run/gdm3/auth-for-Debian-gdm-BFaZWx/database -n
2.2 ms/s 3.4 Process
/opt/google/chrome/chrome
555.4 µs/s 2.4 Interrupt [7] sched(softirq)
0.7 ms/s 1.2 Interrupt [9] RCU(softirq)
2.9 ms/s 0.10 kWork disk_events_workfn
1.1 ms/s 0.6 Process gnome-terminal
276.6 µs/s 0.8 Process
/opt/google/chrome/chrome --type=ppapi
--channel=4716.19.930901617 --lang=en-GB
2.4 ms/s 0.00 kWork do_dbs_timer
43.6 µs/s 0.8 kWork flush_to_ldisc
1.1 ms/s 0.00 Timer delayed_work_timer_fn
1.0 ms/s 0.00 Interrupt [1] timer(softirq)
0.8 ms/s 0.05 kWork rfkill_poll
311.1 µs/s 0.20 Process gkrellm
229.2 µs/s 0.25 Interrupt [3] net_rx(softirq)
578.9 µs/s 0.10 Interrupt [4] block(softirq)
138.5 µs/s 0.25 Interrupt [16] uhci_hcd:usb5
0.8 ms/s 0.00 Interrupt [16] nvidia
679.9 µs/s 0.00 Process powertop
5.2 µs/s 0.25 kWork cfq_kick_queue
119.5 µs/s 0.20 kWork os_execute_work_item
194.0 µs/s 0.15 kWork cache_reap
6.4 µs/s 0.15 kWork blk_delay_work
324.6 µs/s 0.00 Interrupt [0] timer/0
173.2 µs/s 0.05 Process
/opt/google/chrome/chrome --type=renderer --lang=en-GB
--force-fieldtrials=ForceCompositingMode/disa
291.3 µs/s 0.00 Interrupt [8] hrtimer(softirq)
34.5 µs/s 0.10 Process
/usr/lib/gnome-online-accounts/goa-daemon
139.6 µs/s 0.05 kWork acpi_os_execute_deferred
10.7 µs/s 0.10 kWork azx_irq_pending_work
1.0 µs/s 0.10 kWork console_callback
107.9 µs/s 0.05 Process
/opt/google/chrome/chrome --type=renderer --lang=en-GB
--force-fieldtrials=ForceCompositingMode/disa
79.0 µs/s 0.05 Process /usr/bin/qjackctl
38.4 µs/s 0.05 Process /usr/sbin/libvirtd -d
6.5 µs/s 0.05 Timer sched_rt_period_timer
5.6 µs/s 0.05 kWork iwl3945_rfkill_poll
Idle
Package | CPU 0
POLL 0.0% | POLL 0.0% 0.0 ms
C1 0.3% | C1 0.4% 0.1 ms
C2 17.8% | C2 17.2% 0.2 ms
C3 13.1% | C3 12.0% 0.1 ms
| CPU 1
| POLL 0.0% 0.0 ms
| C1 0.3% 0.1 ms
| C2 18.4% 0.2 ms
| C3 14.3% 0.2 ms
Frequency
Package | CPU 0
1.83 GHz 2.6% | 1.83 GHz 2.4%
1330 MHz 0.1% | 1330 MHz 0.1%
1000 MHz 6.3% | 1000 MHz 5.0%
Idle 91.0% | Idle 92.5%
| CPU 1
| 1.83 GHz 1.9%
| 1330 MHz 0.1%
| 1000 MHz 4.8%
| Idle 93.3%
Device Stats
Usage Device name
7.0% CPU use
100.0% Audio codec hwC0D0: SigmaTel (jackdbus )
100.0% Audio codec hwC0D1: LSI
100.0% Display backlight
100.0% PCI Device: Intel Corporation Mobile
945GM/PM/GMS, 943/940GML and 945GT Express PCI Express Root
Port
100.0% Radio device: btusb
100.0% Radio device: Toshiba ACPI driver
100.0% USB device: usb-device-0930-0508
100.0% USB device: USB Optical Mouse
100.0% USB device: Biometric Coprocessor
(STMicroelectronics)
100.0% PCI Device: Texas Instruments PCIxx12 OHCI
Compliant IEEE 1394 Host Controller
100.0% PCI Device: Intel Corporation NM10/ICH7 Family
High Definition Audio Controller
100.0% USB device: UHCI Host Controller
100.0% USB device: UHCI Host Controller
100.0% USB device: EHCI Host Controller
100.0% PCI Device: Texas Instruments PCIxx12 Cardbus
Controller
100.0% USB device: Portable (Seagate )
100.0% PCI Device: Intel Corporation 82801GBM/GHM
(ICH7-M Family) SATA Controller [IDE mode]
100.0% PCI Device: Intel Corporation NM10/ICH7 Family
PCI Express Port 3
100.0% PCI Device: Intel Corporation NM10/ICH7 Family
USB UHCI Controller #1
100.0% PCI Device: Intel Corporation NM10/ICH7 Family
USB UHCI Controller #2
100.0% PCI Device: Intel Corporation NM10/ICH7 Family
USB UHCI Controller #3
100.0% PCI Device: Intel Corporation NM10/ICH7 Family
USB UHCI Controller #4
100.0% PCI Device: Intel Corporation NM10/ICH7 Family
USB2 EHCI Controller
100.0% PCI Device: Intel Corporation NM10/ICH7 Family
PCI Express Port 1
100.0% PCI Device: Intel Corporation NM10/ICH7 Family
PCI Express Port 2
100.0% PCI Device: NVIDIA Corporation G72M [Quadro NVS
110M]
100.0% PCI Device: Intel Corporation 82573L Gigabit
Ethernet Controller
100.0% PCI Device: Intel Corporation PRO/Wireless
3945ABG [Golan] Network Connection
100.0% PCI Device: Texas Instruments PCIxx12 SDA
Standard Compliant SD Host Controller
6.3 pkts/s Network interface: eth0 (e1000e)
0.0 pkts/s Network interface: wlan0 (iwl3945)
0.0% Radio device: iwl3945
0.0% USB device: UHCI Host Controller
0.0% USB device: UHCI Host Controller
Tunables
>> Bad Enable Audio codec power management
Bad NMI watchdog should be turned off
Bad VM writeback timeout
Bad Autosuspend for USB device Portable [Seagate ]
Bad Autosuspend for USB device Biometric Coprocessor
[STMicroelectronics]
Bad Autosuspend for USB device USB Optical Mouse [5-1]
Bad Autosuspend for unknown USB device 3-2 (0930:0508)
Bad Runtime PM for PCI Device Intel Corporation Mobile
945GM/PM/GMS, 943/940GML and 945GT Express PCI Express Root Port
Bad Runtime PM for PCI Device Intel Corporation NM10/ICH7
Family PCI Express Port 1
Bad Runtime PM for PCI Device Intel Corporation NM10/ICH7
Family USB UHCI Controller #1
Bad Runtime PM for PCI Device Intel Corporation NM10/ICH7
Family USB2 EHCI Controller
Bad Runtime PM for PCI Device Intel Corporation NM10/ICH7
Family USB UHCI Controller #4
Bad Runtime PM for PCI Device Intel Corporation NM10/ICH7
Family USB UHCI Controller #2
Bad Runtime PM for PCI Device Intel Corporation NM10/ICH7
Family PCI Express Port 3
Bad Runtime PM for PCI Device Intel Corporation NM10/ICH7
Family High Definition Audio Controller
Bad Runtime PM for PCI Device Intel Corporation PRO/Wireless
3945ABG [Golan] Network Connection
Bad Runtime PM for PCI Device Intel Corporation 82573L
Gigabit Ethernet Controller
Bad Runtime PM for PCI Device Intel Corporation NM10/ICH7
Family PCI Express Port 2
Bad Runtime PM for PCI Device NVIDIA Corporation G72M [Quadro
NVS 110M]
Bad Runtime PM for PCI Device Intel Corporation 82801GBM/GHM
(ICH7-M Family) SATA Controller [IDE mode]
Bad Runtime PM for PCI Device Texas Instruments PCIxx12
Cardbus Controller
Bad Runtime PM for PCI Device Intel Corporation NM10/ICH7
Family USB UHCI Controller #3
Bad Runtime PM for PCI Device Texas Instruments PCIxx12 SDA
Standard Compliant SD Host Controller
Bad Runtime PM for PCI Device Texas Instruments PCIxx12 OHCI
Compliant IEEE 1394 Host Controller
Bad Wake-on-lan status for device eth0
Good Wireless Power Saving for interface wlan0
Good Bluetooth device interface status
Good Autosuspend for USB device UHCI Host Controller [usb4]
Good Autosuspend for USB device UHCI Host Controller [usb5]
Good Autosuspend for USB device UHCI Host Controller [usb2]
Good Autosuspend for USB device UHCI Host Controller [usb3]
Good Autosuspend for USB device EHCI Host Controller [usb1]
Good Wake-on-lan status for device wlan0
Good Using 'ondemand' cpufreq governor
----------------
PA Stream Buffer
----------------
I also had some feedback from the PA list about tracing the PA Stream
buffer with "pactl list sink-inputs" specifically to check
"Buffer_Latency" and "Sink_Latency". The sum of these two values is the
full (PA) server-side latency for the stream. I can see by polling the
command that the measure fluctuates over time. I'll follow that up with
the PA list and report back here.
Buffer Latency: 6666 usec
Sink Latency: 3625 usec
Sink Input #1
Driver: protocol-native.c
Owner Module: 9
Client: 5
Sink: 0
Sample Specification: s32le 2ch 48000Hz
Channel Map: front-left,front-right
Format: pcm, format.sample_format = "\"s32le\"" format.rate = "48000"
format.channels = "2" format.channel_map = "\"front-left,front-right\""
Mute: no
Volume: 0: 100% 1: 100%
0: 0.00 dB 1: 0.00 dB
balance 0.00
Buffer Latency: 6666 usec
Sink Latency: 3625 usec
Resample method: copy
Properties:
media.name = "ALSA Playback"
application.name = "ALSA plug-in [ecasound]"
native-protocol.peer = "UNIX socket client"
native-protocol.version = "26"
application.process.id = "29246"
application.process.user = "xxx"
application.process.host = "xxx"
application.process.binary = "ecasound"
application.language = "C"
window.x11.display = ":0"
application.process.machine_id =
"041faf23ca9cf5b3380f10bb508e20d3"
application.process.session_id =
"041faf23ca9cf5b3380f10bb508e20d3-1380185886.55549-100083828"
module-stream-restore.id = "sink-input-by-application-name:ALSA
plug-in
[ecasound]"
--
Patrick Shirkey
Boost Hardware Ltd
_______________________________________________
General mailing list
[email protected]
https://lists.tizen.org/listinfo/general