From: Takashi Iwai <tiwai@suse.de>
To: Alex Roberts <arob109@gmail.com>
Cc: alsa-devel@alsa-project.org, kernelnewbies@kernelnewbies.org
Subject: Re: ASoC/ALSA Out of Memory Issue
Date: Tue, 27 Jul 2021 18:26:38 +0200 [thread overview]
Message-ID: <s5h35rzd8ox.wl-tiwai@suse.de> (raw)
In-Reply-To: <CAPkENw_qS2fgP02RAJgoQHM1ROoio6Km5=bGPhi2R+h4vJQ79w@mail.gmail.com>
On Mon, 26 Jul 2021 17:07:52 +0200,
Alex Roberts wrote:
>
> Hello,
>
> I am developing a dummy codec to interface with an 8-channel, 24-bit
> ADC. I've got it working on an NXP imx8m through the fsl_sai driver on
> kernel 5.4.85. I can capture all 8 channels at varying sample rates
> using arecord, and I've verified correct data capture via opening the
> resulting .wav file in Audacity. The problem I am having is that
> occasionally, upon starting arecord - after a fresh power cycle - I
> get an out of memory error. Other times I get an out of memory after a
> non-deterministic period of capture. Starting capture again also
> reports out of memory, but if I wait several minutes and start capture
> it will start recording again. A power cycle usually helps, but as
> stated earlier, not 100% of the time.
Do you mean that application gets -ENOMEM error from API, or the
system exhausts the memory? The former is often some buffer
management issue (e.g. the buffer perallocation didn't happen and yet
the dynamic allocation failed), but the latter is rather about the
memory leaks.
Takashi
> I'm trying to track down where the oom error is coming from, but
> haven't had much luck. My colleague tried running arecord with
> valgrind to check for memory leaks and nothing of note was observed.
> My suspicion is there's something going on with allocated memory for
> DMA, like fragmentation starts to happen and it can't get a contiguous
> region for operation. Reserving a larger pool - either via device tree
> or kernel cmdline arguments in the bootoader - did not seem to help.
>
> Another thought is that it's a boundary/alignment issue due to the
> 24-bit data, and the error is the result of trying to allocate a chunk
> of memory for DMA that doesn't align.
>
> I'm very new to ALSA dev with some exposure to kernel dev in general,
> so please correct me if I'm wrong or completely mis-understanding
> something.
>
> Any suggestions on where I should / how I can debug this memory error?
>
> Thanks,
> Alex.
>
> PS: Previously sent this to just alsa-devel mailing list on 7/21, but
> never saw it show up in the archives. Here is more info since then:
>
> The goal is 8-channel, 96k sampling rate. I've reduced sampling rate
> and still have the issue. Reducing down to 4-channels helps, but
> haven't tested long term enough to evaluate by how much.
>
> Narrowed it down to device_prep_dma_cyclic(..) returning NULL within
> dmaengine_prep_dma_cyclic(..)..... still tracing through source to
> learn exactly what is going on.
>
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
next prev parent reply other threads:[~2021-07-27 16:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-26 15:07 ASoC/ALSA Out of Memory Issue Alex Roberts
2021-07-27 16:26 ` Takashi Iwai [this message]
2021-07-28 3:05 ` Alex Roberts
2021-09-10 19:06 ` Alex Roberts
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=s5h35rzd8ox.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=arob109@gmail.com \
--cc=kernelnewbies@kernelnewbies.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;
as well as URLs for NNTP newsgroup(s).