alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Vinod Koul <vinod.koul@intel.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org, broonie@kernel.org, lgirdwood@gmail.com
Subject: Re: [PATCH v3] ALSA: compress: fix drain calls blocking other compress functions
Date: Wed, 30 Oct 2013 21:03:54 +0530	[thread overview]
Message-ID: <20131030153354.GE18788@intel.com> (raw)
In-Reply-To: <s5h4n7yu3pv.wl%tiwai@suse.de>

On Wed, Oct 30, 2013 at 05:24:12PM +0100, Takashi Iwai wrote:
> At Wed, 30 Oct 2013 20:48:40 +0530,
> Vinod Koul wrote:
> > 
> > On Wed, Oct 30, 2013 at 05:01:38PM +0100, Takashi Iwai wrote:
> >  
> > > > > > +static int snd_compress_wait_for_drain(struct snd_compr_stream *stream)
> > > > > > +{
> > > > > > +	/*
> > > > > > +	 * We are called with lock held. So drop the lock while we wait for
> > > > > > +	 * drain complete notfication from the driver
> > > > > > +	 *
> > > > > > +	 * It is expected that driver will notify the drain completion and then
> > > > > > +	 * stream will be moved to SETUP state, even if draining resulted in an
> > > > > > +	 * error. We can trigger next track after this.
> > > > > > +	 */
> > > > > > +	stream->runtime->state = SNDRV_PCM_STATE_DRAINING;
> > > > > > +	mutex_unlock(&stream->device->lock);
> > > > > > +
> > > > > > +	wait_event(stream->runtime->wait, stream->runtime->drain_wake);
> > > > > 
> > > > > Don't you really want the interruption?
> > > > > Or use wait_event_interruptible() and return error appropriately.
> > > > any interruption from usermode should trigger the compress_stop/compress_free
> > > 
> > > ... but how?
> > > 
> > > > which will unblock this. I dont see the need to have interruptible here
> > > 
> > > Suppose you're running a single thread program.  Then who triggers the
> > > stop?
> > Your signal catcher which should be registered for signals intrested and then
> > calls stop or free. Assuming this should be considered single threaded. IIRC,
> > this is how you do in aplay, right?
> 
> No, issuing an ioctl in a signal isn't guaranteed to work at all.
Okay thanks for pointing out, do you know why we have that limitation. Btw
closing the fd should have same effect as free would trigger the stop internally

> You shouldn't code the kernel driver relying on that userspace
> behavior.
Ok, will update it

--
~Vinod

  reply	other threads:[~2013-10-30 16:28 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-23 16:17 [PATCH] ALSA: compress: fix drain calls blocking other compress functions Vinod Koul
2013-10-24  7:35 ` Vinod Koul
2013-10-24  9:25   ` Takashi Iwai
2013-10-24  9:27     ` Vinod Koul
2013-10-24 10:59       ` Takashi Iwai
2013-10-24 10:35         ` Vinod Koul
2013-10-24 12:00           ` Takashi Iwai
2013-10-24 11:08             ` Vinod Koul
2013-10-24 11:07   ` [PATCH v3] " Vinod Koul
2013-10-30 14:47     ` Takashi Iwai
2013-10-30 14:58       ` Vinod Koul
2013-10-30 16:01         ` Takashi Iwai
2013-10-30 15:18           ` Vinod Koul
2013-10-30 16:24             ` Takashi Iwai
2013-10-30 15:33               ` Vinod Koul [this message]
2013-10-30 16:38                 ` Takashi Iwai
2013-10-30 16:13     ` [PATCH v4] " Vinod Koul
2013-10-31  7:40       ` Takashi Iwai
2013-10-31  7:18         ` Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131030153354.GE18788@intel.com \
    --to=vinod.koul@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).