Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Jaroslav Kysela <perex@perex.cz>
Cc: linux-sound@vger.kernel.org, "Takashi Iwai" <tiwai@suse.de>,
	"Mark Brown" <broonie@kernel.org>,
	"Shengjiu Wang" <shengjiu.wang@gmail.com>,
	"Nicolas Dufresne" <nicolas@ndufresne.ca>,
	"Amadeusz Sławiński" <amadeuszx.slawinski@linux.intel.com>,
	"Pierre-Louis Bossart" <pierre-louis.bossart@linux.intel.com>,
	"Vinod Koul" <vkoul@kernel.org>
Subject: Re: [RFC PATCH] ALSA: compress_offload: introduce passthrough operation mode
Date: Mon, 27 May 2024 13:23:50 +0200	[thread overview]
Message-ID: <87cyp7a46x.wl-tiwai@suse.de> (raw)
In-Reply-To: <20240527071133.223066-1-perex@perex.cz>

On Mon, 27 May 2024 09:11:33 +0200,
Jaroslav Kysela wrote:
> 
> There is a requirement to expose the audio hardware that accelerates various
> tasks for user space such as sample rate converters, compressed
> stream decoders, etc.
> 
> This is description for the API extension for the compress ALSA API which
> is able to handle "tasks" that are not bound to real-time operations
> and allows for the serialization of operations.
> 
> For details, refer to "compress-passthrough.rst" document.
> 
> Note: This code is RFC (not tested, just to clearify the API requirements).
> My goal is to add a test (loopback) driver and add a support to tinycompress
> library in the next step.
> 
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Shengjiu Wang <shengjiu.wang@gmail.com>
> Cc: Nicolas Dufresne <nicolas@ndufresne.ca>
> Cc: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
> Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> Cc: Vinod Koul <vkoul@kernel.org>
> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
> ---
(snip)

Through a quick glance, the general idea looks simple enough and
straightforward.  If this satisfies the needs, we can go in this way.

A few subtle things:

- We might want to have a safe limit for the task creations.
  An evil user-space can fill up too easily.

- The error checks of memdup_user() are missing. 
  A caveat is that memdup_user() returns ERR_PTR() instead of NULL.
  So with the automatic cleanup, you'd need to fiddle with
  PTR_ERR(no_free_ptr(p)).

- The use of __u64 is rather for uapi headers.  The kernel internals
  can be with straight u64.

- The task list add/removal might need some locks.  It looks racy.
  Also the task runtime returned from snd_compr_find_task() might be
  freed.  Need for some locking or refcounting?

- A linear lookup is OK from performance POV?  Maybe enough for small
  number of tasks.

- Better to have a protocol version check and accept the R/W mode only
  with the newer version.


thanks,

Takashi

  parent reply	other threads:[~2024-05-27 11:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-27  7:11 [RFC PATCH] ALSA: compress_offload: introduce passthrough operation mode Jaroslav Kysela
2024-05-27 10:13 ` Amadeusz Sławiński
2024-05-27 11:10   ` Takashi Iwai
2024-05-27 11:34     ` Jaroslav Kysela
2024-05-27 11:41   ` Jaroslav Kysela
2024-05-27 11:23 ` Takashi Iwai [this message]
2024-05-27 12:20   ` Jaroslav Kysela
2024-05-27 14:17 ` Pierre-Louis Bossart
     [not found]   ` <66bf7ad9-8680-4ed0-8e04-cac3ab701c46@perex.cz>
     [not found]     ` <8aa8609b-eb8c-43c8-89ac-94b1eda267fd@linux.intel.com>
2024-05-27 15:59       ` Jaroslav Kysela

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=87cyp7a46x.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=amadeuszx.slawinski@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=nicolas@ndufresne.ca \
    --cc=perex@perex.cz \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=shengjiu.wang@gmail.com \
    --cc=vkoul@kernel.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