Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3484196imu; Fri, 18 Jan 2019 11:10:33 -0800 (PST) X-Google-Smtp-Source: ALg8bN42p0XKb3AakQyV4nppjpUC7wLrXN3ZLbYJtKTGbQTEPePRu3xDerpdx37DIlxZNF3YF0IQ X-Received: by 2002:a63:1321:: with SMTP id i33mr19224947pgl.380.1547838633267; Fri, 18 Jan 2019 11:10:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547838633; cv=none; d=google.com; s=arc-20160816; b=puVGKMAHn5CWTfDGgNwi10m47Q0kfdohRIElHXyNDWhcLEWWbRTnpXC+mpVJzvbo2v x5C8esjcRrSHyAAdGGx/YeZS/qZmVPfi3Ga1UhGNdFuBPXqBOrxQc9VqCwuQpE3swfyp ZcIEh43NjbA00AdrQ7JnV85fAqhWhHuulLOj1tJPLFBofU78Tl0Kt2oVr7jMJ0D56nFf zeP5MVSfQ4adVp7S4RLlNvW3KLCQBl1mtKMYWJ7n6YQITpzehhgHwPVXnUT5oSjlYnxl bLfSvtKSbX18Lcz7HDxNtyey/94HF3Z9KTHFRbNoa02Gf3q7fa8aHUdyM8oG6sICn3NK jy0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=NurNqkAO0hBvxkpZVUeGXsWRIkDOBLMVrYGUTknXxzE=; b=lf7q8E4dCdaxEYWaOD490KbP9Xg+I0FmrjN7/vIBacHp6L+wqPbEHSi0m8gdXMJiV2 LwxWvsbhW9kNnqbc0eoYyg6dgzW+GkCFpcEj3SlZUFAMCcdEg+2mYlSjR/+GAwcQP/zX Ytt/wwMF+BcOBM6+CuS1E8fRn/7leUNE89131x7k4pf0SbUEO7aQ0TamX9B/0NoBfHUy VAObflNZPpVV03bST5WLTApj5NrosODijw5VPDvcItLRXf1kwPGCp1TIn7lGg+uKbw0H BPcn7e9pa9Bd0QkP28VMF3RBHTOh0mmUZfySMpVIAxXE+INVtEACmgppW3Xf0UX9U85H CZ1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=MVBTAk9p; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r77si5254525pfa.186.2019.01.18.11.10.14; Fri, 18 Jan 2019 11:10:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=MVBTAk9p; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729288AbfARTIk (ORCPT + 99 others); Fri, 18 Jan 2019 14:08:40 -0500 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:51394 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728803AbfARTIk (ORCPT ); Fri, 18 Jan 2019 14:08:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=NurNqkAO0hBvxkpZVUeGXsWRIkDOBLMVrYGUTknXxzE=; b=MVBTAk9pMpM/USMlR37pfIOPN 9eq2P+2N/ldFcLIVOpBCjWNgNrEAxGekzyHBrv5gBDmiIsWXxey9fwzRg88ltVDvFd1qndBUvsNfW i/4X9SNqX95Nu5MZSPYPypwmxsJcLoEIfJTIS62XzM9BIkQTdgXQ9tgGJ8SqysHw1WDgY=; Received: from cpc102320-sgyl38-2-0-cust46.18-2.cable.virginm.net ([82.37.168.47] helo=debutante.sirena.org.uk) by heliosphere.sirena.org.uk with esmtpa (Exim 4.89) (envelope-from ) id 1gkZUs-0005WI-6J; Fri, 18 Jan 2019 19:08:06 +0000 Received: by debutante.sirena.org.uk (Postfix, from userid 1000) id 9122D11276E7; Fri, 18 Jan 2019 19:08:05 +0000 (GMT) Date: Fri, 18 Jan 2019 19:08:05 +0000 From: Mark Brown To: Jaroslav Kysela Cc: Baolin Wang , tiwai@suse.com, leo.yan@linaro.org, sboyd@kernel.org, colyli@suse.de, corbet@lwn.net, mathieu.poirier@linaro.org, ckeepax@opensource.wolfsonmicro.com, mchehab+samsung@kernel.org, gustavo@embeddedor.com, joe@perches.com, vkoul@kernel.org, o-takashi@sakamocchi.jp, keescook@chromium.org, jmiller@neverware.com, anna-maria@linutronix.de, willy@infradead.org, sr@denx.de, bgoswami@codeaurora.org, philburk@google.com, srinivas.kandagatla@linaro.org, arnd@arndb.de, daniel.thompson@linaro.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org Subject: Re: [RFC PATCH] ALSA: core: Add DMA share buffer support Message-ID: <20190118190805.GF6260@sirena.org.uk> References: <290f6d3a5fe288b87480cc5fa12c5139728daeca.1547787189.git.baolin.wang@linaro.org> <81e894ba-acad-2fd4-996d-8d35edd8825a@perex.cz> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="3yNHWXBV/QO9xKNm" Content-Disposition: inline In-Reply-To: <81e894ba-acad-2fd4-996d-8d35edd8825a@perex.cz> X-Cookie: You can't get there from here. User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --3yNHWXBV/QO9xKNm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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=20 code which which will require audit and review, one of the things I=20 really like about this approach is that it's incredibly simple from the security point of view. --3yNHWXBV/QO9xKNm Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAlxCJBQACgkQJNaLcl1U h9C1nwf6Ajg+8dtn4R9gXvvYxYKD3C8tBRZVKey3ANemRTEaLMVqPnepM0fFdfkq aF3R/XWSTimr4VSDwiAjWILSgLFWyrDtrApIWCLic7hIAi3coe8ZwCQTgi+ADtxZ 1l/bwAX1j54kCEA3veyUf79yV7OHZ4pYzhJ5nDA/HDeyVbLsZ9IanqtsRo8nHpbS GFBES7IFSPS9CbvzDIhfKS7F4OVrDecZR0F0SO62DSiExKjj+xfbt8Vnf1QyM41v 69E7CZKoU93F/HfDuqTg+zsFrCsNtE8j7rhrbir0Ub1goKXXdh/7g6voRGgu0mse hdbw6qz6rJIU475liQwQG6zo041XPA== =p664 -----END PGP SIGNATURE----- --3yNHWXBV/QO9xKNm--