Re: [PATCH v3 5/6] ALSA: xen-front: Implement ALSA virtual sound driver

From: Takashi Sakamoto
Date: Tue May 22 2018 - 23:07:02 EST


Hi,

On May 14 2018 15:27, Oleksandr Andrushchenko wrote:
> diff --git a/sound/xen/xen_snd_front_alsa.c b/sound/xen/xen_snd_front_alsa.c
> new file mode 100644
> index 000000000000..5041f83e98d2
> --- /dev/null
> +++ b/sound/xen/xen_snd_front_alsa.c
> ...
> +/*
> + * FIXME: The mmaped data transfer is asynchronous and there is no
> + * ack signal from user-space when it is done. This is the
> + * reason it is not implemented in the PV driver as we do need
> + * to know when the buffer can be transferred to the backend.
> + */
> ...

In ALSA PCM interface v2.0.14 or later, SNDRV_PCM_INFO_SYNC_APPLPTR is
available. This flag express that userspace applications are expected to
call ioctl(2) with 'SNDRV_PCM_IOCTL_SYNC_PTR' even if they oprate to
memory mapped page frames for PCM samples. For detail, please refer to a
commit 42f945970af9 ('ALSA: pcm: Add the explicit appl_ptr sync
support')[1].

As a supplement, please refer to below commits:
* 4b671f577474 ('ALSA: pcm: Add an ioctl to specify the supported
protocol version')[2]
* b602aa8eb1a0 ('ALSA: pcm: Disable only control mmap for explicit
appl_ptr sync')[3]

Alsa-lib v1.1.5 or later supports this flag and existent applications
can run transparently.

For developers, a tracepoint may be useful:
* fccf53881e9b ('ALSA: pcm: add 'applptr' event of tracepoint')[4]

For your information.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=42f945970af9
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4b671f577474
[3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b602aa8eb1a0
[4] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fccf53881e9b


Regards

Takashi Sakamoto