Bug 496119 - snd-intel8x0 has problems measuring ac97_clock
snd-intel8x0 has problems measuring ac97_clock
Product: Fedora
Classification: Fedora
Component: kernel (Show other bugs)
All Linux
low Severity medium
: ---
: ---
Assigned To: Jaroslav Kysela
Fedora Extras Quality Assurance
Depends On:
Blocks: F11Target
  Show dependency treegraph
Reported: 2009-04-16 14:22 EDT by Will Woods
Modified: 2010-06-28 07:51 EDT (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2010-06-28 07:51:50 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Output from "alsa-info.sh --no-upload" from "vanilla" Fedora 11 system. (17.04 KB, text/plain)
2009-06-16 06:27 EDT, Bob Hill
no flags Details

  None (edit)
Description Will Woods 2009-04-16 14:22:28 EDT
This has branched off from bug 472339 - see also bug 441087 from Fedora 9.

On my ThinkPad T43, snd-intel8x0 has trouble measuring the ac97_clock.

intel8x0_measure_ac97_clock: measured 50916 usecs
intel8x0: measured clock 216 rejected
intel8x0: clocking to 48000

kernel- (includes patches from alsa-kernel.git master):
ALSA sound/pci/ac97/ac97_codec.c:2127: AC'97 0 analog subsections not ready
intel8x0_measure_ac97_clock: measured 53245 usecs (11 samples)
intel8x0: measured clock 206 rejected
IBM TrackPoint firmware: 0x0e, buttons: 3/3
intel8x0_measure_ac97_clock: measured 50639 usecs (11 samples)
intel8x0: measured clock 217 rejected

This seems to occasionally result in messages like these (when xrun_debug is enabled):
ALSA sound/core/pcm_lib.c:337: hda_codec: hw_ptr skipping! (pos=0, delta=8587, period=16384, jdelta=9/194)
ALSA sound/core/pcm_lib.c:337: hda_codec: hw_ptr skipping! (pos=8192, delta=8193, period=16384, jdelta=0/185)
ALSA sound/core/pcm_lib.c:337: hda_codec: hw_ptr skipping! (pos=0, delta=8193, period=16384, jdelta=0/185)
Comment 1 Robin Green 2009-04-20 07:31:24 EDT
I am seeing this on rawhide kernel running inside VirtualBox 2.2.0 OSE on Mac OS X, where ALSA sound output is unusable (skips all the time), presumably because of this. This started happening when I upgraded my kernel.
Comment 2 Robin Green 2009-04-20 08:03:04 EDT
I tried with an older kernel which does not have audible sound problems, and that kernel also had trouble measuring the clock. So my issue may be unrelated.
Comment 3 Jaroslav Kysela 2009-04-21 09:57:00 EDT
It seems that hardware requires more delay before access, please, try this patch:

Comment 4 Will Woods 2009-04-21 15:09:37 EDT
That patch definitely seems to help with the ac97_clock measurement:

intel8x0_measure_ac97_clock: measured 50852 usecs (11 samples)
intel8x0: measured clock 216 rejected
intel8x0_measure_ac97_clock: measured 50959 usecs (2456 samples)
intel8x0: clocking to 48000

The hw_ptr messages and occasional sound stuttering persist. But if the clock measurement is now correct, then it isn't the cause of the hw_ptr skipping. Perhaps we need (another!) new bug for that.
Comment 5 Jaroslav Kysela 2009-04-28 07:26:47 EDT
The hw_ptr messages are really suspicious in this case.

Could you add some printk's to this portion of code in intel8x0.c?

        if (ptr1 != 0) {
                ptr1 <<= ichdev->pos_shift;
                ptr = ichdev->fragsize1 - ptr1;
                ptr += position;
                ichdev->last_pos = ptr;
                ichdev->last_pos_jiffies = jiffies;
        } else {
                ptr1 = jiffies - ichdev->last_pos_jiffies;
                if (ptr1)
                        ptr1 -= 1;
                ptr = ichdev->last_pos + ptr1 * ichdev->jiffy_to_bytes;

                printk("ptr1 = %u, last_pos = %u, jiffy_to_bytes = %u\n",
                             ptr1, ichdev->last_pos, ichdev->jiffy_to_bytes);

                ptr %= ichdev->size;

I don't see how final ptr can be zero in this code.
Comment 6 Bug Zapper 2009-06-09 09:56:58 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 11 development cycle.
Changing version to '11'.

More information and reason for this action is here:
Comment 7 Bob Hill 2009-06-16 04:13:06 EDT
This problem still occurs on Fedora 11 with kernel-

This problem appears to be the same as described in 441087 and 444316.

The same circumvention as described towards the ends of 441087 and 444316
also works on Fedora 11 with kernel-  (except that
the old file name  modprobe.conf.dist  is called  dist.conf  in Fedora 11).
Comment 8 Jaroslav Kysela 2009-06-16 04:37:24 EDT
Bob, attach output from 'alsa-info.sh --no-upload' script and post ALSA driver error/warning messages from 'dmesg' or '/var/log/messages'.
Comment 9 Bob Hill 2009-06-16 06:27:37 EDT
Created attachment 348078 [details]
Output from  "alsa-info.sh --no-upload"  from "vanilla" Fedora 11 system.

Jaroslav,  The circumvention  (from 441087 and 444316)  for this bug was
removed, and the system re-booted, before running "alsa-info.sh --no-upload",
so the attached file "alsa-info.txt" reflects a "vanilla" Fedora 11 system.

The error/warning messages  (without the circumvention)  are as follows:
   intel8x0_measure_ac97_clock: measured 50929 usecs
   intel8x0: measured clock 78 rejected
   intel8x0: clocking to 48000

Please also note that bugs 441087 and 444316 were fixed in Fedora 10 by
kernel-  The bug has re-appeared in Fedora 11.
Comment 10 Josep 2009-07-14 04:34:03 EDT
I'm seeing the same problem since yesterday, when I upgraded the system which included alsa-plugins-pulseaudio-1.0.20-2.fc11.i58 (I don't know if it is related).
That playback is faster than it should (a 4:14 minutes song played in 3:57).

According to the logs, earlier kernels set ac97_clock to 
intel8x0: clocking to 48000
but yesterday it was set to
intel8x0: clocking to 51548

Forcing ac97_clock=48000, as described in #441087, fixes the problem here.
Comment 11 Bob Hill 2009-09-07 11:12:41 EDT
On my system, this problem seems to have been improved by  (or at least
affected by)  kernel-PAE-  dmesg now shows:

     intel8x0_measure_ac97_clock: measured 50888 usecs (4 samples)
     intel8x0: measured clock 78 rejected
     intel8x0_measure_ac97_clock: measured 50948 usecs (2852 samples)
     intel8x0: clocking to 41159

While these messages do not seem to be quite 100% kosher, YouTube videos
do now play at the correct speed, whereas they played too fast before.

(Btw, is it conceivable that this improvement might be a by-product of the
 fix for bug 506075, which was built into the above-mentioned kernel?)
Comment 12 Bob Hill 2009-09-07 11:15:40 EDT
Very sorry, the kernel in the previous comment is a typographical error.
It should have read  kernel-PAE-, which is new.
Very sorry for the confusion.
Comment 13 Bob Hill 2009-10-01 12:59:10 EDT
Further to Comment #11 and Comment #12, kernel-PAE-
shows further improvement  (compared to kernel-PAE-

     intel8x0_measure_ac97_clock: measured 50429 usecs (2824 samples)
     intel8x0: clocking to 41143

(Now just these two messages, instead of the four messages produced by
kernel-PAE-, which appeared to take two attempts.)

As far as my system is concerned, this Bug is fixed, and could be closed.
Comment 14 Bug Zapper 2010-04-27 09:42:34 EDT
This message is a reminder that Fedora 11 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 11.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '11'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 11's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 11 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
Comment 15 Bug Zapper 2010-06-28 07:51:50 EDT
Fedora 11 changed to end-of-life (EOL) status on 2010-06-25. Fedora 11 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.