[alsa-devel] [PATCH] RME HDSPM MADI lock fix
Jörn Nettingsmeier
nettings at stackingdwarves.net
Tue Jun 7 10:33:55 CEST 2011
On 06/06/2011 11:05 AM, Takashi Iwai wrote:
> At Sun, 05 Jun 2011 11:57:57 +0200,
> Jörn Nettingsmeier wrote:
>>
>> hi *!
>>
>> while we were trying to debug the midi-related xruns in the current
>> driver, i came across what looks like an unrelated locking bug to me:
>>
>> static int snd_hdspm_midi_input_read (struct hdspm_midi *hmidi)
>> ...
>> spin_lock_irqsave (&hmidi->lock, flags);<---------------
>> n_pending = snd_hdspm_midi_input_available (hmidi->hdspm,
>> hmidi->id);
>> ...
>> hmidi->pending = 0;
>>
>> hmidi->hdspm->control_register |= hmidi->ie;<------- !!!
>> hdspm_write(hmidi->hdspm, HDSPM_controlRegister,
>> hmidi->hdspm->control_register);
>>
>> spin_unlock_irqrestore (&hmidi->lock, flags);<---------
>> return snd_hdspm_midi_output_write (hmidi);
>> }
>>
>>
>> if i understand this whole business correctly, we should be holding the
>> hdspm lock here, not the hmidi one.
>>
>> please review the attached patch and apply if you think it's ok.
>
> Well, it's a wrong lock for snd_hdspm_midi_input_available().
> So you'll need to lock twice, either once unlock and lock another or
> nested. Re-locking would be less messy in this case, I suppose.
ok, here's a revised patch. has been running for 20 or so hours without
problems, although the load was light most of the time.
please consider for inclusion.
best,
jörn
--
Jörn Nettingsmeier
Lortzingstr. 11, 45128 Essen, Tel. +49 177 7937487
Meister für Veranstaltungstechnik (Bühne/Studio)
Tonmeister (VDT)
http://stackingdwarves.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hdspm-lock-fix.diff
Type: text/x-patch
Size: 612 bytes
Desc: not available
Url : http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20110607/538037ae/attachment.diff
More information about the Alsa-devel
mailing list