* 2.6.38+ hard lockup in pcm_lib.c
@ 2011-03-30 11:31 Kelly Anderson
2011-03-31 7:11 ` Clemens Ladisch
0 siblings, 1 reply; 2+ messages in thread
From: Kelly Anderson @ 2011-03-30 11:31 UTC (permalink / raw)
To: linux-kernel, linux-sound
I had a consistent hard-lockup on one of my machines, an Amd X6, just
after Kdm loaded the desktop (most certainly when it decides to start
talking to the sound card). Everything was dead, even ssh access to the
computer. I git bisected it until I found the commit that was causing
it. After reverting the patch everything is fine. This is the only one
of four computers that had the problem. Here's the revert patch (so I
can get some expert eyeballs looking at what may be the problem).
--- ./sound/core/pcm_lib.c.orig 2011-03-27 12:37:20.000000000 -0600
+++ ./sound/core/pcm_lib.c 2011-03-30 03:34:50.222400089 -0600
@@ -375,22 +375,6 @@ static int snd_pcm_update_hw_ptr0(struct
}
if (runtime->no_period_wakeup) {
- /*
- * Without regular period interrupts, we have to check
- * the elapsed time to detect xruns.
- */
- jdelta = jiffies - runtime->hw_ptr_jiffies;
- if (jdelta < runtime->hw_ptr_buffer_jiffies / 2)
- goto no_delta_check;
- hdelta = jdelta - delta * HZ / runtime->rate;
- while (hdelta > runtime->hw_ptr_buffer_jiffies / 2 + 1) {
- delta += runtime->buffer_size;
- hw_base += runtime->buffer_size;
- if (hw_base >= runtime->boundary)
- hw_base = 0;
- new_hw_ptr = hw_base + pos;
- hdelta -= runtime->hw_ptr_buffer_jiffies;
- }
goto no_delta_check;
}
59ff878ffb26bc0be812ca8295799164f413ae88 is the first bad commit
commit 59ff878ffb26bc0be812ca8295799164f413ae88
Author: Clemens Ladisch
Date: Thu Nov 18 09:43:52 2010 +0100
ALSA: pcm: detect xruns in no-period-wakeup mode
When period wakeups are disabled, successive calls to the pointer
update
function do not have a maximum allowed distance, so xruns cannot be
detected with the pointer value only.
To detect xruns, compare the actually elapsed time with the time that
should have theoretically elapsed since the last update. When the
hardware pointer has wrapped around due to an xrun, the actually
elapsed
time will be too big by about hw_ptr_buffer_jiffies.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
:040000 040000 5daac6baa3aaecbe4a030955a1cfe9714178019a
94f07701413dff5712c8fa5e60d93ef909864cc0 M sound
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: 2.6.38+ hard lockup in pcm_lib.c
2011-03-30 11:31 2.6.38+ hard lockup in pcm_lib.c Kelly Anderson
@ 2011-03-31 7:11 ` Clemens Ladisch
0 siblings, 0 replies; 2+ messages in thread
From: Clemens Ladisch @ 2011-03-31 7:11 UTC (permalink / raw)
To: Kelly Anderson; +Cc: linux-kernel, alsa-devel
Kelly Anderson wrote:
> I had a consistent hard-lockup on one of my machines, an Amd X6, just
> after Kdm loaded the desktop (most certainly when it decides to start
> talking to the sound card). Everything was dead, even ssh access to the
> computer. I git bisected it until I found the commit that was causing
> it. After reverting the patch everything is fine.
>
> commit 59ff878ffb26bc0be812ca8295799164f413ae88
> Author: Clemens Ladisch
> Date: Thu Nov 18 09:43:52 2010 +0100
>
> ALSA: pcm: detect xruns in no-period-wakeup mode
This looks as if you get an infinite loop, probably because
hw_ptr_buffer_jiffies is zero.
Please try this patch:
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -425,6 +425,8 @@ static int snd_pcm_hw_params(struct snd_
runtime->no_period_wakeup =
(params->info & SNDRV_PCM_INFO_NO_PERIOD_WAKEUP) &&
(params->flags & SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP);
+ runtime->hw_ptr_buffer_jiffies =
+ max(1uL, (runtime->buffer_size * HZ) / runtime->rate);
bits = snd_pcm_format_physical_width(runtime->format);
runtime->sample_bits = bits;
@@ -866,8 +868,6 @@ static void snd_pcm_post_start(struct sn
struct snd_pcm_runtime *runtime = substream->runtime;
snd_pcm_trigger_tstamp(substream);
runtime->hw_ptr_jiffies = jiffies;
- runtime->hw_ptr_buffer_jiffies = (runtime->buffer_size * HZ) /
- runtime->rate;
runtime->status->state = state;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
runtime->silence_size > 0)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-03-31 7:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-30 11:31 2.6.38+ hard lockup in pcm_lib.c Kelly Anderson
2011-03-31 7:11 ` Clemens Ladisch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox