From owner-freebsd-multimedia@freebsd.org Sat Dec 16 16:53:51 2017 Return-Path: Delivered-To: freebsd-multimedia@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E0250E87E1C for ; Sat, 16 Dec 2017 16:53:51 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8F28A6A802 for ; Sat, 16 Dec 2017 16:53:51 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 5E72E2602AA; Sat, 16 Dec 2017 17:53:43 +0100 (CET) Subject: Re: webcamd-4.12.0.1 segfault when using WinTV-HV-950Q To: youngluc@gmail.com, freebsd-multimedia@freebsd.org References: <63966a1d-1244-4ea0-0bf8-15b485f63cd4@gmail.com> From: Hans Petter Selasky Message-ID: Date: Sat, 16 Dec 2017 17:50:53 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <63966a1d-1244-4ea0-0bf8-15b485f63cd4@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Dec 2017 16:53:52 -0000 On 12/16/17 14:10, Lucas Young wrote: > I am trying to get my WinTV-HV-950Q working on FreeBSD. I am running > into, apparently, the same problem as described in the following link > which is from this list about two years ago. > [Hauppauge WinTV HVR > 950Q](https://lists.freebsd.org/pipermail/freebsd-multimedia/2015-June/016273.html) > > > This one sounds similar as well. > [FreeBSD-10.3 and WinTV > HVR-950Q](https://lists.freebsd.org/pipermail/freebsd-multimedia/2016-December/017525.html) > > > Unfortunately, it does not appear that the solution to either of those > previous issues was posted to the list so hoping that there is someone > who is willing to rehash this for me. > > In short, webcamd is crashing with a segfault the first time that it is > run. If it is run again, it usually starts but then consumes 100% of one > CPU core. I have included the particulars from my system below. Note > that I have already compiled webcamd from ports with the DEBUG turned > on. I am not proficient in C or in using gdb so I need some help to know > what to check next. > > # uname -mrs > FreeBSD 11.1-RELEASE-p4 amd64 > > # pkg info -x webcamd > webcamd-4.12.0.1 > > # md5 /boot/modules/dvb-fe-xc5000-1.6.114.fw > MD5 (/boot/modules/dvb-fe-xc5000-1.6.114.fw) = > b1ac8f759020523ebaaeff3fdf4789ed > > # usbconfig > ugen4.1: at usbus4, cfg=0 md=HOST spd=FULL (12Mbps) > pwr=SAVE (0mA) > ugen0.1: <0x1022 XHCI root HUB> at usbus0, cfg=0 md=HOST spd=SUPER > (5.0Gbps) pwr=SAVE (0mA) > ugen5.1: at usbus5, cfg=0 md=HOST spd=HIGH (480Mbps) > pwr=SAVE (0mA) > ugen2.1: at usbus2, cfg=0 md=HOST spd=FULL (12Mbps) > pwr=SAVE (0mA) > ugen3.1: at usbus3, cfg=0 md=HOST spd=HIGH (480Mbps) > pwr=SAVE (0mA) > ugen1.1: <0x1022 XHCI root HUB> at usbus1, cfg=0 md=HOST spd=SUPER > (5.0Gbps) pwr=SAVE (0mA) > ugen0.2: at usbus0, cfg=0 md=HOST spd=HIGH > (480Mbps) pwr=ON (500mA) > ugen3.2: at usbus3, > cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA) > > # usbconfig -d 0.2 dump_device_desc > ugen0.2: at usbus0, cfg=0 md=HOST spd=HIGH > (480Mbps) p > wr=ON (500mA) > >   bLength = 0x0012 >   bDescriptorType = 0x0001 >   bcdUSB = 0x0200 >   bDeviceClass = 0x0000  >   bDeviceSubClass = 0x0000 >   bDeviceProtocol = 0x0000 >   bMaxPacketSize0 = 0x0040 >   idVendor = 0x2040 >   idProduct = 0x7200 >   bcdDevice = 0x0005 >   iManufacturer = 0x0001  >   iProduct = 0x0002  >   iSerialNumber = 0x000a  >   bNumConfigurations = 0x0001 > > # cat /boot/loader.conf > kern.geom.label.disk_ident.enable="0" > kern.geom.label.gptid.enable="0" > vfs.zfs.min_auto_ashift=12 > zfs_load="YES" > cuse_load="YES" > > # sysrc -a > autofs_enable: YES > dbus_enable: NO > dumpdev: AUTO > hald_enable: NO > jackd_enable: NO > mountd_enable: YES > mountd_flags: -r > moused_enable: NO > mythbackend_enable: YES > nfs_server_enable: YES > ntpd_enable: YES > powerd_enable: YES > rpc_lockd_enable: YES > rpc_statd_enable: YES > rpcbind_enable: YES > sshd_enable: YES > webcamd_0_flags: -N Hauppauge-WinTV-HVR-950 -S unknown > webcamd_1_flags: -N Chicony-Electronics-Co--Ltd--HP-Truevision-HD -S 0x0001 > webcamd_enable: YES > zfs_enable: YES > > > When the host boots I find that the cuse module is loaded, there is a > coredump in /, and dmesg indicates that it "exited on signal 11" during > the boot. > > # kldstat > Id Refs Address            Size     Name >  1   17 0xffffffff80200000 1f67a88  kernel >  2    1 0xffffffff82169000 316708   zfs.ko >  3    2 0xffffffff82480000 cb78     opensolaris.ko >  4    1 0xffffffff8248d000 e690     cuse.ko >  5    1 0xffffffff82a31000 10913    snd_uaudio.ko > > # dmesg > ... > uaudio0 on uhub3 > uaudio0: on usbus0 > uaudio0: No playback. > uaudio0: Record: 48000 Hz, 2 ch, 16-bit S-LE PCM format, 2x8ms buffer. > uaudio0: No MIDI sequencer. > pcm2: on uaudio0 > uaudio0: No HID volume keys found. > pid 99972 (webcamd), uid 0: exited on signal 11 (core dumped) > ... > > # gdb $(which webcamd) /webcamd.core > GNU gdb 6.1.1 [FreeBSD] > Copyright 2004 Free Software Foundation, Inc. > GDB is free software, covered by the GNU General Public License, and you > are > welcome to change it and/or distribute copies of it under certain > conditions. > Type "show copying" to see the conditions. > There is absolutely no warranty for GDB.  Type "show warranty" for details. > This GDB was configured as "amd64-marcel-freebsd"... > Core was generated by '/usr/local/sbin/webcamd -i 0 -d ugen0.2 -B -U > webcamd -G webcamd'. > Program terminated with signal 11, Segmentation fault. > Reading symbols from /usr/local/lib/libhal.so...done. > Loaded symbols for /usr/local/lib/libhal.so > Reading symbols from /usr/local/lib/libdbus-1.so...done. > Loaded symbols for /usr/local/lib/libdbus-1.so > Reading symbols from /usr/lib/libusb.so.3...done. > Loaded symbols for /usr/lib/libusb.so.3 > Reading symbols from /lib/libthr.so.3...done. > Loaded symbols for /lib/libthr.so.3 > Reading symbols from /lib/libutil.so.9...done. > Loaded symbols for /lib/libutil.so.9 > Reading symbols from /usr/lib/libcuse.so.1...done. > Loaded symbols for /usr/lib/libcuse.so.1 > Reading symbols from /lib/libc.so.7...done. > Loaded symbols for /lib/libc.so.7 > Reading symbols from /usr/lib/libexecinfo.so.1...done. > Loaded symbols for /usr/lib/libexecinfo.so.1 > Reading symbols from /lib/libelf.so.2...done. > Loaded symbols for /lib/libelf.so.2 > Reading symbols from /lib/libgcc_s.so.1...done. > Loaded symbols for /lib/libgcc_s.so.1 > Reading symbols from /libexec/ld-elf.so.1...done. > Loaded symbols for /libexec/ld-elf.so.1 > #0  0x0000000000414e32 in timer_exec (arg=0x0) at kernel/linux_timer.c:142 > 142                                     TAILQ_REMOVE(&timer_head, t, > entry); > (gdb) bt > #0  0x0000000000414e32 in timer_exec (arg=0x0) at kernel/linux_timer.c:142 > #1  0x00000008014c7bc5 in pthread_create () from /lib/libthr.so.3 > #2  0x0000000000000000 in ?? () > Current language:  auto; currently minimal > (gdb) p &timer_head > $1 = (struct timer_head *) 0xccee78 > (gdb) p t > $2 = (struct timer_list *) 0x802843130 > > > Can someone point me in the direction of what to check next? Hi, I think the TAILQ_INIT() was called too late. Can you try this patch inside webcamd sources after "make extract patch" ? > Index: kernel/linux_timer.c > =================================================================== > --- kernel/linux_timer.c (revision 4030) > +++ kernel/linux_timer.c (working copy) > @@ -27,7 +27,7 @@ > > TAILQ_HEAD(timer_head, timer_list); > > -static struct timer_head timer_head; > +static struct timer_head timer_head = TAILQ_HEAD_INITIALIZER(timer_head); > static pthread_t timer_thread; > static volatile int timer_thread_started; > static int timer_needed; > @@ -206,8 +206,6 @@ > static int > timer_init(void) > { > - TAILQ_INIT(&timer_head); > - > get_jiffies_64(); > > if (pthread_create(&timer_thread, NULL, timer_exec, NULL)) { --HPS