Re: [alsa-devel] Emu10k memory allocation (PCI DMA trouble)

From: Jaroslav Kysela (perex@suse.cz)
Date: Mon Mar 19 2001 - 10:35:15 EST


On Fri, 2 Mar 2001, Dimitri Shlyakhtenko wrote:

> As I have previosly reported in this mailing list, large soundfont files
> cannot be loaded with the alsa-0.9.0beta1 (and I suspect
> alsa-0.9.0beta2, since the underlying problem was not fixed) under
> linux-2.4.2. The reason for this is that the memory for the soundfont
> file is allocated via pci_malloc_consistent(); this call frequently
> fails, and there is a limit on the amount of memory that can be
> allocated this way (see my earlier posts titled "use of
> pci_malloc_consistent()").
>
> The enclosed patch solves this problem. [Note: I am not sure if it
> works on a non-i386 architechture].

This patch is wrong by design. The whole problem is that in
pci_alloc_consistent function (linux/arch/i386/kernel/pcm-dma.c) is this
condition:

        if (hwdev == NULL || hwdev->dma_mask != 0xffffffff)
                gfp |= GFP_DMA;

So, you have two changes: hack this function or hack the ALSA code where
the dma_mask is set PCI_SET_DMA_MASK(pci, 0x7fffffff); (emu10k1.c).

Ask hardware vendors who think that the 2GB physical memory limit is good
enough.

Is any chance to fix this code in the official kernel tree? I think that
the x86 machines with <=2GB memory could not use the GFP_DMA flag. Also,
other soundcards have some other limits like 256MB, so I suggest to havea
condition like for the x86 platform:

        if (hwdev == NULL || hwdev->dma_mask < (max_mapnr << PAGE_SHIFT))
                gfp |= GFP_DMA;

                                                Jaroslav

-----
Jaroslav Kysela <perex@suse.cz>
SuSE Linux http://www.suse.com
ALSA project http://www.alsa-project.org

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Mar 23 2001 - 21:00:12 EST