Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Clive Messer <clive@vacuumtube.org.uk>
Cc: alsa-devel@alsa-project.org, Lennart Poettering <mznyfn@0pointer.de>
Subject: Re: Timer instability
Date: Mon, 09 Mar 2009 14:09:12 +0100	[thread overview]
Message-ID: <s5hbpsaderr.wl%tiwai@suse.de> (raw)
In-Reply-To: <s5hfxhn7xik.wl%tiwai@suse.de>

At Mon, 09 Mar 2009 12:20:51 +0100,
I wrote:
> 
> At Mon, 9 Mar 2009 11:13:21 +0000,
> Clive Messer wrote:
> > 
> > On Tuesday 03 Mar 2009 17:41:22 Takashi Iwai wrote:
> > 
> > > > Hrm, but still an unexpected jump is found.
> > > >
> > > > If you build the driver with CONFIG_SND_PCM_XRUN_DEBUG=y, you must
> > > > have /proc/asound/card0/pcm0p/xrun_debug.  Echo 1 to this (as root)
> > > > 	echo 1 > /proc/asound/card0/pcm0p/xrun_debug
> > > > and try the program, see whether any debug message appears.
> > > > If any message appears, it means basically an unstable hardware.
> > > >
> > > > Also, the below is a patch I tried to clean up and improve the
> > > > handling.  Give it a try (and do echo 1 above for testing).
> > >
> > > BTW, the original test program is very hard to see what's wrong
> > > because it spews out way too many lines.  The below is a filtered-out
> > > version.
> > >
> > > It prints only unexpected jumps of avail values (the threshold is
> > > set 100 blindly).  The output is like below:
> > >
> > > 	% ./alsa-time-test hw
> > > 	21720872	(4987)	delta 216	avail 216	delay 4200
> > > 	21943118	(65)	delta 208	avail 208	delay 4208
> > > 	23752310	(3)	delta 232	avail 232	delay 4184
> > > 	23761847	(5972)	delta 264	avail 264	delay 4152
> > >
> > > The first column is the usec from the program start, the next value in
> > > parentheses is the time-step from the last time of status changes,
> > > the delta is the increase of avail, and the rest are raw values.
> > >
> > > If a too large delta appears in a short time-step, something is wrong.
> > > If it appears in a large time-step, it's simply a wrong responsiveness
> > > (aka system latency).
> > 
> > Hello Takashi/Lennart,
> > 
> > Sorry, I have been busy for a few days.
> > I patched my kernel (kernel-2.6.29-0.53.rc7.fc10.x86_64) with your pcm_lib.c 
> > patch and 'echo 1 > /proc/asound/card0/pcm0p/xrun_debug'.
> > 
> > I have done several runs with the new alsa-time-test.c code. Typically I get a 
> > bunch of kernel dmesg when I start the alsa-time-test program but not 
> > afterwards. Just a reminder - I'm running this on fast hardware - X58 / Core 
> > i7 920 - the machine is not loaded at all, so latency should be very low. 
> > snd_hda_intel - ' 00-00: AD198x Analog : AD198x Analog : playback 1 : capture 
> > 3'.
> > 
> > Here is an example run .....
> > 
> > hw_ptr skipping! (pos=2096, delta=2096, period=1472)
> > hw_ptr skipping! (pos=2096, delta=2096, period=1472)
> > hw_ptr skipping! (pos=3600, delta=3600, period=1472)
> > hw_ptr skipping! (pos=3600, delta=3600, period=1472)
> > hw_ptr skipping! (pos=3600, delta=3600, period=1472)
> > hw_ptr skipping! (pos=3600, delta=3600, period=1472)
> > hw_ptr skipping! (pos=3600, delta=3600, period=1472)
> > hw_ptr skipping! (pos=3600, delta=3600, period=1472)
> 
> Thanks.  This implies that the position pointer once reads zero
> then the next value gets screwed up.  It shows the DMA pointer
> read is pretty unreliable on your hardware.  It's obviously bad for
> PA because the DMA pointer is the only trusted information for
> glitch-free.  For the traditional method, this isn't usually so
> critical, though.
> 
> > 9901323          (2632)  delta 111       avail 117       delay 4299
> > 19901290        (2599)  delta 112       avail 112       delay 4304
> > 29901285        (3)     delta 112       avail 112       delay 4304
> > 39901315        (2624)  delta 120       avail 120       delay 4296
> > 49901317        (2626)  delta 112       avail 112       delay 4304
> > 59901317        (2625)  delta 112       avail 112       delay 4304
> > 69901323        (2632)  delta 118       avail 118       delay 4298
> > 79901391        (3)     delta 120       avail 120       delay 4296
> > 89901327        (2634)  delta 112       avail 112       delay 4304
> > 99901283        (2591)  delta 120       avail 120       delay 4296
> > 109901334       (2642)  delta 120       avail 120       delay 4296
> > 119901320       (2627)  delta 112       avail 112       delay 4304
> 
> These outputs look fairly OK.  The latency is about 2.5 ms and it's
> about 110 samples.  That us, as long as the outputs look like above,
> your system is working fine with my patch.

As the patch seems working with other tests, too, I merged it
(with a slight clean-up) into sound git tree now.


Takashi

  reply	other threads:[~2009-03-09 13:09 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-19  2:46 Timer instability Lennart Poettering
2009-02-19  6:52 ` Takashi Iwai
2009-02-20  1:22   ` Lennart Poettering
2009-02-20  1:26     ` Lennart Poettering
2009-02-20  1:50     ` Lennart Poettering
2009-02-20  7:26     ` Takashi Iwai
2009-02-20 20:34       ` Lennart Poettering
2009-02-21 16:36         ` Takashi Iwai
2009-02-22  3:14           ` Lennart Poettering
2009-02-23  2:42             ` Lennart Poettering
2009-02-23  2:56               ` Lennart Poettering
2009-02-23 19:20                 ` Lennart Poettering
2009-02-23 19:24                   ` Colin Guthrie
2009-02-24  3:21                   ` Lennart Poettering
2009-02-23  7:47             ` Takashi Iwai
2009-02-24 16:27             ` Takashi Iwai
2009-02-24 18:46               ` Lennart Poettering
2009-02-24 18:59                 ` Takashi Iwai
2009-02-24 19:04                   ` Jaroslav Kysela
2009-02-24 19:26                   ` Lennart Poettering
2009-02-24 20:37                     ` Takashi Iwai
2009-02-25 10:08                       ` Takashi Iwai
2009-02-25 10:22                         ` Takashi Iwai
2009-02-25 12:34                           ` Clive Messer
2009-02-25 13:36                             ` Takashi Iwai
2009-02-25 15:11                               ` Clive Messer
2009-02-25 15:51                                 ` Takashi Iwai
2009-02-25 16:24                                   ` Clive Messer
2009-02-25 16:39                                     ` Takashi Iwai
     [not found]                                       ` <200902251656.47813.clive@vacuumtube.org.uk>
2009-02-25 16:59                                         ` Takashi Iwai
2009-02-25 17:36                                           ` Clive Messer
2009-02-25 18:13                                             ` Takashi Iwai
2009-02-25 18:16                                               ` Clive Messer
2009-02-25 18:34                                               ` Clive Messer
2009-03-03 16:05                                                 ` Takashi Iwai
2009-03-03 17:41                                                   ` Takashi Iwai
2009-03-09 11:13                                                     ` Clive Messer
2009-03-09 11:20                                                       ` Takashi Iwai
2009-03-09 13:09                                                         ` Takashi Iwai [this message]
2009-02-25 15:04                             ` Takashi Iwai
2009-02-25 10:44                         ` Lennart Poettering
2009-02-24 21:16                     ` Lennart Poettering
2009-02-25 10:48                       ` Takashi Iwai
2009-02-25 10:57                         ` Jaroslav Kysela
2009-02-25 11:04                           ` Takashi Iwai
2009-02-25 11:10                             ` Jaroslav Kysela
2009-02-25 11:17                               ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hbpsaderr.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=clive@vacuumtube.org.uk \
    --cc=mznyfn@0pointer.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox