alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: pl bossart <bossart.nospam@gmail.com>
To: Jaroslav Kysela <perex@perex.cz>
Cc: ALSA development <alsa-devel@alsa-project.org>,
	Lennart Poettering <lennart@poettering.net>
Subject: Re: Duplicate wake-ups in pcm_lib.c
Date: Wed, 6 Jan 2010 22:59:22 -0600	[thread overview]
Message-ID: <6160a5131001062059i1ef74831p4210987579feb759@mail.gmail.com> (raw)
In-Reply-To: <alpine.LNX.2.00.0912240922460.2598@eeebox2.perex-int.cz>

>> A wake-up is generated during the period interrupt, and a second
>> wake-up is generated during the write loop, after the application was
>> awaken but just before the pointers are updated. This second wake-up
>> shouldn't exist, since the write loop actually fills the ring buffer.
>> By the time the second wake-up is actually handled, there's really no
>> space left in the buffer and a null event is generated; it'll wake-up
>> the application a second time for nothing. Maybe we should move the
>> call to snd_pcm_update_hw_ptr() after the transfer took place?
>
> The right fix should be to preserve wakeups when write operation is in
> progress (also for interrupts). Something like this (untested):

Thanks Jaroslav for your feedback. It seems your fix is similar to
what I suggested, that is check the pointers and generate a wake-up
after the write loop completes rather than right before the write
starts. I modified your patch to correct the behavior when errors
occur; the jumps to _end_wake compared to _end_unlock weren't self
explanatory and not always consistent. I only perform a pointer update
if nothing wrong happened. In case of errors, I unlock or just return
the status as before. I am testing the changes and should have a patch
shortly.
Cheers
- Pierre

  parent reply	other threads:[~2010-01-07  4:59 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-23 20:28 Duplicate wake-ups in pcm_lib.c pl bossart
2009-12-24  8:43 ` Jaroslav Kysela
2009-12-25  6:59   ` Raymond Yau
2010-01-07  4:59   ` pl bossart [this message]
2010-01-07 14:59     ` Jaroslav Kysela
2010-01-11  4:11       ` Raymond Yau
2010-01-11  7:18         ` Jaroslav Kysela
2010-01-13  6:58           ` Raymond Yau
2010-01-13  7:20             ` Jaroslav Kysela
2010-01-20  7:38               ` Raymond Yau
2010-01-20 10:42                 ` Jaroslav Kysela
2010-01-26  7:25                   ` Raymond Yau
2010-01-26  8:23                     ` Jaroslav Kysela
2010-01-11 18:36       ` pl bossart
2010-01-11 18:45         ` pl bossart
2010-01-11 18:54           ` Jaroslav Kysela
2010-01-11 18:51         ` Jaroslav Kysela
2010-01-11 20:46           ` pl bossart
2010-01-12 11:15             ` Jaroslav Kysela
2010-01-18 18:32       ` Colin Guthrie
2010-01-18 21:39         ` Jaroslav Kysela
2010-01-20  1:24           ` Colin Guthrie
2010-01-20 15:12             ` Colin Guthrie
2010-01-25 11:52               ` Colin Guthrie
2010-01-27 10:46                 ` Colin Guthrie

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=6160a5131001062059i1ef74831p4210987579feb759@mail.gmail.com \
    --to=bossart.nospam@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=lennart@poettering.net \
    --cc=perex@perex.cz \
    /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).