Re: OMAP1 realtime patch

Kevin Hilman
2007-02-12T19:32:56Z

[-- Attachment #1: Type: text/plain, Size: 1680 bytes --]

On Mon, 2007-02-12 at 11:24 -0800, Kevin Hilman wrote:
> On Sun, 2007-02-11 at 18:01 +0100, Dirk Behme wrote:
> > Dirk Behme wrote:
> > > Kevin Hilman wrote:
> > >
> > >> Here is a patch which leaves out the raw_spinlock conversions. It goes
> > >> on the OMAP git tree on top of -rt5 (ignoring conflicts.) I've left out
> > >> all the raw_spinlock conversions. This has been tested on an
> > >> OMAP1623/H2 platform.
> > >
> > > Update of Kevins update. Tested on OSK.
> > >
> > > Changes:
> > >
> > > - Remove kernel/printk.c "+ zap_rt_locks();". It's already in -rt5.
> > >
> > > - Re-add HRTIMER conversion to ads7846.c
> > >
> > > With this patch I get Oops below after playing mp3 via NFS. Add
> > > raw_spinlock_t to sound/arm/omap/omap-alsa-dma.c like in my original
> > > patch doesn't seem to help.
> >
> > Re-adding raw_spinlock_t to omap-alsa.h helps against this Oops.
>
> My guess the oops you sent is that you saw this crash when doing a
> Ctrl-C or otherwise stopping the playback, correct?
>
> This oops is triggered by the same thread trying to take the same
> spinlock (now an rt_mutex under PREEMPT_RT.) The following patch
> fixes the nested spinlocks, and removes the raw_spinlock. It applies
> on top of your latest patch.
>
> On my OSK, I do notice however that using -rt (with and without this
> fix) mp3 playback has some audible noise under PREEMPT_RT. Do you hear
> this too?

This time with the patch.

Another data point... I only hear the noise when using mpg123 to play
an .mp3 file. If I use aplay to play a .wav file, I'm not hearing any
noise. I can even ping flood the target and audio plays without
problems.

Kevin

[-- Attachment #2: omap-alsa-rt.patch --]
[-- Type: text/x-patch, Size: 1331 bytes --]

Index: dev/include/asm-arm/arch-omap/omap-alsa.h
===================================================================
--- dev.orig/include/asm-arm/arch-omap/omap-alsa.h
+++ dev/include/asm-arm/arch-omap/omap-alsa.h
@@ -83,7 +83,7 @@ struct audio_stream {
int active:1; /* we are using this stream for transfer now */
int period; /* current transfer period */
int periods; /* current count of periods registerd in the DMA engine */
- raw_spinlock_t dma_lock; /* for locking in DMA operations */
+ spinlock_t dma_lock; /* for locking in DMA operations */
snd_pcm_substream_t *stream; /* the pcm stream */
unsigned linked:1; /* dma channels linked */
int offset; /* store start position of the last period in the alsa buffer */
Index: dev/sound/arm/omap/omap-alsa.c
===================================================================
--- dev.orig/sound/arm/omap/omap-alsa.c
+++ dev/sound/arm/omap/omap-alsa.c
@@ -167,7 +167,6 @@ static void audio_stop_dma(struct audio_
unsigned long flags;
ADEBUG();

- spin_lock_irqsave(&s->dma_lock, flags);
s->active = 0;
s->period = 0;
s->periods = 0;
@@ -176,8 +175,6 @@ static void audio_stop_dma(struct audio_
omap_stop_alsa_sound_dma(s);

omap_clear_alsa_sound_dma(s);
-
- spin_unlock_irqrestore(&s->dma_lock, flags);