Bug 496119

Summary: snd-intel8x0 has problems measuring ac97_clock
Product: [Fedora] Fedora Reporter: Will Woods <wwoods>
Component: kernelAssignee: Jaroslav Kysela <jkysela>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 11CC: gene-redhat, greenrd, itamar, james, jkysela, josep.puigdemont, kernel-maint, mishu, mwc
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-06-28 11:51:50 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 446451    
Attachments:
Description Flags
Output from "alsa-info.sh --no-upload" from "vanilla" Fedora 11 system. none

Description Will Woods 2009-04-16 18:22:28 UTC
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.

kernel-2.6.29.1-70.fc11:
intel8x0_measure_ac97_clock: measured 50916 usecs
intel8x0: measured clock 216 rejected
intel8x0: clocking to 48000

kernel-2.6.29.1-83.ww1: (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 11:31:24 UTC
I am seeing this on rawhide kernel 2.6.29.1-100.fc11.i586 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 12:03:04 UTC
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 13:57:00 UTC
It seems that hardware requires more delay before access, please, try this patch:

http://git.alsa-project.org/?p=alsa-kmirror.git;a=commitdiff;h=0209d72d70ffd7405d6f1b0036fed5e84c6cc9fe

Comment 4 Will Woods 2009-04-21 19:09:37 UTC
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 11:26:47 UTC
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 13:56:58 UTC
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:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 7 Bob Hill 2009-06-16 08:13:06 UTC
This problem still occurs on Fedora 11 with kernel-2.6.29.4-167.fc11.i586.

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-2.6.29.4-167.fc11.i586  (except that
the old file name  modprobe.conf.dist  is called  dist.conf  in Fedora 11).

Comment 8 Jaroslav Kysela 2009-06-16 08:37:24 UTC
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 10:27:37 UTC
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-2.6.27.12-170.2.5.fc10.i686.  The bug has re-appeared in Fedora 11.

Comment 10 Josep 2009-07-14 08:34:03 UTC
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 15:12:41 UTC
On my system, this problem seems to have been improved by  (or at least
affected by)  kernel-PAE-2.6.29.5-191.fc11.i686.  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 15:15:40 UTC
Very sorry, the kernel in the previous comment is a typographical error.
It should have read  kernel-PAE-2.6.30.5-43.fc11.i686, which is new.
Very sorry for the confusion.

Comment 13 Bob Hill 2009-10-01 16:59:10 UTC
Further to Comment #11 and Comment #12, kernel-PAE-2.6.30.8-64.fc11.i686
shows further improvement  (compared to kernel-PAE-2.6.30.5-43.fc11.i686):

     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-2.6.30.5-43.fc11.i686, 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 13:42:34 UTC
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: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 15 Bug Zapper 2010-06-28 11:51:50 UTC
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.