提交 b1d4f7f4 编写于 作者: C Clemens Ladisch 提交者: Takashi Iwai

ALSA: hrtimer: handle delayed timer interrupts

If a timer interrupt was delayed too much, hrtimer_forward_now() will
forward the timer expiry more than once.  When this happens, the
additional number of elapsed ALSA timer ticks must be passed to
snd_timer_interrupt() to prevent the ALSA timer from falling behind.

This mostly fixes MIDI slowdown problems on highly-loaded systems with
badly behaved interrupt handlers.
Signed-off-by: NClemens Ladisch <clemens@ladisch.de>
Reported-and-tested-by: NArthur Marsh <arthur.marsh@internode.on.net>
Cc: <stable@kernel.org>
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
上级 a6c47a85
...@@ -45,12 +45,13 @@ static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *hrt) ...@@ -45,12 +45,13 @@ static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *hrt)
{ {
struct snd_hrtimer *stime = container_of(hrt, struct snd_hrtimer, hrt); struct snd_hrtimer *stime = container_of(hrt, struct snd_hrtimer, hrt);
struct snd_timer *t = stime->timer; struct snd_timer *t = stime->timer;
unsigned long oruns;
if (!atomic_read(&stime->running)) if (!atomic_read(&stime->running))
return HRTIMER_NORESTART; return HRTIMER_NORESTART;
hrtimer_forward_now(hrt, ns_to_ktime(t->sticks * resolution)); oruns = hrtimer_forward_now(hrt, ns_to_ktime(t->sticks * resolution));
snd_timer_interrupt(stime->timer, t->sticks); snd_timer_interrupt(stime->timer, t->sticks * oruns);
if (!atomic_read(&stime->running)) if (!atomic_read(&stime->running))
return HRTIMER_NORESTART; return HRTIMER_NORESTART;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册