Re: Kernel panic when using USB audio on Raspberry 3 B

2018-02-19 Thread Heinrich Rebehn
Hi Artturi,

I applied your diff:

# rcsdiff -u dwc2.c
===
RCS file: RCS/dwc2.c,v
retrieving revision 1.1
diff -u -r1.1 dwc2.c
--- dwc2.c  2018/02/19 10:29:03 1.1
+++ dwc2.c  2018/02/19 10:31:20
@@ -1,4 +1,4 @@
-/* $OpenBSD: dwc2.c,v 1.1 2018/02/19 10:29:03 root Exp root $  */
+/* $OpenBSD: dwc2.c,v 1.1 2018/02/19 10:29:03 root Exp $   */
 /* $NetBSD: dwc2.c,v 1.32 2014/09/02 23:26:20 macallan Exp $   */
 
 /*-
@@ -1298,7 +1298,7 @@
xfer->actlen = 0;
 
KASSERT(xfertype != UE_ISOCHRONOUS ||
-   xfer->nframes < DWC2_MAXISOCPACKETS);
+   xfer->nframes <= DWC2_MAXISOCPACKETS);
KASSERTMSG(xfer->nframes == 0 || xfertype == UE_ISOCHRONOUS,
"nframes %d xfertype %d\n", xfer->nframes, xfertype);

Now system freezes without crash :-(

Also, after that many crashes, the filesystem has become quite corrupted.
I am currently using one big fs mounted on “/“ with option softdep.

# mount
/dev/sd0a on / type ffs (local, wxallowed, softdep)

Is use of softdep still recommended?


-Heinrich

> On 19. Feb 2018, at 04:14, Artturi Alm  wrote:
> 
> On Sun, Feb 18, 2018 at 05:31:44PM +0100, Heinrich Rebehn wrote:
>>> Synopsis:  Kernel panic when writing to /dev/audio
>>> Category:  Kernel
>>> Environment:
>>System  : OpenBSD 6.2
>>Details : OpenBSD 6.2-current (GENERIC) #1: Sun Feb 18 16:46:14 
>> CET 2018
>> 
>> r...@foo.fritz.box:/usr/src/sys/arch/arm64/compile/GENERIC
>> 
>>Architecture: OpenBSD.arm64
>>Machine : arm64
>>> Description:
>>Kernel panic when writing to /dev/audio (USB audio)
>>> How-To-Repeat:
>>cd /dev; cat urandom > audio, or use sox' play(1) command to play any 
>> mp3 audio
>>> Fix:
>>None, i am not familiar with kernel debugging/fixing
>> 
> 
> Hi,
> 
> looks like you know how to compile kernels,
> i'm curious if the simple diff below 'fixes' it.
> 
> -Artturi
> 
> 
> diff --git sys/dev/usb/dwc2/dwc2.c sys/dev/usb/dwc2/dwc2.c
> index 1c0ccba0e25..29c0ca1316d 100644
> --- sys/dev/usb/dwc2/dwc2.c
> +++ sys/dev/usb/dwc2/dwc2.c
> @@ -1298,7 +1298,7 @@ dwc2_device_start(struct usbd_xfer *xfer)
>   xfer->actlen = 0;
> 
>   KASSERT(xfertype != UE_ISOCHRONOUS ||
> - xfer->nframes < DWC2_MAXISOCPACKETS);
> + xfer->nframes <= DWC2_MAXISOCPACKETS);
>   KASSERTMSG(xfer->nframes == 0 || xfertype == UE_ISOCHRONOUS,
>   "nframes %d xfertype %d\n", xfer->nframes, xfertype);
> 
> 
> 
>> SENDBUG: dmesg, pcidump, acpidump and usbdevs are attached.
>> SENDBUG: Feel free to delete or use the -D flag if they contain sensitive 
>> information.
>> 
>> dmesg:
>> OpenBSD 6.2-current (GENERIC) #1: Sun Feb 18 16:46:14 CET 2018
>>r...@foo.fritz.box:/usr/src/sys/arch/arm64/compile/GENERIC
>> real mem  = 964767744 (920MB)
>> avail mem = 908701696 (866MB)
>> mainbus0 at root: Raspberry Pi 3 Model B Rev 1.2
>> cpu0 at mainbus0 mpidr 0: ARM Cortex-A53 r0p4
>> efi0 at mainbus0: UEFI 2.0.5
>> efi0: Das U-boot rev 0x0
>> simplefb0 at mainbus0: 656x416
>> wsdisplay0 at simplefb0 mux 1
>> wsdisplay0: screen 0-5 added (std, vt100 emulation)
>> simplebus0 at mainbus0: "soc"
>> syscon0 at simplebus0: "syscon"
>> bcmintc0 at simplebus0
>> bcmdog0 at simplebus0
>> pluart0 at simplebus0
>> bcmaux0 at simplebus0
>> com0 at simplebus0: ns16550, no working fifo
>> com0: console
>> dwctwo0 at simplebus0
>> agtimer0 at simplebus0: tick rate 19200 KHz
>> simplebus1 at mainbus0: "clocks"
>> usb0 at dwctwo0: USB revision 2.0
>> uhub0 at usb0 configuration 1 interface 0 "Broadcom DWC2 root hub" rev 
>> 2.00/1.00 addr 1
>> uhub1 at uhub0 port 1 configuration 1 interface 0 "Standard Microsystems 
>> product 0x9514" rev 2.00/2.00 addr 2
>> smsc0 at uhub1 port 1 configuration 1 interface 0 "Standard Microsystems 
>> SMSC9512/14" rev 2.00/2.00 addr 3
>> smsc0: address b8:27:eb:8d:8e:a8
>> ukphy0 at smsc0 phy 1: Generic IEEE 802.3u media interface, rev. 3: OUI 
>> 0x0001f0, model 0x000c
>> uaudio0 at uhub1 port 3 configuration 1 interface 0 "ABC C-Media USB Audio 
>> Device" rev 1.10/1.00 addr 4
>> uaudio0: audio rev 1.00, 8 mixer controls
>> audio0 at uaudio0
>> uhidev0 at uhub1 port 3 configuration 1 interface 3 "ABC C-Media USB Audio 
>> Device" rev 1.10/1.00 addr 4
>> uhidev0: iclass 3/0
>> uhid0 at uhidev0: input=4, output=4, feature=0
>> umass0 at uhub1 port 4 configuration 1 interface 0 "JetFlash Mass Storage 
>> Device" rev 2.10/11.00 addr 5
>> umass0: using SCSI over Bulk-Only
>> scsibus0 at umass0: 2 targets, initiator 0
>> sd0 at scsibus0 targ 1 lun 0:  SCSI4 
>> 0/direct removable serial.856410005Y2I6Q9SV6N0
>> sd0: 15064MB, 512 bytes/sector, 30851072 sectors
>> vscsi0 at root
>> scsibus1 at vscsi0: 256 targets
>> softraid0 at root
>> scsibus2 at softraid0: 256 targets
>> bootfile: sd0a:/bsd
>> boot device: sd0
>> root on sd0a (24d0157b87573f8c.a) swap on sd0b dump on sd0b

Re: Kernel panic when using USB audio on Raspberry 3 B

2018-02-18 Thread Artturi Alm
On Sun, Feb 18, 2018 at 05:31:44PM +0100, Heinrich Rebehn wrote:
> >Synopsis:  Kernel panic when writing to /dev/audio
> >Category:  Kernel
> >Environment:
> System  : OpenBSD 6.2
> Details : OpenBSD 6.2-current (GENERIC) #1: Sun Feb 18 16:46:14 
> CET 2018
>  
> r...@foo.fritz.box:/usr/src/sys/arch/arm64/compile/GENERIC
> 
> Architecture: OpenBSD.arm64
> Machine : arm64
> >Description:
> Kernel panic when writing to /dev/audio (USB audio)
> >How-To-Repeat:
> cd /dev; cat urandom > audio, or use sox' play(1) command to play any 
> mp3 audio
> >Fix:
> None, i am not familiar with kernel debugging/fixing
> 

Hi,

looks like you know how to compile kernels,
i'm curious if the simple diff below 'fixes' it.

-Artturi


diff --git sys/dev/usb/dwc2/dwc2.c sys/dev/usb/dwc2/dwc2.c
index 1c0ccba0e25..29c0ca1316d 100644
--- sys/dev/usb/dwc2/dwc2.c
+++ sys/dev/usb/dwc2/dwc2.c
@@ -1298,7 +1298,7 @@ dwc2_device_start(struct usbd_xfer *xfer)
xfer->actlen = 0;
 
KASSERT(xfertype != UE_ISOCHRONOUS ||
-   xfer->nframes < DWC2_MAXISOCPACKETS);
+   xfer->nframes <= DWC2_MAXISOCPACKETS);
KASSERTMSG(xfer->nframes == 0 || xfertype == UE_ISOCHRONOUS,
"nframes %d xfertype %d\n", xfer->nframes, xfertype);
 


> SENDBUG: dmesg, pcidump, acpidump and usbdevs are attached.
> SENDBUG: Feel free to delete or use the -D flag if they contain sensitive 
> information.
> 
> dmesg:
> OpenBSD 6.2-current (GENERIC) #1: Sun Feb 18 16:46:14 CET 2018
> r...@foo.fritz.box:/usr/src/sys/arch/arm64/compile/GENERIC
> real mem  = 964767744 (920MB)
> avail mem = 908701696 (866MB)
> mainbus0 at root: Raspberry Pi 3 Model B Rev 1.2
> cpu0 at mainbus0 mpidr 0: ARM Cortex-A53 r0p4
> efi0 at mainbus0: UEFI 2.0.5
> efi0: Das U-boot rev 0x0
> simplefb0 at mainbus0: 656x416
> wsdisplay0 at simplefb0 mux 1
> wsdisplay0: screen 0-5 added (std, vt100 emulation)
> simplebus0 at mainbus0: "soc"
> syscon0 at simplebus0: "syscon"
> bcmintc0 at simplebus0
> bcmdog0 at simplebus0
> pluart0 at simplebus0
> bcmaux0 at simplebus0
> com0 at simplebus0: ns16550, no working fifo
> com0: console
> dwctwo0 at simplebus0
> agtimer0 at simplebus0: tick rate 19200 KHz
> simplebus1 at mainbus0: "clocks"
> usb0 at dwctwo0: USB revision 2.0
> uhub0 at usb0 configuration 1 interface 0 "Broadcom DWC2 root hub" rev 
> 2.00/1.00 addr 1
> uhub1 at uhub0 port 1 configuration 1 interface 0 "Standard Microsystems 
> product 0x9514" rev 2.00/2.00 addr 2
> smsc0 at uhub1 port 1 configuration 1 interface 0 "Standard Microsystems 
> SMSC9512/14" rev 2.00/2.00 addr 3
> smsc0: address b8:27:eb:8d:8e:a8
> ukphy0 at smsc0 phy 1: Generic IEEE 802.3u media interface, rev. 3: OUI 
> 0x0001f0, model 0x000c
> uaudio0 at uhub1 port 3 configuration 1 interface 0 "ABC C-Media USB Audio 
> Device" rev 1.10/1.00 addr 4
> uaudio0: audio rev 1.00, 8 mixer controls
> audio0 at uaudio0
> uhidev0 at uhub1 port 3 configuration 1 interface 3 "ABC C-Media USB Audio 
> Device" rev 1.10/1.00 addr 4
> uhidev0: iclass 3/0
> uhid0 at uhidev0: input=4, output=4, feature=0
> umass0 at uhub1 port 4 configuration 1 interface 0 "JetFlash Mass Storage 
> Device" rev 2.10/11.00 addr 5
> umass0: using SCSI over Bulk-Only
> scsibus0 at umass0: 2 targets, initiator 0
> sd0 at scsibus0 targ 1 lun 0:  SCSI4 0/direct 
> removable serial.856410005Y2I6Q9SV6N0
> sd0: 15064MB, 512 bytes/sector, 30851072 sectors
> vscsi0 at root
> scsibus1 at vscsi0: 256 targets
> softraid0 at root
> scsibus2 at softraid0: 256 targets
> bootfile: sd0a:/bsd
> boot device: sd0
> root on sd0a (24d0157b87573f8c.a) swap on sd0b dump on sd0b
> WARNING: / was not properly unmounted
> WARNING: CHECK AND RESET THE DATE!
> 
> usbdevs:
> Controller /dev/usb0:
> addr 1: high speed, self powered, config 1, DWC2 root hub(0x), 
> Broadcom(0x), rev 1.00
>  port 1 addr 2: high speed, self powered, config 1, product 0x9514(0x9514), 
> Standard Microsystems(0x0424), rev 2.00
>   port 1 addr 3: high speed, self powered, config 1, SMSC9512/14(0xec00), 
> Standard Microsystems(0x0424), rev 2.00
>   port 2 powered
>   port 3 addr 4: full speed, power 100 mA, config 1, C-Media USB Audio 
> Device(0x0008), ABC(0x0d8c), rev 1.00
>   port 4 addr 5: high speed, power 300 mA, config 1, Mass Storage 
> Device(0x1000), JetFlash(0x8564), rev 11.00, iSerialNumber 01TC5Y2I6Q9SV6N0
>   port 5 powered
> 
> pcidump:
> 
> acpidump:
> 
> 
> login: panic: kernel diagnostic assertion "xfertype != UE_ISOCHRONOUS || 
> xfer->nframes < DWC2_MAXISOCP1
> Stopped at  panic+0x154:TIDPIDUID PRFLAGS PFLAGS  
> C
> PU  COMMAND
> *419441  22975  00x13  00  cat
> db_enter() at panic+0x150
> panic() at dwc2_device_start+0x448
> dwc2_device_start() at usbd_transfer+0x144
> usbd_transfer() at uaudio_trigger_output+0x120
> uaudio_trigger_output() at audio_start_do+0x94
> audio_start_do() at audio_wri