Created attachment 254341 [details] Recording a TV show; unplugging the device; Kernel crash with general protection fault The Hauppauge WinTV-soloHD card with em28178 chipset (an external USB TV device) works correctly in normal use. But several actions with this USB device fail. 1) The device is not waked up correctly after hibernate and resume. There are no log messages, but the DVB software can't tune a channel anymore after that. 2) If the USB device is unplugged, the Kernel often freezes. The freezes occur regardless, if the device is unplugged physically or with the "unplug simulation". It is much more likely, that the Kernel freezes, if the device is in use, e.g. recording a TV show or fetching EIT (Event Information Table) data. Testing: - Record a show - physical unplug the device - unplugging with a simulation lsusb -t # e.g. the em28xx device is listed on 3-1.3 echo 3-1.3 > /sys/bus/usb/drivers/usb/unbind 3) The driver often can't be unloaded without a Kernel freeze. Unloading the em28xx modules can be used to work-around the hibernate/resume problem. But often unloading fails. I attach "dmesg" output for actions 2) and 3). For 1) I could not get a stacktrace until now.
Created attachment 254351 [details] Recording a TV show; unloading the em28xx modules with "chvt 10;modprobe -v -r em28xx_dvb; modprobe -v -r em28xx_rc"; Kernel crash with Oops in dvb_frontend_stop
Debugging shows, that the pointers fepriv and fe->dvb in dvb_frontend_stop are sometimes NULL, if the USB device is removed or if the kernel module is removed. This causes null pointer exceptions. A possible reason is, that the DVB frontend is stopped first time, if the media player stops accessing the DVB card. Later the card is stopped a second time with dvb_frontend_stop. I wrote a patch which logs the pointers fepriv and fe->dvb and some other variables. The patch also introduces NULL pointer checks for fepriv and fe->dvd. At least the crashes for my setup are fixed with the patch.
Created attachment 255027 [details] Patch for Kernel 4.10.1 which introduces NULL pointer checks and some debugging code
Created attachment 255029 [details] Kernel 4.10.1 with patch (only logging, no NULL pointer check); stopping DVB media player; switching to console 10; removing device
Please look at: https://bugzilla.kernel.org/show_bug.cgi?id=109521 https://bugzilla.kernel.org/show_bug.cgi?id=191891 https://bugzilla.kernel.org/show_bug.cgi?id=193901 All the same problems I wrote today to linux-usb@vger.kernel.org "Hallo! I have the same problems with my DVB-T2 USB-Stick. August DVB-T210 (V 2.0) is detected by kernel as Mygica T230 DVB-T/T2/C which is the same as Geniatech 230. Tested: Kernel 4.10.1.: "....no frontend was attached...." Latest working kernel for me is Kernel 4.4.X. with firmware from openELEC.(dvb-demod-si2168-b40-01.fw (V 11) and dvb-tuner-si2158-a20-01.fw). W.Pelser" My working around to solve the hibernate-Problem is building my own kernel with build-in firmware. Only up to kernel 4.4.x W.Pelser
Created attachment 255077 [details] The updated patch adds two new checks to avoid NPEs
Hibernating-problem of Mygica T230 DVB-T/T2/C is solved with kernel 4.11-rc2.
Kernel does not crash after disconnection Mygica T230 DVB-T/T2/C during recording since version 4.11-rc2.
Created attachment 260445 [details] Kernel 4.13.9 with patch (logging, NULL pointer check); suspend/resume; removing device Unfortunately also with my patches, sometimes unloading this em28xx modules still fails. The dmesg log is made with Kernel 4.13.9. I remove the em28xx directly after resume from suspend, because otherwise (without removing and loading) the module with not work after suspend/resume.