Skip to contentSkip to conversation

sfxload / asfxload page allocation failure

DISCUSSION holborn 2 participants 5 messages Apr 13, 2004 – Apr 14, 2004

lore
Share & tools
lore

holborn

author
#0 lore raw

Hi!

I have problems when i try to load "big" soundfonts, in older versions i was load this soundfonts without probems.

when i run sfxload or asfxload with PC51f.sf2 (for example ... ) asfxload or sfxload try to load but no returnd to command line. No way to kill the process, no way to load other soundfonts and when i reboot i have this message:

(Is hand copied ... maybe they are some typo errors)

sfxload: page allocation failure. order:0, mode:0xd1

Call Trace:
[<c013377a>] __alloc_pages+0x2e0/0x325
[<c01337de>] __get_free_pages+0x1f/0x41
[<c010d74f>] dma_alloc_coherent+0x47/0x7a
[<e09681b6>] snd_dma_hack_alloc_coherent+0x13e/0x14e [snd_page_alloc]
[<e096837c>] snd_malloc_dev_pages+0x4f/0x69 [snd_page_alloc]
[<e096853f>] snd_dma_alloc_pages+0xc2/0xc4 [snd_page_alloc]
[<e0a4e0d0>] synth_alloc_pages+0x5b/0x103 [snd_emu10k1]
[<e0a4df3d>] snd_emu10k1_synth_alloc+0x4a/0x96 [snd_emu10k1]
[<e0a10e8c>] snd_emu10k1_sample_new+0x84/0x1cd [snd_emu10k1_synth]
[<e0a44b40>] load_data+0x167/0x1b7 [snd_emux_synth]
[<e0a43f03>] snd_soundfont_load+0x12e/0x275 [snd_emux_synth]
[<e0a45de5<] snd_emux_load_patch_seq_oss+0xde/0x116 [snd_emux_synth]
[<e09ce49e>] snd_seq_oss_synth_load_patch+0x99/0x9b [snd_seq_oss]
[<e09cd9ce>] snd_seq_oss_write+0x16c/0x17e [snd_seq_oss]
[<e09cb0ba>] odev_write+0x0/0x14 [snd_seq_oss]
[<c0149cec>] vfs_write+0xb0/0x119
[<c0149dfa>] sys_write+0x42/0x63
[<c0106d33>] syscall_cal+0x7/0xb

I have the same error in a gentoo
Driver version 1.0.4rc2 in kernel 2.6.5
and also in debian same kernel same alsa version of course .. :)

Small soundfonts (8MB) loads perfect ...

Thanks

Josep

-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click

#1 lore raw

At Tue, 13 Apr 2004 12:37:10 +0100,

Quoted 11 lines · holborn

Hi!

I have problems when i try to load "big" soundfonts, in older versions i was load this soundfonts without probems.

when i run sfxload or asfxload with PC51f.sf2 (for example ... ) asfxload or sfxload try to load but no returnd to command line. No way to kill the process, no way to load other soundfonts and when i reboot i have this message:

well, it means that your machine has really no RAM available for the soundfont. on 2.4 kernel (or older ALSA version), the driver allocated the pages in atomic, so it doesn't go to sleep. on 2.6 and current ALSA, the page allocation is done with GFP_KERNEL, so it may sleep until the page is available. it can take a long time but must not be infinitely long.

could you check whether the "page allocation failure" message already appeared when sfxload hangs up?
does the message appears once or many times?

Takashi

-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click

author
#2 lore raw
Quoted 11 lines · Takashi Iwai

At Tue, 13 Apr 2004 12:37:10 +0100,

well, it means that your machine has really no RAM available for the soundfont. on 2.4 kernel (or older ALSA version), the driver allocated the pages in atomic, so it doesn't go to sleep. on 2.6 and current ALSA, the page allocation is done with GFP_KERNEL, so it may sleep until the page is available. it can take a long time but must not be infinitely long.

Quoted 5 lines

could you check whether the "page allocation failure" message already appeared when sfxload hangs up?
does the message appears once or many times?

Hi ... the message appears after reboot command ...
I have load this soundfonts for years :-)
No problems to load the soundfont in kernel 2.6.4 alsa 1.0.2c but still no load in 2.6.5, i checked in two machines gentoo and Debian ..

I made the sfxload after booting ...

free command after login is:

Mem total 515728    used 37940    free 477788   ----> in kernel 2.6.5
Mem total 515728    used 38916    free 476824   ----> in kernel 2.6.4

Then i try to run sfxload .... in kernel 2.6.4 loads in a seconds ... in kernel 2.6.5 i wait minutes .... then i login in other tty and i try to kill the sfxload .... no way ... and i use reboot command .... then appears the error message.

Thanks

Josep

-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click

#3 lore raw

At Tue, 13 Apr 2004 17:22:52 +0100,

Quoted 25 lines · holborn
Quoted 11 lines · Takashi Iwai

At Tue, 13 Apr 2004 12:37:10 +0100,

well, it means that your machine has really no RAM available for the soundfont. on 2.4 kernel (or older ALSA version), the driver allocated the pages in atomic, so it doesn't go to sleep. on 2.6 and current ALSA, the page allocation is done with GFP_KERNEL, so it may sleep until the page is available. it can take a long time but must not be infinitely long.

Quoted 5 lines

could you check whether the "page allocation failure" message already appeared when sfxload hangs up?
does the message appears once or many times?

Hi ... the message appears after reboot command ...
I have load this soundfonts for years :-)
No problems to load the soundfont in kernel 2.6.4 alsa 1.0.2c but still no load in 2.6.5, i checked in two machines gentoo and Debian ..

Quoted 7 lines

I made the sfxload after booting ...

free command after login is:

Mem total 515728    used 37940    free 477788   ----> in kernel 2.6.5
Mem total 515728    used 38916    free 476824   ----> in kernel 2.6.4

hmm, then it shouldn't fail.
i guess the attached patch fixes the problem. please give a try.

Takashi

Index: alsa-kernel/core/memalloc.c
===================================================================
RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/core/memalloc.c,v retrieving revision 1.30

core/memalloc.c +9 -2
diff -u -r1.30 memalloc.c
@@ -137,14 +137,17 @@
 					 dma_addr_t *dma_handle, int flags)
 {
 	void *ret;
-	u64 dma_mask;
+	u64 dma_mask, coherent_dma_mask;
 
 	if (dev == NULL || !dev->dma_mask)
 		return dma_alloc_coherent(dev, size, dma_handle, flags);
 	dma_mask = *dev->dma_mask;
+	coherent_dma_mask = dev->coherent_dma_mask;
 	*dev->dma_mask = 0xffffffff; 	/* do without masking */
+	dev->coherent_dma_mask = 0xffffffff; 	/* do without masking */
 	ret = dma_alloc_coherent(dev, size, dma_handle, flags);
 	*dev->dma_mask = dma_mask;	/* restore */
+	dev->coherent_dma_mask = coherent_dma_mask;	/* restore */
 	if (ret) {
 		/* obtained address is out of range? */
 		if (((unsigned long)*dma_handle + size - 1) & ~dma_mask) {
@@ -154,8 +157,12 @@
 		}
 	} else {
 		/* wish to success now with the proper mask... */
-		if (dma_mask != 0xffffffffUL)
+		if (dma_mask != 0xffffffffUL) {
+			/* allocation with GFP_ATOMIC to avoid the long stall */
+			flags &= ~GFP_KERNEL;
+			flags |= GFP_ATOMIC;
 			ret = dma_alloc_coherent(dev, size, dma_handle, flags);
+		}
 	}
 	return ret;
 }
author
#4 lore raw

Hi!

Quoted 4 lines · Takashi Iwai

hmm, then it shouldn't fail.
i guess the attached patch fixes the problem. please give a try.

Now is perfect ..... thanks.

You are the best :)

Josep

-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click