Re: important audio simplifications to test and review
> Date: Sat, 20 Jun 2015 15:25:37 +0200 > From: Alexandre Ratchov > > On Thu, Jun 18, 2015 at 07:25:31PM +, Christian Weisgerber wrote: > > On 2015-06-13, Alexandre Ratchov wrote: > > > > > Many thanks to all who tested, below is an updated diff with the > > > missing i386 bits and "working" uaudio. > > > > I have run into a serious problem on sparc64 (but I haven't tested > > elsewhere). > > > > I've added -L- to the sndiod flags and I'm streaming audio from a > > remote machine (AUDIODEVICE=snd@host/0) to the sparc64. > > > > > > After a while, the network on the sparc64 locks up. Not just sndiod, > > all the network. I can't even ping the machine any longer. But > > it is only the network; the machine remains fully responsive over > > the serial console. Playing around with ping/ping6, I see that the > > machine still sends packets, but it doesn't see any incoming packets, > > including ARP and NDP replies. > > > > It appears reproducible. > > > > Details: > > Sun Blade 150 with on-board gem(4) and a cmpci(4) expansion card > > sndiod_flags="-r44100 -f rsnd/1 -L-" > > Sorry, i couldn't make my cmpci card work on my sparc64 (pci > version incompatibiliy). Could you check the following: > > - try the same setup, but with the onboard autri(4) instead of the > cmpci(4). The devices are similar and if the bug is in the > midlayer this may trigger it. > > - try the same setup with without any diffs applied. To be honest, I think the problem naddy is seeing is in the gem(4) driver, not the audio layer. What does "systat mbuf" show when it gets into this state? If the number of ALIVE mbufs is lower than 4, it might be worth trying the diff below. Index: gem.c === RCS file: /cvs/src/sys/dev/ic/gem.c,v retrieving revision 1.111 diff -u -p -r1.111 gem.c --- gem.c 14 Mar 2015 03:38:47 - 1.111 +++ gem.c 22 Jun 2015 08:18:45 - @@ -94,6 +94,7 @@ int gem_disable_rx(struct gem_softc *); intgem_disable_tx(struct gem_softc *); void gem_rx_watchdog(void *); void gem_rxdrain(struct gem_softc *); +void gem_rx_fill(void *); void gem_fill_rx_ring(struct gem_softc *); intgem_add_rxbuf(struct gem_softc *, int idx); void gem_iff(struct gem_softc *); @@ -346,6 +347,7 @@ gem_config(struct gem_softc *sc) ether_ifattach(ifp); timeout_set(&sc->sc_tick_ch, gem_tick, sc); + timeout_set(&sc->sc_rx_fill, gem_rx_fill, sc); timeout_set(&sc->sc_rx_watchdog, gem_rx_watchdog, sc); return; @@ -554,6 +556,9 @@ gem_stop(struct ifnet *ifp, int softonly } sc->sc_tx_cnt = sc->sc_tx_prod = sc->sc_tx_cons = 0; + timeout_del(&sc->sc_rx_fill); + timeout_del(&sc->sc_rx_watchdog); + gem_rxdrain(sc); } @@ -1017,6 +1022,18 @@ gem_rint(struct gem_softc *sc) } void +gem_rx_fill(void *arg) +{ + struct gem_softc *sc = arg; + int s; + + s = splnet(); + if (if_rxr_inuse(&sc->sc_rx_ring) < 4) + gem_fill_rx_ring(sc); + splx(s); +} + +void gem_fill_rx_ring(struct gem_softc *sc) { u_int slots; @@ -1027,6 +1044,9 @@ gem_fill_rx_ring(struct gem_softc *sc) break; } if_rxr_put(&sc->sc_rx_ring, slots); + + if (if_rxr_inuse(&sc->sc_rx_ring) < 4) + timeout_add(&sc->sc_rx_fill, 1); } /* Index: gemvar.h === RCS file: /cvs/src/sys/dev/ic/gemvar.h,v retrieving revision 1.29 diff -u -p -r1.29 gemvar.h --- gemvar.h8 Jul 2014 05:35:18 - 1.29 +++ gemvar.h22 Jun 2015 08:18:45 - @@ -178,6 +178,7 @@ struct gem_softc { struct gem_rxsoft sc_rxsoft[GEM_NRXDESC]; struct if_rxring sc_rx_ring; u_int32_t sc_rx_prod, sc_rx_cons; + struct timeout sc_rx_fill; /* * Control data structures.
Re: important audio simplifications to test and review
On Thu, Jun 18, 2015 at 07:25:31PM +, Christian Weisgerber wrote: > On 2015-06-13, Alexandre Ratchov wrote: > > > Many thanks to all who tested, below is an updated diff with the > > missing i386 bits and "working" uaudio. > > I have run into a serious problem on sparc64 (but I haven't tested > elsewhere). > > I've added -L- to the sndiod flags and I'm streaming audio from a > remote machine (AUDIODEVICE=snd@host/0) to the sparc64. > > > After a while, the network on the sparc64 locks up. Not just sndiod, > all the network. I can't even ping the machine any longer. But > it is only the network; the machine remains fully responsive over > the serial console. Playing around with ping/ping6, I see that the > machine still sends packets, but it doesn't see any incoming packets, > including ARP and NDP replies. > > It appears reproducible. > > Details: > Sun Blade 150 with on-board gem(4) and a cmpci(4) expansion card > sndiod_flags="-r44100 -f rsnd/1 -L-" Sorry, i couldn't make my cmpci card work on my sparc64 (pci version incompatibiliy). Could you check the following: - try the same setup, but with the onboard autri(4) instead of the cmpci(4). The devices are similar and if the bug is in the midlayer this may trigger it. - try the same setup with without any diffs applied.
Re: important audio simplifications to test and review
On 2015-06-13, Alexandre Ratchov wrote: > Many thanks to all who tested, below is an updated diff with the > missing i386 bits and "working" uaudio. I have run into a serious problem on sparc64 (but I haven't tested elsewhere). I've added -L- to the sndiod flags and I'm streaming audio from a remote machine (AUDIODEVICE=snd@host/0) to the sparc64. After a while, the network on the sparc64 locks up. Not just sndiod, all the network. I can't even ping the machine any longer. But it is only the network; the machine remains fully responsive over the serial console. Playing around with ping/ping6, I see that the machine still sends packets, but it doesn't see any incoming packets, including ARP and NDP replies. It appears reproducible. Details: Sun Blade 150 with on-board gem(4) and a cmpci(4) expansion card sndiod_flags="-r44100 -f rsnd/1 -L-" -- Christian "naddy" Weisgerber na...@mips.inka.de
Re: important audio simplifications to test and review
On Fri, Jun 12, 2015 at 02:26:34AM +0200, Max Fillinger wrote: > My uaudio device stopped working with this patch: > > $ aucat -i test.wav -f snd/0 > snd/0: couldn't open audio device > > With AUDIO_DEBUG enabled, I see the following output on the console: > > audio1: setpar: req enc=10 bits=16, bps=2, msb=1 rate=48000, pchan=2, > rchan=2, round=960, nblks=2 > audio1: 0x180: bad block size multiplier thanks. While fixing this i discovered many other uaudio problems that the new audio driver exposes; fixing them first... > uaudio0 at uhub2 port 2 configuration 1 interface 0 "Burr-Brown from TI USB > Audio DAC" rev 1.10/1.00 addr 3 > uaudio0: audio rev 1.00, 2 mixer controls this is a play-only device, isn't it?
Re: important audio simplifications to test and review
On Thu Jun 11 2015 09:20, Alexandre Ratchov wrote: > To test this diff, simply run your regular audio stuff and let us > know if you notice any difference. I'd suggest to keep a copy of > the old kernel in order to be able to compare easily. I've been watching videos and listening to music with both xine and mplayer for several hours and experienced no regressions, actually. azalia0 at pci0 dev 27 function 0 "Intel 82801I HD Audio" rev 0x03: msi azalia0: codecs: Conexant CX20561 audio0 at azalia0
Re: important audio simplifications to test and review
My uaudio device stopped working with this patch: $ aucat -i test.wav -f snd/0 snd/0: couldn't open audio device With AUDIO_DEBUG enabled, I see the following output on the console: audio1: setpar: req enc=10 bits=16, bps=2, msb=1 rate=48000, pchan=2, rchan=2, round=960, nblks=2 audio1: 0x180: bad block size multiplier The built-in soundcard in my laptop seems to work fine. I'll probably test it more extensively in the weekend. = dmesg: OpenBSD 5.7-current (AUDIO_DEBUG) #0: Fri Jun 12 00:37:51 CEST 2015 o...@trav.my.domain:/usr/src/sys/arch/amd64/compile/AUDIO_DEBUG real mem = 4062691328 (3874MB) avail mem = 3935694848 (3753MB) mpath0 at root scsibus0 at mpath0: 256 targets mainbus0 at root bios0 at mainbus0: SMBIOS rev. 2.6 @ 0xe0010 (78 entries) bios0: vendor LENOVO version "6IET79WW (1.39 )" date 07/15/2011 bios0: LENOVO 252225G acpi0 at bios0: rev 2 acpi0: sleep states S0 S3 S4 S5 acpi0: tables DSDT FACP SSDT ECDT APIC MCFG HPET ASF! SLIC BOOT SSDT TCPA SSDT SSDT SSDT acpi0: wakeup devices LID_(S3) SLPB(S3) UART(S3) IGBE(S4) EXP1(S4) EXP2(S4) EXP3(S4) EXP4(S4) EXP5(S4) EHC1(S3) EHC2(S3) HDEF(S4) acpitimer0 at acpi0: 3579545 Hz, 24 bits acpiec0 at acpi0 acpimadt0 at acpi0 addr 0xfee0: PC-AT compat cpu0 at mainbus0: apid 0 (boot processor) cpu0: Intel(R) Core(TM) i5 CPU M 540 @ 2.53GHz, 2793.41 MHz cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,SSE4.2,POPCNT,AES,NXE,LONG,LAHF,PERF,ITSC,SENSOR,ARAT cpu0: 256KB 64b/line 8-way L2 cache cpu0: smt 0, core 0, package 0 mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges cpu0: apic clock running at 133MHz cpu0: mwait min=64, max=64, C-substates=0.2.1.1, IBE cpu1 at mainbus0: apid 1 (application processor) cpu1: Intel(R) Core(TM) i5 CPU M 540 @ 2.53GHz, 2793.00 MHz cpu1: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,SSE4.2,POPCNT,AES,NXE,LONG,LAHF,PERF,ITSC,SENSOR,ARAT cpu1: 256KB 64b/line 8-way L2 cache cpu1: smt 1, core 0, package 0 cpu2 at mainbus0: apid 4 (application processor) cpu2: Intel(R) Core(TM) i5 CPU M 540 @ 2.53GHz, 2793.01 MHz cpu2: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,SSE4.2,POPCNT,AES,NXE,LONG,LAHF,PERF,ITSC,SENSOR,ARAT cpu2: 256KB 64b/line 8-way L2 cache cpu2: smt 0, core 2, package 0 cpu3 at mainbus0: apid 5 (application processor) cpu3: Intel(R) Core(TM) i5 CPU M 540 @ 2.53GHz, 2793.01 MHz cpu3: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,SSE4.2,POPCNT,AES,NXE,LONG,LAHF,PERF,ITSC,SENSOR,ARAT cpu3: 256KB 64b/line 8-way L2 cache cpu3: smt 1, core 2, package 0 ioapic0 at mainbus0: apid 1 pa 0xfec0, version 20, 24 pins ioapic0: misconfigured as apic 2, remapped to apid 1 acpimcfg0 at acpi0 addr 0xe000, bus 0-255 acpihpet0 at acpi0: 14318179 Hz acpiprt0 at acpi0: bus 0 (PCI0) acpiprt1 at acpi0: bus -1 (PEG_) acpiprt2 at acpi0: bus 2 (EXP1) acpiprt3 at acpi0: bus 3 (EXP2) acpiprt4 at acpi0: bus -1 (EXP3) acpiprt5 at acpi0: bus 5 (EXP4) acpiprt6 at acpi0: bus 13 (EXP5) acpicpu0 at acpi0: C3, C1, PSS acpicpu1 at acpi0: C3, C1, PSS acpicpu2 at acpi0: C3, C1, PSS acpicpu3 at acpi0: C3, C1, PSS acpipwrres0 at acpi0: PUBS, resource for EHC1, EHC2 acpitz0 at acpi0: critical temperature is 100 degC acpibtn0 at acpi0: LID_ acpibtn1 at acpi0: SLPB acpibat0 at acpi0: BAT0 not present acpibat1 at acpi0: BAT1 not present acpiac0 at acpi0: AC unit online acpithinkpad0 at acpi0 cpu0: Enhanced SpeedStep 2793 MHz: speeds: 2534, 2533, 2399, 2266, 2133, 1999, 1866, 1733, 1599, 1466, 1333, 1199 MHz pci0 at mainbus0 bus 0 pchb0 at pci0 dev 0 function 0 "Intel Core Host" rev 0x02 vga1 at pci0 dev 2 function 0 "Intel HD Graphics" rev 0x02 intagp0 at vga1 agp0 at intagp0: aperture at 0xd000, size 0x1000 inteldrm0 at vga1 drm0 at inteldrm0 inteldrm0: 1440x900 wsdisplay0 at vga1 mux 1: console (std, vt100 emulation) wsdisplay0: screen 1-5 added (std, vt100 emulation) "Intel 3400 MEI" rev 0x06 at pci0 dev 22 function 0 not configured em0 at pci0 dev 25 function 0 "Intel 82577LM" rev 0x06: msi, address 5c:ff:35:0f:57:21 ehci0 at pci0 dev 26 function 0 "Intel 3400 USB" rev 0x06: apic 1 int 23 usb0 at ehci0: USB revision 2.0 uhub0 at usb0 "Intel EHCI root hub" rev 2.00/1.00 addr 1 azalia0 at pci0 dev 27 function 0 "Intel 3400 HD Audio" rev 0x06: msi azalia0: codecs: Conexant/0x5069, Intel/0x2804, using Conexant/0x5069 audio0 at azalia0 audio0: wskbd using outputs.master, mute control audio0: wskbd using record
Re: important audio simplifications to test and review
On Thu, Jun 11, 2015 at 09:20:54AM +0200, Alexandre Ratchov wrote: > [...] > To test this diff, simply run your regular audio stuff and let us > know if you notice any difference. I'd suggest to keep a copy of > the old kernel in order to be able to compare easily. > [...] I've been listening to music all day and am currently watching a movie with this, no regressions so far. This is with $ dmesg | grep -E '(audio|azalia)' azalia0 at pci0 dev 27 function 0 "Intel 82801I HD Audio" rev 0x03: msi azalia0: codecs: Conexant CX20561 audio0 at azalia0 -- Gregor Best -- Opinions are like assholes -- everyone's got one, but nobody wants to look at the other guy's. -- Hal Hickman
important audio simplifications to test and review
This is a replacement for the audio(4) driver. It implements a minimal and complete subset of the audio abi. The main goal is to simplify the semantics and the code itself. Less code, less bugs, hopefuly easier development. To test this diff, simply run your regular audio stuff and let us know if you notice any difference. I'd suggest to keep a copy of the old kernel in order to be able to compare easily. In case you notice a regression, you could build the kernel with the AUDIO_DEBUG option, reboot, trigger the bug and send the resulting dmesg and any related information. thanks! -- Alexandre Index: dev/audio.c === RCS file: /cvs/src/sys/dev/audio.c,v retrieving revision 1.131 diff -u -p -u -p -r1.131 audio.c --- dev/audio.c 22 May 2015 12:46:38 - 1.131 +++ dev/audio.c 11 Jun 2015 07:02:00 - @@ -1,348 +1,139 @@ -/* $OpenBSD: audio.c,v 1.131 2015/05/22 12:46:38 jsg Exp $ */ -/* $NetBSD: audio.c,v 1.119 1999/11/09 16:50:47 augustss Exp $ */ - +/* $OpenBSD$ */ /* - * Copyright (c) 1991-1993 Regents of the University of California. - * All rights reserved. + * Copyright (c) 2003, 2004 Alexandre Ratchov * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - *notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - *notice, this list of conditions and the following disclaimer in the - *documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - *must display the following acknowledgement: - * This product includes software developed by the Computer Systems - * Engineering Group at Lawrence Berkeley Laboratory. - * 4. Neither the name of the University nor of the Laboratory may be used - *to endorse or promote products derived from this software without - *specific prior written permission. + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #include -#include #include -#include -#include -#include -#include #include -#include +#include +#include +#include #include +#include +#include +#include #include -#include -#include +#include #include -#include -#include - +#include #include #include -#include - -#include "wskbd.h" /* NWSKBD (mixer tuning using keyboard) */ +#include "audio.h" +#include "wskbd.h" #ifdef AUDIO_DEBUG -#define DPRINTF(x) if (audiodebug) printf x -#define DPRINTFN(n,x) if (audiodebug>(n)) printf x -intaudiodebug = 0; +#define DPRINTF(...) \ + do {\ + if (audio_debug)\ + printf(__VA_ARGS__);\ + } while(0) +#define DPRINTFN(n, ...) \ + do {\ + if (audio_debug > (n)) \ + printf(__VA_ARGS__);\ + } while(0) #else -#define DPRINTF(x) -#define DPRINTFN(n,x) +#define DPRINTF(...) do {} while(0) +#define DPRINTFN(n, ...) do {} while(0) #endif -#define ROUNDSIZE(x) x &= -16 /* round to nice boundary */ +#define DEVNAME(sc)((sc)->dev.dv_xname) +#define AUDIO_UNIT(n)