[Pkg-alsa-devel] Bug#560212: alsa-source: Driver snd-hrtimer - causing system freeze with Rosegarden

wzabolot@elektron.elka.pw.edu.pl W.Zabolotny at elka.pw.edu.pl
Wed Dec 9 19:27:26 UTC 2009


Package: alsa-source
Version: 1.0.21+dfsg-2
Severity: important

*** Please type your report below this line ***

When I try to use the "HR timer" as a MIDI sequencer timer in the
Rosegarden (http://www.rosegardenmusic.com) application, the system
freezes. Another people also reported similar problems with other
sequencer - OpenOctave (
https://linuxmusicians.com/viewtopic.php?f=27&p=8917 )

I have tested the problem on two SMP machines with diffrent kernels
(2.6.30, 2.6.31.6, 2.6.32).
The problem seems to be associated with the "snd-hrtimer" module.
I've tried to run the application vie remote X session, while having the
text console active.
Before the machine froze, the following messages have been displayed in
the console:

System 1 (Intel(R) Pentium(R) 4 CPU 2.80GHz HT)

hrtimer: interrupt too slow, forcing clock min delta to 3568 ns

System 2 (Intel(R) Core(TM)2 CPU         T5500  @ 1.66GHz)
hrtimer: interrupt too slow, forcing clock min delta to 11103 ns
CE: hpet increasing min_delta_ns to 15000 nsec
CE: hpet increasing min_delta_ns to 22500 nsec
CE: hpet increasing min_delta_ns to 33750 nsec

Analyzing the problem, I had an idea, that maybe the snd-hrtimer should
be rewritten to call
the callback via tasklet (I attach my patch only as an ilustration, my
code doesn't work either),
 however then I got the message "BUG: scheduling while atomic" or
something like this
 from the snd_hrtimer_stop function called from _snd_timer_stop.
Therefore I've tried to investigate the snd_hrtimer_stop more thoroughly.

Looking further into the code, I have found, that snd_hrtimer_stop may
be called
from the callback routine (e.g.:
http://lxr.linux.no/linux+v2.6.32/sound/core/timer.c#L709 or
http://lxr.linux.no/linux+v2.6.32/sound/core/timer.c#L719 )

It seems to me, that calling hrtimer_cancel (in the original code),
which waits for the handler to finish,
from that handler  may lock the machine...
(snd_hrtimer_callback calls the snd_timer_interrupt:
http://lxr.linux.no/linux+v2.6.32/sound/core/hrtimer.c#L47
which in turn calls snd_hrtimer_stop (as above) which calls hrtimer_cancel).


Unfortunately currently I have no idea how to fix this problem. Maybe
snd_hrtimer_stop shouldn't try to cancel the timer,
instead setting a flag causing callback to return immediately without
rearming of the timer?

Wojtek Zabolotny
wzab at ise.pw.edu.pl

PS. The above bug has been also reported to LKML

-- Package-specific info:
--- Begin additional package status ---
Desired=Unknown/Install/Remove/Purge/Hold
|
Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version        Description
+++-==============-==============-============================================
ii  alsa-base      1.0.21+dfsg-2  ALSA driver configuration files
ii  libasound2     1.0.21a-1      shared library for ALSA applications
--- End additional package status ---
--- Begin /proc/asound/version ---
Advanced Linux Sound Architecture Driver Version 1.0.20.
--- End /proc/asound/version ---
--- Begin /proc/asound/cards ---
 0 [ICH5           ]: ICH4 - Intel ICH5
                      Intel ICH5 with AD1985 at irq 17
 1 [UGM96          ]: USB-Audio - UGM96
                      EGOSYS, Inc. UGM96 at usb-0000:00:1d.2-2, full speed
 2 [Xboard49       ]: USB-Audio - E-MU Xboard49
                      E-MU Systems, Inc. E-MU Xboard49 at
usb-0000:00:1d.0-1.1, full speed
--- End /proc/asound/cards ---
--- Begin /dev/snd/ listing ---
total 0
drwxr-xr-x 2 root root       80 Dec  9 16:55 by-id
drwxr-xr-x 2 root root      100 Dec  9 16:55 by-path
crw-rw---- 1 root audio 116, 10 Dec  9 16:55 controlC0
crw-rw---- 1 root audio 116, 13 Dec  9 16:55 controlC1
crw-rw---- 1 root audio 116, 15 Dec  9 16:55 controlC2
crw-rw---- 1 root audio 116, 14 Dec  9 16:55 midiC2D0
crw-rw---- 1 root audio 116,  9 Dec  9 16:58 pcmC0D0c
crw-rw---- 1 root audio 116,  8 Dec  9 16:58 pcmC0D0p
crw-rw---- 1 root audio 116,  7 Dec  9 16:55 pcmC0D1c
crw-rw---- 1 root audio 116,  6 Dec  9 16:55 pcmC0D2c
crw-rw---- 1 root audio 116,  5 Dec  9 16:55 pcmC0D3c
crw-rw---- 1 root audio 116,  4 Dec  9 16:58 pcmC0D4p
crw-rw---- 1 root audio 116, 12 Dec  9 16:58 pcmC1D0c
crw-rw---- 1 root audio 116, 11 Dec  9 16:58 pcmC1D0p
crw-rw---- 1 root audio 116,  3 Dec  9 16:55 seq
crw-rw---- 1 root audio 116,  2 Dec  9 16:55 timer
--- End /dev/snd/ listing ---

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (990, 'testing'), (100, 'stable'), (50, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.31.6.media (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=pl_PL.UTF-8, LC_CTYPE=pl_PL.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages alsa-source depends on:
ii  bzip2                         1.0.5-3    high-quality block-sorting
file co
ii  debconf [debconf-2.0]         1.5.28     Debian configuration
management sy
ii  debconf-utils                 1.5.28     debconf utilities
ii  debhelper                     7.4.3      helper programs for
debian/rules
ii  dpkg-dev                      1.15.5.3   Debian package development
tools
ii  gcc [c-compiler]              4:4.3.4-1  The GNU C compiler
ii  gcc-4.1 [c-compiler]          4.1.2-27   The GNU C compiler
ii  gcc-4.2 [c-compiler]          4.2.4-6    The GNU C compiler
ii  gcc-4.3 [c-compiler]          4.3.4-6    The GNU C compiler
ii  make                          3.81-7     An utility for Directing
compilati

Versions of packages alsa-source recommends:
ii  fakeroot                     1.14.4-1    Gives a fake root environment
ii  kernel-package               12.031      A utility for building
Linux kerne
ii  linux-headers-2.6.31 [linux- 10:wzab.1.0 Header files related to
Linux kern
ii  linux-headers-2.6.31.4 [linu 10:wzab.1.0 Header files related to
Linux kern
ii  linux-headers-2.6.31.6 [linu 10:wzab.1.0 Header files related to
Linux kern
ii  linux-headers-2.6.31.6.media 10:wzab.1.0 Header files related to
Linux kern
ii  module-assistant             0.11.1      tool to make module package
creati

alsa-source suggests no packages.

Versions of packages alsa-base depends on:
ii  linux-sound-base           1.0.21+dfsg-2 base package for ALSA and
OSS soun
ii  lsof                       4.81.dfsg.1-1 List open files
ii  module-init-tools          3.11-1        tools for managing Linux
kernel mo
ii  udev                       146-5         /dev/ and hotplug
management daemo

Versions of packages libasound2 depends on:
ii  libc6                         2.10.2-2   GNU C Library: Shared libraries

-- debconf information:
  alsa-source/cards_to_be_built: all
  alsa-source/debug: false
  alsa-source/cards:
  alsa-source/has_pnp: true
  alsa-source/cards_with_descriptions:





More information about the Pkg-alsa-devel mailing list