From: Takashi Iwai <tiwai@suse.de>
To: "Mark Brown" <broonie@kernel.org>
Cc: "Jaroslav Kysela" <perex@perex.cz>, <alsa-devel@alsa-project.org>,
<arnd@arndb.de>, <keescook@chromium.org>,
<bgoswami@codeaurora.org>, <sr@denx.de>, <gustavo@embeddedor.com>,
<philburk@google.com>, <willy@infradead.org>,
<mchehab+samsung@kernel.org>, <sboyd@kernel.org>,
<vkoul@kernel.org>, "Baolin Wang" <baolin.wang@linaro.org>,
<daniel.thompson@linaro.org>, <leo.yan@linaro.org>,
<mathieu.poirier@linaro.org>, <srinivas.kandagatla@linaro.org>,
<anna-maria@linutronix.de>, <corbet@lwn.net>,
<jmiller@neverware.com>, <ckeepax@opensource.wolfsonmicro.com>,
<joe@perches.com>, <o-takashi@sakamocchi.jp>, <colyli@suse.de>,
<linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH] ALSA: core: Add DMA share buffer support
Date: Fri, 18 Jan 2019 20:39:32 +0100 [thread overview]
Message-ID: <s5hzhrxzrez.wl-tiwai@suse.de> (raw)
In-Reply-To: <20190118190805.GF6260@sirena.org.uk>
On Fri, 18 Jan 2019 20:08:05 +0100,
Mark Brown wrote:
>
> On Fri, Jan 18, 2019 at 10:35:44AM +0100, Jaroslav Kysela wrote:
>
> > the tinyalsa implementation does not show much - it's equal to the
> > standard mmap access for the PCM devices. Even considering the Mark's
> > text, there must be an arbiter (sound server) which communicates with
> > the producer or consumer to control the data flow. I really would like
> > to see a real usage for this.
>
> Right, the driving force behind implementing this is Android which had
> been using an out of tree version of this approach based on ION but
> that's run into trouble due to other outside changes.
>
> > It seems to me that the only point to implement this is the
> > permissions. We already have O_APPEND mode for the PCM file descriptor
> > which can reuse the PCM device multiple times (mmap the buffer to
> > multiple tasks). I would probably go in this way and add more extended
> > permission control for the PCM device, so permissions can be restricted
> > for the passed descriptor to the producer or the consumer task. In this
> > way, the restricted task might reuse other control mechanism offered buy
> > the PCM file descriptor without requesting the arbiter to do so (like
> > read the actual position in the DMA buffer, get the audio delay or so -
> > reduce context switches).
>
> One concern I have with doing some ALSA-specific custom permissions
> thing is integration with frameworks like SELinux (they'd presumably
> need to learn about the ALSA specific stuff to manage it). It also
> seems like it's adding a lot more security sensitive interfaces and
> code which which will require audit and review, one of the things I
> really like about this approach is that it's incredibly simple from
> the security point of view.
Well, I wonder what makes it more difficult by the approach Jaroslav
suggested. With O_APPEND, you can just call mmap() normally, and
that's all. What's the merit of dma-buf approach wrt the security?
BTW, the suggested patch seems to have a problem when the attached PCM
performs hw_free. Then the mapped target will be gone while another
process still mapping it. And the code looks pretty racy.
thanks,
Takashi
next prev parent reply other threads:[~2019-01-18 19:39 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-18 4:55 [RFC PATCH] ALSA: core: Add DMA share buffer support Baolin Wang
2019-01-18 9:35 ` Jaroslav Kysela
2019-01-18 19:08 ` Mark Brown
2019-01-18 19:39 ` Takashi Iwai [this message]
2019-01-21 12:40 ` Mark Brown
2019-01-21 14:15 ` Jaroslav Kysela
2019-01-22 20:25 ` Mark Brown
2019-01-23 11:58 ` Takashi Iwai
2019-01-23 12:46 ` Leo Yan
2019-01-24 13:43 ` Jaroslav Kysela
2019-01-24 17:33 ` Mark Brown
2019-01-25 9:25 ` Baolin Wang
2019-01-25 10:10 ` Takashi Iwai
2019-01-25 10:20 ` Takashi Iwai
2019-01-25 11:24 ` Baolin Wang
2019-01-25 13:04 ` Takashi Iwai
2019-01-28 5:48 ` Baolin Wang
2019-01-25 11:11 ` Baolin Wang
2019-01-25 13:03 ` Takashi Iwai
2019-01-28 5:47 ` Baolin Wang
2019-01-25 13:19 ` [alsa-devel] " Takashi Iwai
2019-01-25 18:25 ` Mark Brown
2019-01-28 13:31 ` Jaroslav Kysela
2019-01-28 14:14 ` 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=s5hzhrxzrez.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=anna-maria@linutronix.de \
--cc=arnd@arndb.de \
--cc=baolin.wang@linaro.org \
--cc=bgoswami@codeaurora.org \
--cc=broonie@kernel.org \
--cc=ckeepax@opensource.wolfsonmicro.com \
--cc=colyli@suse.de \
--cc=corbet@lwn.net \
--cc=daniel.thompson@linaro.org \
--cc=gustavo@embeddedor.com \
--cc=jmiller@neverware.com \
--cc=joe@perches.com \
--cc=keescook@chromium.org \
--cc=leo.yan@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=mchehab+samsung@kernel.org \
--cc=o-takashi@sakamocchi.jp \
--cc=perex@perex.cz \
--cc=philburk@google.com \
--cc=sboyd@kernel.org \
--cc=sr@denx.de \
--cc=srinivas.kandagatla@linaro.org \
--cc=vkoul@kernel.org \
--cc=willy@infradead.org \
/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