From: Takashi Iwai <tiwai@suse.de>
To: Clemens Ladisch <clemens@ladisch.de>
Cc: padma.v@samsung.com,
Abhilash Kesavan <kesavan.abhilash@gmail.com>,
lars@metafoo.de, lgirdwood@gmail.com, b42378@freescale.com,
alsa-devel@alsa-project.org, broonie@kernel.org,
p.zabel@pengutronix.de
Subject: Re: Question on arm64 unaligned faults during playback
Date: Mon, 08 Dec 2014 11:41:47 +0100 [thread overview]
Message-ID: <s5hppbumnis.wl-tiwai@suse.de> (raw)
In-Reply-To: <54856621.8090107@ladisch.de>
At Mon, 08 Dec 2014 09:49:37 +0100,
Clemens Ladisch wrote:
>
> Abhilash Kesavan wrote:
> > I am working on a 64-bit ARM SoC (Samsung's Exynos7) and have observed
> > unaligned faults while testing certain sound streams with aplay.
> >
> > [ 24.535661] snd_pcm_lib_write_transfer:sound/core/pcm_lib.c hwbuf is ffffff8000085624, runtime->dma_area is ffffff8000080000, hwoff is 5513, frames_to_bytes is 22052, frames is 5513
> > [ 24.551244] Unhandled fault: alignment fault (0x96000061) at 0xffffff8000085624
> > [ 24.579944] PC is at __copy_from_user+0x14/0x60
> > [ 24.584450] LR is at snd_pcm_lib_write_transfer+0xe4/0x104
> > [ 24.922054] Call trace:
> > [ 24.924488] [<ffffffc0002d4784>] __copy_from_user+0x14/0x60
> > [ 24.930040] [<ffffffc0004b7574>] snd_pcm_lib_write1+0x1fc/0x384
> >
> > We are using the internal sram available for sound, for DMA buffer
> > allocation, using the generic SRAM driver. From the above log, the
> > buffer address offset is not 8-byte aligned and as we are using the
> > SRAM driver which maps the memory as device memory we are getting an
> > unaligned fault. Is it incorrect to use the generic sram driver for
> > arm64 or am I missing something ?
>
> When you give the ALSA framework a memory buffer, it is assumed that it
> is general-purpose memory, i.e., can be accessed with any alignment.
>
> If your memory does not allow such accesses, you have to do all the
> accesses in your driver, i.e., do everything in the .copy/.silence
> callbacks. (You also have to add constraints so that periods and buffer
> are correctly aligned.)
You can set runtime->min_align in the own hw_params callback so that
the PCM core handle it well, at least, for non-mmap mode.
But this feature has been rarely used (currently no driver sets it
explicitly), so there might be still some bugs there, too :)
Takashi
next prev parent reply other threads:[~2014-12-08 10:41 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-08 5:40 Question on arm64 unaligned faults during playback Abhilash Kesavan
2014-12-08 8:49 ` Clemens Ladisch
2014-12-08 10:41 ` Takashi Iwai [this message]
2014-12-08 11:15 ` Lars-Peter Clausen
2014-12-08 11:15 ` [alsa-devel] " Lars-Peter Clausen
2014-12-08 11:31 ` Will Deacon
2014-12-08 11:31 ` Will Deacon
2014-12-09 2:56 ` Abhilash Kesavan
2014-12-09 2:56 ` [alsa-devel] " Abhilash Kesavan
2014-12-08 12:04 ` Takashi Iwai
2014-12-08 12:04 ` [alsa-devel] " Takashi Iwai
2014-12-08 12:25 ` Catalin Marinas
2014-12-08 12:25 ` Catalin Marinas
2014-12-09 2:56 ` Abhilash Kesavan
2014-12-09 2:56 ` Abhilash Kesavan
2014-12-09 8:19 ` Clemens Ladisch
2014-12-09 8:19 ` [alsa-devel] " Clemens Ladisch
2014-12-09 11:43 ` Catalin Marinas
2014-12-09 11:43 ` [alsa-devel] " Catalin Marinas
2014-12-10 4:10 ` Abhilash Kesavan
2014-12-10 4:10 ` [alsa-devel] " Abhilash Kesavan
2014-12-09 2:56 ` Abhilash Kesavan
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=s5hppbumnis.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=b42378@freescale.com \
--cc=broonie@kernel.org \
--cc=clemens@ladisch.de \
--cc=kesavan.abhilash@gmail.com \
--cc=lars@metafoo.de \
--cc=lgirdwood@gmail.com \
--cc=p.zabel@pengutronix.de \
--cc=padma.v@samsung.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.