Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Dec 2017 17:50:53 +0100
From:      Hans Petter Selasky <hps@selasky.org>
To:        youngluc@gmail.com, freebsd-multimedia@freebsd.org
Subject:   Re: webcamd-4.12.0.1 segfault when using WinTV-HV-950Q
Message-ID:  <a78060a6-38f5-09d4-9139-75e732b2cbd1@selasky.org>
In-Reply-To: <63966a1d-1244-4ea0-0bf8-15b485f63cd4@gmail.com>
References:  <63966a1d-1244-4ea0-0bf8-15b485f63cd4@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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: <AMD OHCI root HUB> 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: <AMD EHCI root HUB> at usbus5, cfg=0 md=HOST spd=HIGH (480Mbps) 
> pwr=SAVE (0mA)
> ugen2.1: <AMD OHCI root HUB> at usbus2, cfg=0 md=HOST spd=FULL (12Mbps) 
> pwr=SAVE (0mA)
> ugen3.1: <AMD EHCI root HUB> 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: <Hauppauge WinTV HVR-950> at usbus0, cfg=0 md=HOST spd=HIGH 
> (480Mbps) pwr=ON (500mA)
> ugen3.2: <Chicony Electronics Co.,Ltd. HP Truevision HD> at usbus3, 
> cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)
> 
> # usbconfig -d 0.2 dump_device_desc
> ugen0.2: <Hauppauge WinTV HVR-950> at usbus0, cfg=0 md=HOST spd=HIGH 
> (480Mbps) p
> wr=ON (500mA)
> 
>    bLength = 0x0012
>    bDescriptorType = 0x0001
>    bcdUSB = 0x0200
>    bDeviceClass = 0x0000  <Probed by interface class>
>    bDeviceSubClass = 0x0000
>    bDeviceProtocol = 0x0000
>    bMaxPacketSize0 = 0x0040
>    idVendor = 0x2040
>    idProduct = 0x7200
>    bcdDevice = 0x0005
>    iManufacturer = 0x0001  <retrieving string failed>
>    iProduct = 0x0002  <retrieving string failed>
>    iSerialNumber = 0x000a  <retrieving string failed>
>    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: <WinTV HVR-950 Audio> on usbus0
> uaudio0: No playback.
> uaudio0: Record: 48000 Hz, 2 ch, 16-bit S-LE PCM format, 2x8ms buffer.
> uaudio0: No MIDI sequencer.
> pcm2: <USB audio> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?a78060a6-38f5-09d4-9139-75e732b2cbd1>