mirror of https://lore.kernel.org/linux-amlogic/
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Valerio Setti" <vsetti@baylibre.com>
Cc: conor+dt@kernel.org, robh@kernel.org, devicetree@vger.kernel.org,
	neil.armstrong@linaro.org, linux-amlogic@lists.infradead.org
Subject: Re: [PATCH 3/6] ASoC: meson: add audin FIFO driver
Date: Fri, 11 Sep 2026 22:30:04 +0000	[thread overview]
Message-ID: <20260911223005.0FF661F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260912-audin-v1-3-7fbefe928711@baylibre.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Calling a sleeping function from atomic and hardirq contexts.
--

commit 44499e80857bb0a40e090af263ae83ec007e6008
Author: Valerio Setti <vsetti@baylibre.com>

ASoC: meson: add audin FIFO driver

Add support for the frontend DAI of the capture interface which is in
charge of receiving decoded data from "audin-formatter-i2s" and move them
to an internal FIFO before they are block-transferred to RAM.

> diff --git a/sound/soc/meson/audin-fifo.c b/sound/soc/meson/audin-fifo.c
> new file mode 100644
> index 0000000000000..7029bd6a464ab
> --- /dev/null
> +++ b/sound/soc/meson/audin-fifo.c

[ ... ]

> +static unsigned int audin_fifo_pos(struct snd_soc_component *component,
> +				   struct snd_pcm_runtime *runtime)
> +{
> +	unsigned int ptr = snd_soc_component_read(component, AUDIN_FIFO_PTR);

[Severity: High]
Can this call into a sleeping function from atomic and hardirq contexts?

The audin_fifo_pos() function calls snd_soc_component_read(), which
explicitly acquires a sleeping mutex. However, this is called by
audin_fifo_timer_cb() (an hrtimer callback executing in hardirq context)
and by audin_fifo_component_pointer() (an ALSA PCM pointer callback that
executes while holding a spinlock).

Acquiring a sleeping lock from either of these contexts can trigger a
kernel panic during audio capture.

> +
> +	return ptr - lower_32_bits(runtime->dma_addr);
> +}

[ ... ]

> +static enum hrtimer_restart audin_fifo_timer_cb(struct hrtimer *timer)
> +{
> +	struct audin_fifo_dai_data *data =
> +		container_of(timer, struct audin_fifo_dai_data, polling_timer);
> +	struct snd_pcm_runtime *runtime = data->substream->runtime;
> +	unsigned int curr_pos, delta, sleep_time;
> +
> +	if (!READ_ONCE(data->running))
> +		return HRTIMER_NORESTART;
> +
> +	curr_pos = audin_fifo_pos(data->component, runtime);

[ ... ]

> +static snd_pcm_uframes_t
> +audin_fifo_component_pointer(struct snd_soc_component *component,
> +			     struct snd_pcm_substream *substream)
> +{
> +	struct snd_pcm_runtime *runtime = substream->runtime;
> +
> +	return bytes_to_frames(runtime, audin_fifo_pos(component, runtime));
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260912-audin-v1-0-7fbefe928711@baylibre.com?part=3

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  reply	other threads:[~2026-09-11 22:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-11 22:14 [PATCH 0/6] ASoC: meson: gx: add base support for I2S audio input Valerio Setti
2026-09-11 22:14 ` [PATCH 1/6] dt-bindings: sound: amlogic: add schemas for audin components Valerio Setti
2026-09-11 22:14 ` [PATCH 2/6] ASoC: meson: add audin main module and I2S formatter Valerio Setti
2026-09-11 22:14 ` [PATCH 3/6] ASoC: meson: add audin FIFO driver Valerio Setti
2026-09-11 22:30   ` sashiko-bot [this message]
2026-09-11 22:14 ` [PATCH 4/6] ASoC: meson: aiu: add I2S Capture DAI Valerio Setti
2026-09-11 22:14 ` [PATCH 5/6] ASoC: meson: gx-card: add support for audin FIFO Valerio Setti
2026-09-11 22:14 ` [PATCH 6/6] arm64: dts: amlogic: gx: add nodes for audin and its FIFOs Valerio Setti

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=20260911223005.0FF661F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=neil.armstrong@linaro.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vsetti@baylibre.com \
    /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

all inboxes | Powered by JetHome®