From: Vinod Koul <vinod.koul@intel.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org, clemens@ladisch.de,
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
Takashi Sakamoto <o-takashi@sakamocchi.jp>,
ffado-devel@lists.sf.net,
"Subhransu S . Prusty" <subhransu.s.prusty@intel.com>
Subject: Re: [PATCH 1/2] ALSA: firewire: process packets in 'struct snd_pcm_ops.ack' callback
Date: Fri, 9 Jun 2017 09:12:31 +0530 [thread overview]
Message-ID: <20170609034231.GS2885@localhost> (raw)
In-Reply-To: <s5hvao7337g.wl-tiwai@suse.de>
On Wed, Jun 07, 2017 at 11:20:03PM +0200, Takashi Iwai wrote:
> On Wed, 07 Jun 2017 07:59:20 +0200,
> Takashi Iwai wrote:
> >
> > On Wed, 07 Jun 2017 02:38:05 +0200,
> > Takashi Sakamoto wrote:
> > >
> > > In recent commit for ALSA PCM core, some arrangement is done for
> > > 'struct snd_pcm_ops.ack' callback. This is called when appl_ptr is
> > > explicitly moved in intermediate buffer for PCM frames, except for
> > > some cases described later.
> > >
> > > For drivers in ALSA firewire stack, usage of this callback has a merit to
> > > reduce latency between time of PCM frame queueing and handling actual
> > > packets in recent isochronous cycle, because no need to wait for software
> > > IRQ context from isochronous context of OHCI 1394.
> > >
> > > If this works well in a case that mapped page frame is used for the
> > > intermediate buffer, user process should execute some commands for ioctl(2)
> > > to tell the number of handled PCM frames in the intermediate buffer just
> > > after handling them.
> >
> > This is one thing that was raised in the discussion with Intel people,
> > and my suggestion was to add a new flag to suppress the status/control
> > mmap like pcm_file->no_compat_mmap. Then alsa-lib falls back to the
> > sync_ptr ioctl, and the driver can catch each appl_ptr update.
>
> Now I considered this again, and concluded that a simple patch like
> below should suffice.
>
> Adding Intel people to Cc, who raised the issue originally.
>
>
> thanks,
>
> Takashi
>
> -- 8< --
> From: Takashi Iwai <tiwai@suse.de>
> Subject: [PATCH] ALSA: pcm: Suppress status/control mmap when ack ops is
> present
>
> The drivers using PCM ack ops require the notification whenever
> appl_ptr is updated in general. But when the PCM status/control page
> is mmapped, this notification doesn't happen, per design, thus it's
> not guaranteed to receive the fine-grained updates.
>
> For improving the situation, this patch simply suppresses the PCM
> status/control mmap when ack ops is defined. At least, for all
> existing drivers with ack, this should give more benefit.
>
> Once when we really need the full optimization with status/control
> mmap even using ack ops, we may reconsider the check, e.g. introducing
> a new flag. But, so far, this should be good enough.
Yes this makes sense and we tested it for us, looks good
Reveiwed-by: Vinod Koul <vinod.koul@intel.com>
Tested-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ---
> sound/core/pcm_native.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
> index 2bde07a4a87f..b993b0420411 100644
> --- a/sound/core/pcm_native.c
> +++ b/sound/core/pcm_native.c
> @@ -3189,6 +3189,10 @@ static int snd_pcm_mmap_status(struct snd_pcm_substream *substream, struct file
> struct vm_area_struct *area)
> {
> long size;
> +
> + /* suppress status/control mmap when driver requires ack */
> + if (substream->ops->ack)
> + return -ENXIO;
> if (!(area->vm_flags & VM_READ))
> return -EINVAL;
> size = area->vm_end - area->vm_start;
> @@ -3225,6 +3229,10 @@ static int snd_pcm_mmap_control(struct snd_pcm_substream *substream, struct file
> struct vm_area_struct *area)
> {
> long size;
> +
> + /* suppress status/control mmap when driver requires ack */
> + if (substream->ops->ack)
> + return -ENXIO;
> if (!(area->vm_flags & VM_READ))
> return -EINVAL;
> size = area->vm_end - area->vm_start;
> --
> 2.13.0
>
--
~Vinod
next prev parent reply other threads:[~2017-06-09 3:40 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-07 0:38 [PATCH 0/3] ALSA: firewire: use .ack callback of PCM operation for packet processing Takashi Sakamoto
2017-06-07 0:38 ` [PATCH 1/2] ALSA: firewire: process packets in 'struct snd_pcm_ops.ack' callback Takashi Sakamoto
2017-06-07 5:59 ` Takashi Iwai
2017-06-07 21:20 ` Takashi Iwai
2017-06-09 3:42 ` Vinod Koul [this message]
2017-06-09 6:53 ` Takashi Iwai
2017-06-09 7:01 ` Takashi Sakamoto
2017-06-09 7:05 ` Takashi Iwai
2017-06-12 22:49 ` Takashi Sakamoto
2017-06-13 12:03 ` Takashi Iwai
2017-06-14 14:34 ` Takashi Sakamoto
2017-06-14 14:52 ` Takashi Iwai
2017-06-15 2:32 ` Takashi Sakamoto
2017-06-15 8:48 ` Takashi Iwai
2017-06-15 17:56 ` Takashi Sakamoto
2017-06-15 19:06 ` Takashi Iwai
2017-06-16 15:00 ` Takashi Sakamoto
2017-06-16 15:08 ` Takashi Sakamoto
2017-06-16 15:45 ` Takashi Iwai
2017-06-18 10:13 ` Takashi Sakamoto
2017-06-18 12:29 ` Takashi Iwai
2017-06-07 0:38 ` [PATCH 2/2] ALSA: fireface: constify ALSA specific operations Takashi Sakamoto
2017-06-07 5:59 ` Takashi Iwai
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=20170609034231.GS2885@localhost \
--to=vinod.koul@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=clemens@ladisch.de \
--cc=ffado-devel@lists.sf.net \
--cc=o-takashi@sakamocchi.jp \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=subhransu.s.prusty@intel.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).