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 <[email protected]> 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
>>
>> [email protected]:/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
>> [email protected]:/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: <JetFlash, Transcend 16GB, 1100> 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(0x0000),
>> Broadcom(0x0000), 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: TID PID UID PRFLAGS PFLAGS
>> C
>> PU COMMAND
>> *419441 22975 0 0x100003 0 0 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_write+0x1d4
>> audio_write() at audiowrite+0x5c
>> https://www.openbsd.org/ddb.html describes the minimum info required in bug
>> reports. Insufficient info makes it difficult to find and fix bugs.
>> ddb> ps
>> PID TID PPID UID S FLAGS WAIT COMMAND
>> *22975 419441 5689 0 7 0x100003 cat
>> 5689 467652 35953 0 3 0x83 wait bash
>> 35953 389800 76291 0 3 0x92 select sshd
>> 55493 253406 1 0 3 0x100083 ttyin getty
>> 97168 494148 1 0 3 0x100098 poll cron
>> 10255 431749 1 110 3 0x100090 poll sndiod
>> 79222 108616 1 99 3 0x100090 poll sndiod
>> 61309 292664 59971 95 3 0x100092 kqread smtpd
>> 55188 161108 59971 103 3 0x100092 kqread smtpd
>> 3057 518445 59971 95 3 0x100092 kqread smtpd
>> 96047 27174 59971 95 3 0x100092 kqread smtpd
>> 62496 434645 59971 95 3 0x100092 kqread smtpd
>> 86341 293036 59971 95 3 0x100092 kqread smtpd
>> 59971 218445 1 0 3 0x100080 kqread smtpd
>> 76291 269291 1 0 3 0x80 select sshd
>> 43366 347618 1 0 3 0x100080 poll ntpd
>> 53308 487670 18663 83 3 0x100092 poll ntpd
>> 18663 139799 1 83 3 0x100092 poll ntpd
>> 46385 231748 81846 74 3 0x100092 bpf pflogd
>> 81846 179519 1 0 3 0x80 netio pflogd
>> 5987 339260 90176 73 3 0x100090 kqread syslogd
>> 90176 288179 1 0 3 0x100082 netio syslogd
>> 26715 191971 1 77 3 0x100090 poll dhclient
>> 46511 488471 1 0 3 0x80 poll dhclient
>> 89838 99419 67154 115 3 0x100092 kqread slaacd
>> 74675 410858 67154 115 3 0x100092 kqread slaacd
>> 67154 112738 1 0 3 0x80 kqread slaacd
>> 35000 80939 0 0 3 0x14200 pgzero zerothread
>> 1930 360823 0 0 3 0x14200 aiodoned aiodoned
>> 7795 131091 0 0 3 0x14200 syncer update
>> 9439 93014 0 0 3 0x14200 cleaner cleaner
>> 86999 116209 0 0 3 0x14200 reaper reaper
>> 27002 169944 0 0 3 0x14200 pgdaemon pagedaemon
>> 78386 146948 0 0 3 0x14200 bored crynlk
>> 71716 214983 0 0 3 0x14200 bored crypto
>> 63505 380144 0 0 3 0x14200 usbtsk usbtask
>> 70205 106443 0 0 3 0x14200 usbatsk usbatsk
>> 97567 374047 0 0 3 0x14200 bored dwc2
>> 86482 325590 0 0 3 0x14200 bored softnet
>> 48572 19531 0 0 3 0x14200 bored systqmp
>> 98789 134774 0 0 3 0x14200 bored systq
>> 36876 246705 0 0 3 0x40014200 bored softclock
>> 81598 422523 0 0 3 0x40014200 idle0
>> 83526 462821 0 0 3 0x14200 kmalloc kmthread
>> 1 154280 0 0 3 0x82 wait init
>> 0 0 -1 0 3 0x10200 scheduler swapper
>> ddb> trace
>> 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_write+0x1d4
>> audio_write() at audiowrite+0x5c
>> audiowrite() at spec_write+0xa4
>> spec_write() at VOP_WRITE+0x4c
>> VOP_WRITE() at vn_write+0xe4
>> vn_write() at dofilewritev+0x1c4
>> dofilewritev() at sys_write+0xa0
>> sys_write() at svc_handler+0x1bc
>> svc_handler() at do_el0_sync+0xe0
>> do_el0_sync() at handle_el0_sync+0x68
>> handle_el0_sync() at 0x7f59761e8
>> --- trap ---
>> ddb> boot dump
>> syncing disks... 6 5 done
>> WARNING: not updating battery clock
>>
>> dump to dev 4,1 not possible
>> rebooting...
>>
>>
>> U-Boot 2017.11 (Dec 02 2017 - 03:42:26 -0700)
>>
>> DRAM: 948 MiB
>> RPI 3 Model B (0xa02082)
>> MMC: sdhci@7e300000: 0
>> reading uboot.env
>> In: serial
>> Out: vidconsole
>> Err: vidconsole
>> Net: No ethernet found.
>> starting USB...
>> USB0: Core Release: 2.80a
>> scanning bus 0 for devices... 5 USB Device(s) found
>> scanning usb for storage devices... 1 Storage Device(s) found
>> Hit any key to stop autoboot: 0
>>
>> Device 0: Vendor: JetFlash Rev: 1100 Prod: Transcend 16GB
>> Type: Removable Hard Disk
>> Capacity: 15064.0 MB = 14.7 GB (30851072 x 512)
>> ... is now current device
>> Scanning usb 0:1...
>> Found EFI removable media binary efi/boot/bootaa64.efi
>> Scanning disk [email protected]...
>> Scanning disk usb_mass_storage.lun0...
>> Found 2 disks
>> reading efi/boot/bootaa64.efi
>> 82748 bytes read in 80 ms (1009.8 KiB/s)
>> ## Starting EFI application at 01000000 ...
>>>> OpenBSD/arm64 BOOTAA64 0.11
>> boot>
>> booting sd0a:/bsd: 3927280+587192+577992+805976
>> [280187+96+460944+245212]=0x842eb0
>> type 0x0 pa 0x0 va 0x0 pages 0x1 attr 0x8
>> type 0x7 pa 0x1000 va 0x0 pages 0x1ff attr 0x8
>> type 0x2 pa 0x200000 va 0x200000 pages 0x4000 attr 0x8
>> type 0x7 pa 0x4200000 va 0x0 pages 0x3e00 attr 0x8
>> type 0x4 pa 0x8000000 va 0x8000000 pages 0x6 attr 0x8
>> type 0x7 pa 0x8007000 va 0x0 pages 0x31814 attr 0x8
>> type 0x2 pa 0x3981b000 va 0x3981b000 pages 0x4 attr 0x8
>> type 0x2 pa 0x3981f000 va 0x3981f000 pages 0x4 attr 0x8
>> type 0x2 pa 0x39823000 va 0x39823000 pages 0x4 attr 0x8
>> type 0x2 pa 0x39827000 va 0x39827000 pages 0x4 attr 0x8
>>
>>
>> <etc>
>>
>>