Thanks, this helps a lot. But what if the driver just makes repeated requests until it gets the memory in the range it needs, by chance? Not likely?
-----Original Message----- From: Thomas Richter <[email protected]> Sent: Sunday, March 29, 2009 6:38 PM To: [email protected] Subject: [Bug 183456] Re: Trying to load a sf2 file with asfxload returns "sfxload: no memory left" 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, Thomas -- Trying to load a sf2 file with asfxload returns "sfxload: no memory left" https://bugs.launchpad.net/bugs/183456 You received this bug notification because you are a direct subscriber of the bug. Status in “awesfx” source package in Ubuntu: New Bug description: Binary package hint: awesfx Trying to load a SoundFont2 file with asfxload returns "no memory left", even if the computer is plenty of RAM and the module is configured to majke 1GB available. Tested both with the package from the repository and a version compiled from unpatched sources, same behavior. r...@ptah:~# asfxload -V 100 "/storage/sdb1/Multimedia/SoundFonts/Soundfont 103.5Mg Real Font v2.1 Bank.sf2" sfxload: no memory left r...@ptah:~# asfxload -M DRAM memory left = 1037524 kB r...@ptah:~# lspci | grep Creative 00:0c.0 Multimedia audio controller: Creative Labs SB Audigy (rev 03) 00:0c.2 FireWire (IEEE 1394): Creative Labs SB Audigy FireWire Port r...@ptah:~# cat /etc/modprobe.d/alsa-base alias snd-card-0 snd-emu10k1 alias snd-card-1 snd-via82xx alias snd-card-2 snd-bt87x alias snd-card-3 snd-usb-audio # autoloader aliases install sound-slot-0 /sbin/modprobe snd-card-0 install sound-slot-1 /sbin/modprobe snd-card-1 install sound-slot-2 /sbin/modprobe snd-card-2 install sound-slot-3 /sbin/modprobe snd-card-3 install sound-slot-4 /sbin/modprobe snd-card-4 install sound-slot-5 /sbin/modprobe snd-card-5 install sound-slot-6 /sbin/modprobe snd-card-6 install sound-slot-7 /sbin/modprobe snd-card-7 # Cause optional modules to be loaded above generic modules install snd /sbin/modprobe --ignore-install snd && { /sbin/modprobe --quiet snd-ioctl32 ; : ; } install snd-pcm /sbin/modprobe --ignore-install snd-pcm && { /sbin/modprobe --quiet snd-pcm-oss ; : ; } install snd-mixer /sbin/modprobe --ignore-install snd-mixer && { /sbin/modprobe --quiet snd-mixer-oss ; : ; } install snd-seq /sbin/modprobe --ignore-install snd-seq && { /sbin/modprobe --quiet snd-seq-midi ; /sbin/modprobe --quiet snd-seq-oss ; : ; } install snd-rawmidi /sbin/modprobe --ignore-install snd-rawmidi && { /sbin/modprobe --quiet snd-seq-midi ; : ; } # Cause optional modules to be loaded above sound card driver modules install snd-emu10k1 /sbin/modprobe --ignore-install snd-emu10k1 max_buffer_size=1024 enable_ir=1 $CMDLINE_OPTS && { /sbin/modprobe -Qb snd-emu10k1-synth ; } install snd-via82xx /sbin/modprobe --ignore-install snd-via82xx $CMDLINE_OPTS && { /sbin/modprobe -Qb snd-seq ; } # Load saa7134-alsa instead of saa7134 (which gets dragged in by it anyway) install saa7134 /sbin/modprobe --ignore-install saa7134 $CMDLINE_OPTS && { /sbin/modprobe -Qb saa7134-alsa ; : ; } # Load snd-seq for devices that don't have hardware midi; # Ubuntu #26283, #43682, #56005; works around Ubuntu #34831 for # non-Creative Labs PCI hardware install snd /sbin/modprobe --ignore-install snd && { /sbin/modprobe -Qb snd-seq ; } # Prevent abnormal drivers from grabbing index 0 options snd-emu10k1 index=0 options snd-via82xx index=1 options snd-bt87x index=2 options snd-usb-audio index=3 # options snd-bt87x index=-2 options cx88-alsa index=-2 options saa7134-alsa index=-2 options snd-atiixp-modem index=-2 options snd-intel8x0m index=-2 # options snd-via82xx-modem index=-2 # options snd-usb-audio index=-2 options snd-usb-usx2y index=-2 options snd-usb-caiaq index=-2 # Ubuntu #62691, enable MPU for snd-cmipci options snd-cmipci mpu_port=0x330 fm_port=0x388 I'm running Kubuntu 7.10 on an AMD Athlon 64 3500+ (socket 939) processor. r...@ptah:~# uname -a ; free -m Linux ptah 2.6.22-14-rt #1 SMP PREEMPT RT Tue Dec 18 06:37:06 UTC 2007 x86_64 GNU/Linux total used free shared buffers cached Mem: 3906 3228 677 0 69 956 -/+ buffers/cache: 2202 1703 Swap: 1027 13 1013 r...@ptah:~# cat /proc/cpuinfo processor : 0 vendor_id : AuthenticAMD cpu family : 15 model : 47 model name : AMD Athlon(tm) 64 Processor 3500+ stepping : 2 cpu MHz : 2202.809 cache size : 512 KB fpu : yes fpu_exception : yes cpuid level : 1 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext fxsr_opt lm 3dnowext 3dnow up pni lahf_lm bogomips : 4409.40 TLB size : 1024 4K pages clflush size : 64 cache_alignment : 64 address sizes : 40 bits physical, 48 bits virtual power management: ts fid vid ttp tm stc -- Trying to load a sf2 file with asfxload returns "sfxload: no memory left" https://bugs.launchpad.net/bugs/183456 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
