From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: Memory problems are back with SB Live! Date: Thu, 28 Nov 2002 17:48:39 +0100 Sender: alsa-devel-admin@lists.sourceforge.net Message-ID: References: <20021119215516.8350.qmail@web40606.mail.yahoo.com> Mime-Version: 1.0 (generated by SEMI 1.14.4 - "Hosorogi") Content-Type: multipart/mixed; boundary="Multipart_Thu_Nov_28_17:48:39_2002-1" Return-path: In-Reply-To: <20021119215516.8350.qmail@web40606.mail.yahoo.com> Errors-To: alsa-devel-admin@lists.sourceforge.net List-Help: List-Post: List-Subscribe: , List-Unsubscribe: , List-Archive: To: Chris Rankin Cc: alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org --Multipart_Thu_Nov_28_17:48:39_2002-1 Content-Type: text/plain; charset=US-ASCII Hi Chris, sorry for late reply - i'm just back from vacation. At Tue, 19 Nov 2002 21:55:16 +0000 (GMT), Chris Rankin wrote: > > Hi, > > My box has now accumulated almost 3 weeks of uptime, > and so the ALSA memory problem is back again: > > $ aplay /usr/lib/sounds/jungle_exit.wav > Playing WAVE '/usr/lib/sounds/jungle_exit.wav' : > Signed 16 bit Little Endian, Rate 22050 Hz, Stereo > ALSA lib pcm_hw.c:297:(snd_pcm_hw_hw_params) > SNDRV_PCM_IOCTL_HW_PARAMS failed: Cannot allocate > memory > aplay: set_params:814: Unable to install hw params: > ACCESS: RW_INTERLEAVED > FORMAT: S16_LE > SUBFORMAT: STD > SAMPLE_BITS: 16 > FRAME_BITS: 32 > CHANNELS: 2 > RATE: 22050 > PERIOD_TIME: 100000 > PERIOD_SIZE: 2205 > PERIOD_BYTES: 8820 > PERIODS: 5 > BUFFER_TIME: 500000 > BUFFER_SIZE: 11025 > BUFFER_BYTES: 44100 > TICK_TIME: 10000 > > Is that patch you sent me to hack^Wfix this still > relevant, or will it make things worse? i found bugs in the old patch. the attached patch should work better. could you try it? ciao, Takashi --Multipart_Thu_Nov_28_17:48:39_2002-1 Content-Type: application/octet-stream Content-Disposition: attachment; filename="sgbuf-getpage.dif" Content-Transfer-Encoding: 7bit Index: alsa-kernel/core/pcm_sgbuf.c =================================================================== RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/core/pcm_sgbuf.c,v retrieving revision 1.7 diff -u -r1.7 pcm_sgbuf.c --- alsa-kernel/core/pcm_sgbuf.c 10 Sep 2002 10:20:00 -0000 1.7 +++ alsa-kernel/core/pcm_sgbuf.c 28 Oct 2002 14:35:43 -0000 @@ -128,7 +128,32 @@ while (sgbuf->pages < pages) { void *ptr; dma_addr_t addr; +#ifdef __i386__ + /* HACK! we try to allocate with GFP_KERNEL */ + unsigned long rmask; + if (sgbuf->pci) + rmask = ~(unsigned long)sgbuf->pci->dma_mask; + else + rmask = 0; + ptr = (void *)__get_free_page(GFP_KERNEL); + if (ptr) { + addr = virt_to_phys(ptr); + if (((unsigned long)addr + PAGE_SIZE - 1) & rmask) { + /* reallocate with the proper mask */ + free_page((unsigned long)ptr); + ptr = (void *)__get_free_page(GFP_KERNEL | GFP_DMA); + if (ptr) + addr = virt_to_phys(ptr); + else + addr = 0; + } + } else + addr = 0; + if (ptr) + memset(ptr, 0, PAGE_SIZE); +#else ptr = snd_malloc_pci_pages(sgbuf->pci, PAGE_SIZE, &addr); +#endif if (! ptr) return -ENOMEM; sgbuf->table[sgbuf->pages].buf = ptr; --Multipart_Thu_Nov_28_17:48:39_2002-1-- ------------------------------------------------------- This SF.net email is sponsored by: Get the new Palm Tungsten T handheld. Power & Color in a compact size! http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en