From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: snd_pcsp locking mess Date: Tue, 21 Oct 2008 09:16:43 +0200 Message-ID: References: <20080518172258.D0DFB108060@picon.linux-foundation.org> <4830737B.70108@aknet.ru> <4831B260.1060802@aknet.ru> <4835D774.3070306@aknet.ru> <483C10E7.7070203@aknet.ru> <48AD21EF.8010906@aknet.ru> <48AD42A0.9030509@aknet.ru> <48FCFD7D.6000001@aknet.ru> <48FD7FE1.8000909@aknet.ru> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 33BFF2473C for ; Tue, 21 Oct 2008 09:17:01 +0200 (CEST) In-Reply-To: <48FD7FE1.8000909@aknet.ru> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Stas Sergeev Cc: ALSA devel List-Id: alsa-devel@alsa-project.org At Tue, 21 Oct 2008 11:08:17 +0400, Stas Sergeev wrote: > > Hi. > > Takashi Iwai wrote: > > The PCM status is changed immediately after calling trigger(async) > > callback XRUN or SETUP. That is, you can start the stream again soon > > after snd_pcm_stop(). In the case of async operation, the hardware > > may be likely still running, but the PCM core doesn't know about it > > and allows you to restart the stream. So it's racy, at least from the > > PCM core viewpoint. > OK but how does _my patch_ affects this? No, your patch does essentially NOTHING by itself. However... > Before, the trigger() callback was called > both synchronously and asynchronously. My > patch only provides the callback to make > it possible to separate the sync and async > parts. It doesn't do anything more. It > doesn't change anything at all. So how > could exactly that patch introduce the race > you mentioned? There was already an async > invocation of trigger() callback. I wanted > to add just a callback under different name > for that. What could my patch possibly > change? How does it _introduce_ the race? Because the async trigger itself can be racy easily, there is no merit to add a common callback until we have a proper handling of delayed triggers in the PCM core side. Takashi