* [PATCH]removes unneeded spin_lock_irqsave()s from snd-es1968
@ 2004-11-02 23:50 Karsten Wiese
2004-11-09 9:21 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Karsten Wiese @ 2004-11-02 23:50 UTC (permalink / raw)
To: Takashi Iwai, Jaroslav Kysela; +Cc: alsa-devel
[-- Attachment #1: Type: text/plain, Size: 1099 bytes --]
Found this while testing Ingo Molnars realtime patches for 2.6.9.
Without the patch on a realtime enabled kernel, insmod gets stuck and never returns.
Please check the assumptions made below and correct me, if I'm wrong ;-)
Karsten
=======================================================
Summary: removes unneeded spin_lock_irqsave()s from snd-es1968
spin_lock_irqsave(&chip->reg_lock) was called a second time in sequence from
snd_es1968_bob_start() called from es1968_measure_clock().
While this didn't cause harm on my UP laptop with mainline kernels,
it made "insmod snd-es1968" hang on kernel 2.6.9-mm1-RT-V0.6.9.
The patch assumes that 2 callpaths don't need explicit spinlock protection:
1: The trigger callback, because it is called with IRQs disabled.
2. PM's suspend/resume callbacks, because those are called while ortdinary user processes are frozen.
Thus the spin_lock_irqsave(&chip->reg_lock) calls in snd_es1968_bob_start() / snd_es1968_bob_stop()
are not needed.
Signed-off-by: Karsten Wiese <annabellesgarden@yahoo.de>
=======================================================
[-- Attachment #2: snd-es1968.patch --]
[-- Type: text/x-diff, Size: 1186 bytes --]
--- sound/pci/es1968.c~ 2004-11-02 23:51:56.504888304 +0100
+++ sound/pci/es1968.c 2004-11-02 23:51:12.375596976 +0100
@@ -837,23 +837,19 @@
static void snd_es1968_bob_stop(es1968_t *chip)
{
u16 reg;
- unsigned long flags;
- spin_lock_irqsave(&chip->reg_lock, flags);
reg = __maestro_read(chip, 0x11);
reg &= ~ESM_BOB_ENABLE;
__maestro_write(chip, 0x11, reg);
reg = __maestro_read(chip, 0x17);
reg &= ~ESM_BOB_START;
__maestro_write(chip, 0x17, reg);
- spin_unlock_irqrestore(&chip->reg_lock, flags);
}
static void snd_es1968_bob_start(es1968_t *chip)
{
int prescale;
int divide;
- unsigned long flags;
/* compute ideal interrupt frequency for buffer size & play rate */
/* first, find best prescaler value to match freq */
@@ -882,13 +878,11 @@
} else if (divide > 1)
divide--;
- spin_lock_irqsave(&chip->reg_lock, flags);
__maestro_write(chip, 6, 0x9000 | (prescale << 5) | divide); /* set reg */
/* Now set IDR 11/17 */
__maestro_write(chip, 0x11, __maestro_read(chip, 0x11) | 1);
__maestro_write(chip, 0x17, __maestro_read(chip, 0x17) | 1);
- spin_unlock_irqrestore(&chip->reg_lock, flags);
}
/* call with substream spinlock */
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-11-09 9:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-02 23:50 [PATCH]removes unneeded spin_lock_irqsave()s from snd-es1968 Karsten Wiese
2004-11-09 9:21 ` Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.