Re: MIDI playback not keeping steady time with recent kernels

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Arthur Marsh wrote, on 06/02/11 21:37:
Arthur Marsh wrote, on 06/02/11 16:06:
Arthur Marsh wrote, on 06/02/11 12:08:
Arthur Marsh wrote, on 05/02/11 17:30:
Hi, I've had problems lately with recent kernels 2.6.37 and later, but
haven't been able to pinpoint a specific change with git-bisect.

MIDI playback either through xmms or aplaymidi won't keep regular time,
sounding weird going faster and slower under any kind of system load
except when nothing else is running.

My alsa-info.sh results are at

http://www.alsa-project.org
/db/?f=e6a1108957098461ebbca54cc342f616b03b12df

Has anyone experienced this kind of problem?

Arthur.

Earlier, Takashi Iwai suggested:

Well, it implies that hrtimer is broken on your hardware.

Just add a module option timer_limit=3 to snd-timer, i.e. adding a file
containing below to /etc/modprobe.d/*.

       options snd-timer timer_limit=3


so I modified my /etc/modprobe.d/sound.conf to include:

"options snd-timer timer_limit=3" as below:

alias snd-card-0 snd-emu10k1
options snd-emu10k1 index=0
options snd-timer timer_limit=3

The problem still appears to be persisting, so I might try:

options snd-timer timer_limit=2

I've since upgraded to ALSA 1.0.24 (no change), then tried setting
timer_limit=2 (no change), then tried setting timer_limit=1 (better, but
some slow downs like when trying to bring up a window to compose this
message, or running aptitude -u).

Current alsa-info.sh output is at:

http://www.alsa-project.org/db/?f=32eda5c522289fb30ef704fe73efa68314ce91d3


I've tried setting "options snd-timer timer_limit=x" where x is anywhere
from 5 down to 0, and seeing either:

$ cat /proc/asound/seq/timer
Timer for queue 0 : HR timer
    Period time : 0.004000250
    Skew : 65536 / 65536

or "system timer" in place of "HR timer".

I've also tried adding "lapic" to the kernel command line, which
resulted in the following in dmesg:

[    0.000000] Using APIC driver default
[    0.000000] Local APIC disabled by BIOS -- reenabling.
[    0.000000] Found and enabled local APIC!
[    0.000000] Kernel command line: BOOT_IMAGE=/vmlinuz-2.6.38-rc3-git4
root=UUID=96c96a61-8615-4715-86d0-09cb8c62638c ro lapic
kexec_jump_back_entry=0xff999999 kexec_jump_back_entry=0xf3b3f3b6
[    0.020674] Enabling APIC mode:  Flat.  Using 0 I/O APICs

and:

Switching to clocksource jiffies

and also tried a kernel with CONFIG_PREEMPT=y

In all cases, under sufficient load (which might be just running
aptitude -u), the tempo of the MIDI file play-back slows right down.

Any further suggestions welcome.

Arthur.

I did further git-bisecting after installing ALSA 1.0.24 and identified a problem commit:

commit 5a03b051ed87e72b959f32a86054e1142ac4cf55
Author: Andrea Arcangeli <aarcange@xxxxxxxxxx>
Date:   Thu Jan 13 15:47:11 2011 -0800

    thp: use compaction in kswapd for GFP_ATOMIC order > 0

    This takes advantage of memory compaction to properly generate pages of
    order > 0 if regular page reclaim fails and priority level becomes more
    severe and we don't reach the proper watermarks.

    Signed-off-by: Andrea Arcangeli <aarcange@xxxxxxxxxx>
    Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>

:040000 040000 d67655e822b77c982c0622b9f4fd747af45e4a3e 07b6d3365382d8d5f9afd7e2
56ec5439a0835b72 M      include
:040000 040000 307802493526b8b5555fe109a6e0654e24af7a84 48f409b4b07bc2c680f86a23
bdda7f5ced0fe436 M      mm

I ran git-bisect over the weekend, building and installing ALSA 1.0.24 with each kernel. After identifying the above commit, I rebuilt the 2.6 head with that commit reverted and verified that the problem was no longer present.

Andrea Archangeli provided a patch to the current Linux kernel git head that appears to fix this issue, z1 (attached).

Arthur.
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 17497d0..5718bca 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2385,7 +2385,6 @@ loop_again:
 		 * cause too much scanning of the lower zones.
 		 */
 		for (i = 0; i <= end_zone; i++) {
-			int compaction;
 			struct zone *zone = pgdat->node_zones + i;
 			int nr_slab;
 
@@ -2408,7 +2407,7 @@ loop_again:
 			 * zone has way too many pages free already.
 			 */
 			if (!zone_watermark_ok_safe(zone, order,
-					8*high_wmark_pages(zone), end_zone, 0))
+					high_wmark_pages(zone), end_zone, 0))
 				shrink_zone(priority, zone, &sc);
 			reclaim_state->reclaimed_slab = 0;
 			nr_slab = shrink_slab(sc.nr_scanned, GFP_KERNEL,
@@ -2416,24 +2415,23 @@ loop_again:
 			sc.nr_reclaimed += reclaim_state->reclaimed_slab;
 			total_scanned += sc.nr_scanned;
 
-			compaction = 0;
+#if 0
 			if (order &&
 			    zone_watermark_ok(zone, 0,
 					       high_wmark_pages(zone),
 					      end_zone, 0) &&
 			    !zone_watermark_ok(zone, order,
 					       high_wmark_pages(zone),
-					       end_zone, 0)) {
+					       end_zone, 0))
 				compact_zone_order(zone,
 						   order,
 						   sc.gfp_mask, false,
 						   COMPACT_MODE_KSWAPD);
-				compaction = 1;
-			}
+#endif
 
 			if (zone->all_unreclaimable)
 				continue;
-			if (!compaction && nr_slab == 0 &&
+			if (nr_slab == 0 &&
 			    !zone_reclaimable(zone))
 				zone->all_unreclaimable = 1;
 			/*
------------------------------------------------------------------------------
Index, Search & Analyze Logs and other IT data in Real-Time with Splunk 
Collect, index and harness all the fast moving IT data generated by your 
applications, servers and devices whether physical, virtual or in the cloud.
Deliver compliance at lower cost and gain new business insights. 
Free Software Download: http://p.sf.net/sfu/splunk-dev2dev
_______________________________________________
Alsa-user mailing list
Alsa-user@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-user

[Index of Archives]     [ALSA Devel]     [Linux Audio Users]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

  Powered by Linux