NetBSD Problem Report #51707

From martin@duskware.de  Sun Dec 11 10:26:32 2016
Return-Path: <martin@duskware.de>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 541557A355
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 11 Dec 2016 10:26:32 +0000 (UTC)
From: martin@NetBSD.org
Reply-To: martin@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: playing audio with mpg123 on sparc crashes
X-Send-Pr-Version: 3.95

>Number:         51707
>Category:       kern
>Synopsis:       playing audio with mpg123 on sparc crashes
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    nat
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Dec 11 10:30:00 +0000 2016
>Closed-Date:    Tue Mar 21 07:55:57 +0000 2017
>Last-Modified:  Tue Mar 21 07:55:57 +0000 2017
>Originator:     Martin Husemann
>Release:        NetBSD 7.99.45
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD krups.duskware.de 7.99.45 NetBSD 7.99.45 (MP3) #21: Sun Dec 11 10:58:10 CET 2016 martin@night-owl.duskware.de:/usr/src/sys/arch/sparc/compile/MP3 sparc
Architecture: sparc
Machine: sparc
>Description:

Trying to play some mp3 file with mpg123 crashes my sparc machine:

audiocs0 at ebus0 bar 14 offset 0x200000 line 3: CS4231A
audioprobe: type=0 sa=0xe829bafc hw=0xe821ea1c
audio0 at audiocs0: full duplex, playback, capture
audiosetinfo sc=0xf09d4000 ai=0xe829b570
audiosetinfo() Setting record params: enc=7 2ch 16/16bit 44100Hz
audiosetinfo() Setting play params: enc=7 2ch 16/16bit 44100Hz
audio_setup_pfilters: HW-buffer=0xf09851cc pustream=0xf09851cc
[HW] enc=7 2ch 16/16bit 44100Hz
audio_setup_rfilters: HW-buffer=0xf0985230 pustream=0xf0985230
[HW] enc=7 2ch 16/16bit 44100Hz
audiosetinfo: filter setup is completed.
audio_calc_blksize: record blksize=8820
audio_calc_blksize: play blksize=8820
audio_calc_blksize: record blksize=8820
audio_calc_blksize: play blksize=8820
audio_initbufs: mode=0x5
audio_init_ringbuffer: MI blksize=8816
audio_init_ringbuffer: final blksize=8768
audio_init_ringbuffer: MI blksize=8816
audio_init_ringbuffer: final blksize=8768
audio_calcwater: plow=46032 phigh=61376 rlow=0 rhigh=52608

now starting playback:

audio_open: flags=0x2 sc=0xf09d4000 hdl=0xf09c4940
audio_init_ringbuffer: MI blksize=8768
audio_init_ringbuffer: final blksize=8768
audio_init_ringbuffer: MI blksize=8768
audio_init_ringbuffer: final blksize=8768
audio_initbufs: mode=0x5
audio_init_ringbuffer: MI blksize=8768
audio_init_ringbuffer: final blksize=8768
audio_init_ringbuffer: MI blksize=8768
audio_init_ringbuffer: final blksize=8768
audiosetinfo sc=0xf09d4000 ai=0xf4d119a0
audiosetinfo() Setting record params: enc=1 1ch 8/8bit 8000Hz
audiosetinfo() Setting play params: enc=1 1ch 8/8bit 8000Hz
audiosetinfo: audio_set_params() failed with 22
audio_initbufs: mode=0x5
audio_init_ringbuffer: MI blksize=32
panic: audio_init_ringbuffer: blksize=0
panic(0xe8249d30, 0x0, 0x1, 0xf0de29e4, 0x1, 0xe8249da3) at netbsd:audio_init_ri
ngbuffer+0x12c
audio_init_ringbuffer(0xf09d4000, 0xf0de29cc, 0x1, 0xe82a3800, 0x0, 0xf0de29cc) a
t netbsd:audio_initbufs+0xd0
audio_initbufs(0xf09d4000, 0x4, 0x0, 0xf0985000, 0xe821ea1c, 0xf09d4000) at netb
sd:audiosetinfo+0x4c4
audiosetinfo(0x1, 0xf4d119a0, 0x1, 0x1, 0x4, 0xf09d4000) at netbsd:audio_set_def
aults+0xac
audio_set_defaults(0xf09d4000, 0x5, 0x1, 0x8, 0x1, 0xf0de2800) at netbsd:audio_o
pen+0x38c
audio_open(0xf0de2a8c, 0x4580, 0xf09d4000, 0x0, 0xf0de29ac, 0x14000) at netbsd:a
udioopen+0xac
audioopen(0x0, 0x4580, 0x2, 0x2000, 0xf0abf0c0, 0x0) at netbsd:cdev_open+0x80
cdev_open(0x0, 0x4580, 0x2, 0x2000, 0xf0abf0c0, 0xe82264b4) at netbsd:spec_open+
0x1e0
spec_open(0xf4d11c40, 0x0, 0x4580, 0xf0b3e020, 0xf0ce40d8, 0xf4d11c40) at netbsd
:VOP_OPEN+0x24
VOP_OPEN(0xf0ce40d8, 0x2, 0xf0c34548, 0x4a4c, 0xe8002000, 0xf09428c0) at netbsd:
vn_open+0x194

>How-To-Repeat:
s/a

>Fix:
n/a

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: kern-bug-people->nat
Responsible-Changed-By: nat@NetBSD.org
Responsible-Changed-When: Fri, 23 Dec 2016 21:13:15 +0000
Responsible-Changed-Why:
I'll handle this.


From: "Nathanial Sloss" <nat@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51707 CVS commit: src/sys/dev
Date: Sun, 25 Dec 2016 23:23:46 +0000

 Module Name:	src
 Committed By:	nat
 Date:		Sun Dec 25 23:23:46 UTC 2016

 Modified Files:
 	src/sys/dev: files.audio

 Log Message:
 Add mulaw to audio device for auconv_set_converter.

 This should address PR kern/51707.


 To generate a diff of this commit:
 cvs rdiff -u -r1.9 -r1.10 src/sys/dev/files.audio

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: martin@NetBSD.org
State-Changed-When: Mon, 26 Dec 2016 20:24:06 +0000
State-Changed-Why:
Works now, thanks!


State-Changed-From-To: closed->open
State-Changed-By: martin@NetBSD.org
State-Changed-When: Sun, 22 Jan 2017 13:53:11 +0000
State-Changed-Why:
This happens again in -current


From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: nat@NetBSD.org
Subject: Re: kern/51707 (playing audio with mpg123 on sparc crashes)
Date: Sun, 22 Jan 2017 14:56:13 +0100

 After fixes for PR kern/51703 went in, this started happening again, right
 at attach time.

 A simple fix is to avoid 0 blocksize returns form the MI round_blocksize
 function:

 Index: cs4231_ebus.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/ebus/cs4231_ebus.c,v
 retrieving revision 1.35
 diff -u -r1.35 cs4231_ebus.c
 --- cs4231_ebus.c	23 Nov 2011 23:07:31 -0000	1.35
 +++ cs4231_ebus.c	22 Jan 2017 13:53:57 -0000
 @@ -268,9 +268,13 @@
  cs4231_ebus_round_blocksize(void *addr, int blk, int mode,
  			    const audio_params_t *param)
  {
 +	int sz;

  	/* we want to use DMA burst size of 16 words */
 -	return blk & -64;
 +	sz = blk & -64;
 +	if (sz == 0)
 +		sz = 64;	/* zero is not a good blocksize */
 +	return sz;
  }



 This should be done anyway, but maybe this is indicator of some other problem?

 Martin

From: "Nathanial Sloss" <nat@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51707 CVS commit: src/sys/dev
Date: Sun, 22 Jan 2017 19:52:02 +0000

 Module Name:	src
 Committed By:	nat
 Date:		Sun Jan 22 19:52:02 UTC 2017

 Modified Files:
 	src/sys/dev: audio.c

 Log Message:
 Don't call initbufs before audio_set_defaults.  It is called in
 audiosetinfo anyway.

 Addresses PR kern/51707.


 To generate a diff of this commit:
 cvs rdiff -u -r1.294 -r1.295 src/sys/dev/audio.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: nat@NetBSD.org
Subject: Re: kern/51707 (playing audio with mpg123 on sparc crashes)
Date: Sun, 22 Jan 2017 21:38:59 +0100

 With      $NetBSD: audio.c,v 1.295 2017/01/22 19:52:02 nat Exp $
 and the ebus specific fix removed, I still get:

 audiocs0 at ebus0 bar 14 offset 0x200000 line 3: CS4231A
 audio0 at audiocs0: full duplex, playback, capture
 panic: audio_init_ringbuffer: blksize=0
 Stopped in pid 0.1 (system) at  netbsd:cpu_Debugger+0x4:        or              %
 o7, %g0, %g1
 db> bt
 cpu_Debugger(0xe824c5f8, 0xe829d600, 0xe82cb800, 0xe82cc800, 0xe82cc840, 0x104) a
 t netbsd:panic+0x24
 panic(0xe824c5f8, 0x0, 0x2, 0xf0984248, 0xe8002000, 0xf00) at netbsd:audio_init_
 ringbuffer+0xdc
 audio_init_ringbuffer(0xf09d4000, 0xf0984230, 0x0, 0xbb80, 0x20, 0xf0984230) at n
 etbsd:audio_initbufs+0x64
 audio_initbufs(0xf09d4000, 0x0, 0x20, 0xf0984000, 0xe8220d44, 0xf09d4000) at net
 bsd:audiosetinfo+0x448
 audiosetinfo(0x1, 0xe829dc90, 0x1, 0x0, 0x4, 0xf09d4000) at netbsd:audio_set_vch
 an_defaults.isra.16.constprop.18+0x150
 audio_set_vchan_defaults.isra.16.constprop.18(0x14238, 0xf09e82dc, 0x7, 0x10010,
  0x14000, 0xf09d4000) at netbsd:audioattach+0x544
 audioattach(0x1423c, 0xe82a5fb8, 0xe82a5fec, 0xe82a5fe0, 0xf09e82dc, 0xe82a5fb8)

 Martin

From: "Nathanial Sloss" <nat@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51707 CVS commit: src/sys/dev
Date: Mon, 23 Jan 2017 00:21:35 +0000

 Module Name:	src
 Committed By:	nat
 Date:		Mon Jan 23 00:21:34 UTC 2017

 Modified Files:
 	src/sys/dev: audio.c

 Log Message:
 Only call audio_initbufs and start playback if there were no errors.

 Addresses PR kern/51707.


 To generate a diff of this commit:
 cvs rdiff -u -r1.295 -r1.296 src/sys/dev/audio.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: nat@NetBSD.org
Subject: Re: kern/51707 (playing audio with mpg123 on sparc crashes)
Date: Mon, 23 Jan 2017 18:54:22 +0100

 Great, it works now!

 Should I commit the cs4231_ebus.c change anyway?

 Martin

From: Nathanial Sloss <nat@netbsd.org>
To: Martin Husemann <martin@duskware.de>
Cc: gnats-bugs@netbsd.org
Subject: Re: kern/51707 (playing audio with mpg123 on sparc crashes)
Date: Tue, 24 Jan 2017 05:17:47 +1100

 On Tue, 24 Jan 2017 04:54:22 Martin Husemann wrote:
 > Great, it works now!
 > 
 > Should I commit the cs4231_ebus.c change anyway?
 > 
 > Martin

 Please commit it.

 Best regards,

 Nat.

State-Changed-From-To: open->closed
State-Changed-By: martin@NetBSD.org
State-Changed-When: Tue, 21 Mar 2017 07:55:57 +0000
State-Changed-Why:
This has been fixed (actually in multiple ways)


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.