Linux MIPS Architecture development
 help / color / mirror / Atom feed
* Segmentation Fault from MP3-Player with Etch on Qube2
@ 2007-05-07 17:37 Guido Zeiger
  2007-05-09 16:13 ` Atsushi Nemoto
  0 siblings, 1 reply; 5+ messages in thread
From: Guido Zeiger @ 2007-05-07 17:37 UTC (permalink / raw)
  To: linux-mips

Hello,

after reinstalling debian, (now etch , therefore sid) on my Qube2,  
because of changing to a 2.5" HD (from 3.5") and installing the
current debian version I got a Segmentation Fault on every usage of a  
program which should produce sound  :-((

The programs are

> mpg123
> mpg321
> mp3blaster

The programs did work with this qube2, soundcard and mp3-file under  
debian sid,
but now with etch it didnt work anymore.


Hopefully someone could point me to the problem which is generating  
the Segmentation Fault.

Here the complete SegFault-Listing...if this could help to find the  
problem:


littleghost:/home/guido# mpg321 ./mss.mp3
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layer 1, 2, and 3.
Version 0.59q (2002/03/23). Written and copyrights by Joe Drew.
Uses code from various people. See 'README' for more!
THIS SOFTWARE COMES WITH ABSOLUTELY NO WARRANTY! USE AT YOUR OWN RISK!
Title  : Magical Sound Shower (Original  Artist: Sega/S.S.T. Band
Album  : Outrun OST                      Year  : 1986
Comment: copyright Pony Canyon RecordsÆ  Genre : Soundtrack

Directory: ./
Playing MPEG stream from mss.mp3 ...
MPEG 1.0 layer III, 160 kbit/s, 44100 Hz stereo
Data bus error, epc == 801ae38c, ra == c00904b4
Oops[#1]:
Cpu 0
$ 0   : 00000000 100028c8 00000000 80000000
$ 4   : c011f000 100016c8 000011e0 100016c8
$ 8   : ffff0001 ffff0001 00000000 00010000
$12   : 0000ffff 00001fff 0000000d 00000000
$16   : 00004000 8f80d000 00000480 00000000
$20   : 80389c80 00000480 100016c8 00000000
$24   : 00000000 c008c738
$28   : 8e544000 8e545de8 c0090408 c00904b4
Hi    : 00000000
Lo    : 00000000
epc   : 801ae38c both_aligned+0x2c/0x64     Not tainted
ra    : c00904b4 snd_pcm_lib_write_transfer+0xac/0xc4 [snd_pcm]
Status: b0006c03    KERNEL EXL IE
Cause : 0080801c
PrId  : 000028a0
Modules linked in: ipv6 dm_snapshot dm_mirror dm_mod loop snd_emu10k1  
snd_rawmid
i snd_ac97_codec snd_ac97_bus snd_pcm snd_seq_device snd_timer  
snd_page_alloc sn
d_util_mem snd_hwdep uhci_hcd snd usbcore soundcore
Process mpg321 (pid: 889, threadinfo=8e544000, task=8037a8b8)
Stack : 8eb0fe24 2afd7000 00000000 8e5242ac 2afd7c7c 00000f5c  
c008ea40 800defd4
         8ff20df4 00000000 8e545e28 00000000 00000480 00000100  
00000000 00000000
         00000002 00000000 00000000 00000000 00000000 00000000  
00000000 7fe40b20
         80389c80 800c4150 00000004 100327e8 7fe42ca8 1002f370  
10004050 c008ed50
         8f95a980 c0684113 00000004 00000000 c0090408 00000000  
c008c92c c008c794
         ...
Call Trace:
[<801ae38c>] both_aligned+0x2c/0x64
[<c00904b4>] snd_pcm_lib_write_transfer+0xac/0xc4 [snd_pcm]
[<c008ea40>] snd_pcm_lib_write1+0x3c8/0x620 [snd_pcm]
[<c008ed50>] snd_pcm_lib_write+0x50/0x7c [snd_pcm]
[<c008c92c>] snd_pcm_playback_ioctl1+0x1f4/0x5ec [snd_pcm]
[<8010a4bc>] do_ioctl+0x2c/0x80
[<8010a57c>] vfs_ioctl+0x6c/0x34c
[<8010a908>] sys_ioctl+0xac/0xc4
[<8008a9a0>] stack_done+0x20/0x3c


Code: 24c6ffe0  8cac0010  8caf0014 <ac880000> ac890004  8ca80018   
8ca9001c  24a5
0020  24840020
Segmentation fault


lspci for the soundcard which did work on Sid:
00:0a.0 Multimedia audio controller: Creative Labs SB Live! EMU10k1  
(rev 04)
00:0a.1 Input device controller: Creative Labs SB Live! Game Port  
(rev 01)

littleghost:/home/guido# lsmod
Module                  Size  Used by
ipv6                  314976  10
dm_snapshot            20000  0
dm_mirror              24512  0
dm_mod                 68320  2 dm_snapshot,dm_mirror
loop                   17168  0
snd_emu10k1           134864  0
snd_rawmidi            29696  1 snd_emu10k1
snd_ac97_codec        105152  1 snd_emu10k1
snd_ac97_bus            2208  1 snd_ac97_codec
snd_pcm                89440  2 snd_emu10k1,snd_ac97_codec
snd_seq_device          9968  2 snd_emu10k1,snd_rawmidi
snd_timer              27024  2 snd_emu10k1,snd_pcm
snd_page_alloc         11248  2 snd_emu10k1,snd_pcm
snd_util_mem            5184  1 snd_emu10k1
snd_hwdep              10576  1 snd_emu10k1
uhci_hcd               27536  0
snd                    58992  7  
snd_emu10k1,snd_rawmidi,snd_ac97_codec,snd_pcm,s
nd_seq_device,snd_timer,snd_hwdep
usbcore               130896  1 uhci_hcd
soundcore              11056  1 snd


The programs saytime and saydate did produce a error regarding the  
pcm sounddevice.


Thanks
Bye
Guido.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Segmentation Fault from MP3-Player with Etch on Qube2
  2007-05-07 17:37 Segmentation Fault from MP3-Player with Etch on Qube2 Guido Zeiger
@ 2007-05-09 16:13 ` Atsushi Nemoto
  2007-05-16 14:28   ` Martin Michlmayr
  0 siblings, 1 reply; 5+ messages in thread
From: Atsushi Nemoto @ 2007-05-09 16:13 UTC (permalink / raw)
  To: guido.zeiger; +Cc: linux-mips

On Mon, 7 May 2007 19:37:40 +0200, Guido Zeiger <guido.zeiger@mailprocessor.de> wrote:
> after reinstalling debian, (now etch , therefore sid) on my Qube2,  
> because of changing to a 2.5" HD (from 3.5") and installing the
> current debian version I got a Segmentation Fault on every usage of a  
> program which should produce sound  :-((
> 
> The programs are
> 
> > mpg123
> > mpg321
> > mp3blaster
> 
> The programs did work with this qube2, soundcard and mp3-file under  
> debian sid,
> but now with etch it didnt work anymore.

There are know problems with PCI soundcard on noncoherent MIPS
platform (including cobalt) and some patches are floating around.  For
example:
http://www.linux-mips.org/archives/linux-mips/2007-04/msg00072.html

This is a long standing issue and I wonder why your soundcard _did_
work with debian sid.  The kernel of sid contains fixes for this
issue?

---
Atsushi Nemoto

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Segmentation Fault from MP3-Player with Etch on Qube2
  2007-05-09 16:13 ` Atsushi Nemoto
@ 2007-05-16 14:28   ` Martin Michlmayr
  2007-05-17 11:12     ` Atsushi Nemoto
  0 siblings, 1 reply; 5+ messages in thread
From: Martin Michlmayr @ 2007-05-16 14:28 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: guido.zeiger, linux-mips

* Atsushi Nemoto <anemo@mba.ocn.ne.jp> [2007-05-10 01:13]:
> There are know problems with PCI soundcard on noncoherent MIPS
> platform (including cobalt) and some patches are floating around.  For
> example:
> http://www.linux-mips.org/archives/linux-mips/2007-04/msg00072.html
> 
> This is a long standing issue and I wonder why your soundcard _did_
> work with debian sid.  The kernel of sid contains fixes for this
> issue?

I don't think it ever worked with 2.6, but it certainly worked with
2.4.  Is it much work to get 2.6 working again?  This problem comes up
from time to time, so it seems it's hitting a number of users.
-- 
Martin Michlmayr
http://www.cyrius.com/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Segmentation Fault from MP3-Player with Etch on Qube2
  2007-05-16 14:28   ` Martin Michlmayr
@ 2007-05-17 11:12     ` Atsushi Nemoto
  2007-05-17 14:03       ` Martin Michlmayr
  0 siblings, 1 reply; 5+ messages in thread
From: Atsushi Nemoto @ 2007-05-17 11:12 UTC (permalink / raw)
  To: tbm; +Cc: guido.zeiger, linux-mips, ralf

On Wed, 16 May 2007 16:28:49 +0200, Martin Michlmayr <tbm@cyrius.com> wrote:
> > There are know problems with PCI soundcard on noncoherent MIPS
> > platform (including cobalt) and some patches are floating around.  For
> > example:
> > http://www.linux-mips.org/archives/linux-mips/2007-04/msg00072.html
> > 
> > This is a long standing issue and I wonder why your soundcard _did_
> > work with debian sid.  The kernel of sid contains fixes for this
> > issue?
> 
> I don't think it ever worked with 2.6, but it certainly worked with
> 2.4.  Is it much work to get 2.6 working again?  This problem comes up
> from time to time, so it seems it's hitting a number of users.

Did the 2.4 kernel use ALSA or OSS?  I think ALSA for kernel 2.4 had
same problem.

And this is a minimal patch for current git tree.  But I'm not sure if
this patch really fixes the reported segfault.


There are two problem.

1. virt_to_page() can not be used for a buffer returned by
   dma_alloc_coherent().

2. mmap() for a buffer returned by dma_alloc_coherent() should be
   uncached.

This patch is actually ugly and would not be acceptable as is.
So we need a plan to how to fix them _right_ way.


diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index a96733a..2d3660c 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -3138,6 +3138,9 @@ static struct page *snd_pcm_mmap_data_nopage(struct vm_area_struct *area,
 			return NOPAGE_OOM; /* XXX: is this really due to OOM? */
 	} else {
 		vaddr = runtime->dma_area + offset;
+#if defined(CONFIG_MIPS) && defined(CONFIG_DMA_NONCOHERENT)
+		vaddr = CAC_ADDR(vaddr);
+#endif
 		page = virt_to_page(vaddr);
 	}
 	get_page(page);
@@ -3159,6 +3162,10 @@ static struct vm_operations_struct snd_pcm_vm_ops_data =
 static int snd_pcm_default_mmap(struct snd_pcm_substream *substream,
 				struct vm_area_struct *area)
 {
+#if defined(CONFIG_MIPS) && defined(CONFIG_DMA_NONCOHERENT)
+	/* use uncached access for dma_area */
+	area->vm_page_prot = pgprot_noncached(area->vm_page_prot);
+#endif
 	area->vm_ops = &snd_pcm_vm_ops_data;
 	area->vm_private_data = substream;
 	area->vm_flags |= VM_RESERVED;
diff --git a/sound/core/sgbuf.c b/sound/core/sgbuf.c
index cefd228..1dd1c9e 100644
--- a/sound/core/sgbuf.c
+++ b/sound/core/sgbuf.c
@@ -91,12 +91,21 @@ void *snd_malloc_sgbuf_pages(struct device *device,
 		}
 		sgbuf->table[i].buf = tmpb.area;
 		sgbuf->table[i].addr = tmpb.addr;
+#if defined(CONFIG_MIPS) && defined(CONFIG_DMA_NONCOHERENT)
+		sgbuf->page_table[i] = virt_to_page(CAC_ADDR(tmpb.area));
+#else
 		sgbuf->page_table[i] = virt_to_page(tmpb.area);
+#endif
 		sgbuf->pages++;
 	}
 
 	sgbuf->size = size;
+#if defined(CONFIG_MIPS) && defined(CONFIG_DMA_NONCOHERENT)
+	dmab->area = vmap(sgbuf->page_table, sgbuf->pages, VM_MAP,
+			  PAGE_KERNEL_UNCACHED);
+#else
 	dmab->area = vmap(sgbuf->page_table, sgbuf->pages, VM_MAP, PAGE_KERNEL);
+#endif
 	if (! dmab->area)
 		goto _failed;
 	return dmab->area;

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: Segmentation Fault from MP3-Player with Etch on Qube2
  2007-05-17 11:12     ` Atsushi Nemoto
@ 2007-05-17 14:03       ` Martin Michlmayr
  0 siblings, 0 replies; 5+ messages in thread
From: Martin Michlmayr @ 2007-05-17 14:03 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: guido.zeiger, linux-mips, ralf

* Atsushi Nemoto <anemo@mba.ocn.ne.jp> [2007-05-17 20:12]:
> Did the 2.4 kernel use ALSA or OSS?  I think ALSA for kernel 2.4 had
> same problem.

Yes, that was with OSS, sorry.

> And this is a minimal patch for current git tree.  But I'm not sure if
> this patch really fixes the reported segfault.

Gudio, can you try this patch or should I compile a kernel for you
with it?
-- 
Martin Michlmayr
http://www.cyrius.com/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-05-17 14:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-07 17:37 Segmentation Fault from MP3-Player with Etch on Qube2 Guido Zeiger
2007-05-09 16:13 ` Atsushi Nemoto
2007-05-16 14:28   ` Martin Michlmayr
2007-05-17 11:12     ` Atsushi Nemoto
2007-05-17 14:03       ` Martin Michlmayr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox