NetBSD Problem Report #54614

From sc.dying@gmail.com  Sat Oct 12 13:24:17 2019
Return-Path: <sc.dying@gmail.com>
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 "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 0EF0A7A14F
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 12 Oct 2019 13:24:17 +0000 (UTC)
Message-Id: <e5b5d389-18a2-b845-05dd-94ac2e9f42eb@gmail.com>
Date: Sat, 12 Oct 2019 13:24:06 +0000
From: sc.dying@gmail.com
Reply-To:
To: gnats-bugs@NetBSD.org
Subject: playing with uaudio panics on rpi

>Number:         54614
>Category:       port-arm
>Synopsis:       playing with uaudio panics on rpi
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-arm-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Oct 12 13:25:00 +0000 2019
>Closed-Date:    Sat Nov 23 10:37:37 +0000 2019
>Last-Modified:  Sat Nov 23 10:37:37 +0000 2019
>Originator:     sc.dying@gmail.com
>Release:        NetBSD/earmv7hf 9.99.15
>Organization:
>Environment:
System: evbarm/conf/GENERIC on RPI3B
Architecture: earmv7hf
Machine: evbarm
Boardtype: Raspberry Pi 3 Model B Rev 1.2
>Description:

 Kernel panics on RPI3B while playing with uaudio(4).
Looks like zero length bus_dmamap_sync.


[  26.9767799] panic: kernel diagnostic assertion "len > 0 && offset + len <= map->dm_mapsize" failed: file "/usr/src/sys/arch/arm/arm32/bus_dma.c", line 1058 len 0 offset 0 mapsize 4096
[  26.9953700] cpu0: Begin traceback...
[  26.9953700] 0x9af2dbf4: netbsd:db_panic+0x14
[  26.9953700] 0x9af2dc0c: netbsd:vpanic+0x194
[  27.0059049] 0x9af2dc24: netbsd:__aeabi_uldivmod
[  27.0059049] 0x9af2dc94: netbsd:_bus_dmamap_sync+0xe4
[  27.0153756] 0x9af2dcb4: netbsd:usb_syncmem+0x50
[  27.0153756] 0x9af2dd14: netbsd:dwc2_device_start+0x144
[  27.0253799] 0x9af2dd34: netbsd:dwc2_device_isoc_transfer+0x48
[  27.0253799] 0x9af2dd64: netbsd:usbd_transfer+0xb0
[  27.0362750] 0x9af2dd84: netbsd:uaudio_trigger_output+0x74
[  27.0362750] 0x9af2ddcc: netbsd:audio_pmixer_output+0xf8
[  27.0473653] 0x9af2ddf4: netbsd:audio_pmixer_start+0x94
[  27.0473653] 0x9af2de64: netbsd:audio_write.isra.27+0x334
[  27.0583110] 0x9af2debc: netbsd:dofilewrite+0x80
[  27.0583110] 0x9af2deec: netbsd:sys_write+0x5c
[  27.0684191] 0x9af2dfac: netbsd:syscall+0x12c
[  27.0684191] cpu0: End traceback...
Stopped in pid 13.1 (amp) at    netbsd:cpu_Debugger+0x4:        bx      r14

 At line 1032 of sys/external/bsd/dwc2/dwc2.c usb_syncmem is called.

>		usb_syncmem(&xfer->ux_dmabuf, 0, len,
>		    dir == UE_DIR_IN ?
>			BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE);

len = xfer->ux_length, however, ux_length is always 0 for isoc transfers.


>How-To-Repeat:

1. Connect uaudio device to your RPI.
If you see `ignored audio interface with X endpoints' in dmesg,
rebuild kernel with `options UAUDIO_MULTIPLE_ENDPOINTS'
2. Play music.

>Fix:

Yes, please.

>Release-Note:

>Audit-Trail:
From: Jason Thorpe <thorpej@me.com>
To: gnats-bugs@netbsd.org
Cc: port-arm-maintainer@netbsd.org,
 gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org
Subject: Re: port-arm/54614: playing with uaudio panics on rpi
Date: Sat, 12 Oct 2019 08:12:10 -0700

 IIRC, we've seen this problem with uvideo before as well.

 We should just loosen this assertion in the ARM bus_dma code and =
 explicitly allow zero-length bus_dmamap_sync operations (as a no-op).

 > On Oct 12, 2019, at 6:25 AM, sc.dying@gmail.com wrote:
 > [  26.9767799] panic: kernel diagnostic assertion "len > 0 && offset + =
 len <=3D map->dm_mapsize" failed: file =
 "/usr/src/sys/arch/arm/arm32/bus_dma.c", line 1058 len 0 offset 0 =
 mapsize 4096

 -- thorpej

State-Changed-From-To: open->closed
State-Changed-By: skrll@NetBSD.org
State-Changed-When: Sat, 23 Nov 2019 10:37:37 +0000
State-Changed-Why:
Duplicate of 54696 (which has more info and a patch)


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.