From: Takashi Iwai <tiwai@suse.de>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
linuxppc-dev <linuxppc-dev@lists.ozlabs.org>
Subject: Re: ALSA: vmalloc buffers should use normal mmap
Date: Fri, 25 Mar 2011 11:14:48 +0100 [thread overview]
Message-ID: <s5hsjub8q1z.wl%tiwai@suse.de> (raw)
In-Reply-To: <1301035914.2402.472.camel@pasglop>
At Fri, 25 Mar 2011 17:51:54 +1100,
Benjamin Herrenschmidt wrote:
>
> It's a big no-no to use pgprot_noncached() when mmap'ing such buffers
> into userspace since they are mapped cachable in kernel space.
>
> This can cause all sort of interesting things ranging from to garbled
> sound to lockups on various architectures. I've observed that usb-audio
> is broken on powerpc 4xx for example because of that.
>
> Also remove the now unused snd_pcm_lib_mmap_noncached(). It's
> an arch business to know when to use uncached mappings, there's
> already hacks for MIPS inside snd_pcm_default_mmap() and other
> archs are supposed to use dma_mmap_coherent().
>
> (See my separate patch that adds dma_mmap_coherent() to powerpc)
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> CC: Takashi Iwai <tiwai@suse.de>
Applied now to sound git tree. Thanks.
Takashi
> ---
> include/sound/pcm.h | 4 +---
> sound/core/pcm_native.c | 9 ---------
> 2 files changed, 1 insertions(+), 12 deletions(-)
>
> diff --git a/include/sound/pcm.h b/include/sound/pcm.h
> index 430a9cc..e1bad11 100644
> --- a/include/sound/pcm.h
> +++ b/include/sound/pcm.h
> @@ -1031,9 +1031,7 @@ int snd_pcm_lib_mmap_iomem(struct snd_pcm_substream *substream, struct vm_area_s
> #define snd_pcm_lib_mmap_iomem NULL
> #endif
>
> -int snd_pcm_lib_mmap_noncached(struct snd_pcm_substream *substream,
> - struct vm_area_struct *area);
> -#define snd_pcm_lib_mmap_vmalloc snd_pcm_lib_mmap_noncached
> +#define snd_pcm_lib_mmap_vmalloc NULL
>
> static inline void snd_pcm_limit_isa_dma_size(int dma, size_t *max)
> {
> diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
> index 2d99c37..7639407 100644
> --- a/sound/core/pcm_native.c
> +++ b/sound/core/pcm_native.c
> @@ -3194,15 +3194,6 @@ int snd_pcm_lib_mmap_iomem(struct snd_pcm_substream *substream,
> EXPORT_SYMBOL(snd_pcm_lib_mmap_iomem);
> #endif /* SNDRV_PCM_INFO_MMAP */
>
> -/* mmap callback with pgprot_noncached */
> -int snd_pcm_lib_mmap_noncached(struct snd_pcm_substream *substream,
> - struct vm_area_struct *area)
> -{
> - area->vm_page_prot = pgprot_noncached(area->vm_page_prot);
> - return snd_pcm_default_mmap(substream, area);
> -}
> -EXPORT_SYMBOL(snd_pcm_lib_mmap_noncached);
> -
> /*
> * mmap DMA buffer
> */
>
>
prev parent reply other threads:[~2011-03-25 10:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-25 6:51 Benjamin Herrenschmidt
2011-03-25 10:14 ` Takashi Iwai [this message]
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=s5hsjub8q1z.wl%tiwai@suse.de \
--to=tiwai@suse.de \
--cc=benh@kernel.crashing.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.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
all inboxes | Powered by JetHome®