[Bug 183456] Re: Trying to load a sf2 file with asfxload returns "sfxload: no memory left"

Thomas Richter thor at math.tu-berlin.de
Sun Mar 29 22:38:59 UTC 2009

The problem with this goes a bit deeper. The reason for all this trouble
is that the emu10k1 chipset requires DMA from main memory to pick up the
samples, and - unfortunately - the DMA engine of the chip is broken.
Instead of using the full range of 32 bit DMA available on the PCI bus,
it only addresses 31 bit of the 32 available.

To work around this problem, the kernel driver first allocates a page of
main memory, signaling the 32 bit DMA memory "zone", i.e. indicating the
kernel that it requires 32 bit memory in a 64 bit memory system.
However, if now the returned memory happens to have bit 31 set, the
emu10k1 wouldn't be able to address the memory. Then, the driver
releases the memory again, and requests memory in the 16MB "ISA" memory
region, which is clearly suitable for the chip. Unfortunately, this type
of memory runs out easily, and then the chip is left with no usable
memory at all.

The problem is that the kernel isn't smart enough to provide memory that
is "just right" for the chip, i.e. the "DMA zone" allocation isn't quite
sufficient for this situation. There seem to be plans on the LKLM to
address this, but it's unclear how long this will take - after all, the
complete kernel page allocator must be re-structured to fix this.

How to work around? Oh well, the easiest is to lower the 32bit PCI DMA
zone from 4G to 2G. This means that some non-broken devices will require
to allocate pages in the 2GB region (bad enough), and the memory layout
might be sub-optimal for those devices, but at least the hack will work.

For that, download the kernel, and edit arch/x86/include/asm/dma.h,
locate the line:

#define MAX_DMA32_PFN ((4UL * 1024 * 1024 * 1024) >> PAGE_SHIFT)

and replace the 4UL by a 2UL, which will shrink the 32-bit DMA zone by
half. This is not a permanent solution - it's an ugly bad hack that is
"good enough for me". There is no kernel boot option to do this AFAIK.

So long, happy hacking,


Trying to load a sf2 file with asfxload returns "sfxload: no memory left" 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

ubuntu-bugs mailing list
ubuntu-bugs at lists.ubuntu.com

More information about the universe-bugs mailing list