linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* current em28xx driver crashes
@ 2012-03-22 11:00 Antti Palosaari
  2012-03-22 11:28 ` Gianluca Gennari
  0 siblings, 1 reply; 3+ messages in thread
From: Antti Palosaari @ 2012-03-22 11:00 UTC (permalink / raw)
  To: linux-media

Hello
I am running Kernel 3.3-rc7 + around week old linux-media.

During the implementation of MaxMedia UB425-TC and PCTV QuatroStick nano 
(520e) device support I ran very many crashes likely when unloading 
modules. Here is Kernel Panic [1].

Today it crashes just during PCTV 520e stress test. It have been 
scanning DVB-C channels in loop ~3 days now and it crashed without 
reason. Here is Kernel Panic [2].

Could someone look those and guess what is reason em28xx is so unstable 
currently?


[1] http://palosaari.fi/linux/v4l-dvb/em28xx_crashes/IMG_20120318_225505.jpg
[2] http://palosaari.fi/linux/v4l-dvb/em28xx_crashes/

regards
Antti
-- 
http://palosaari.fi/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: current em28xx driver crashes
  2012-03-22 11:00 current em28xx driver crashes Antti Palosaari
@ 2012-03-22 11:28 ` Gianluca Gennari
  2012-03-22 12:48   ` [PATCH] em28xx-dvb: stop URBs when stopping the streaming Gianluca Gennari
  0 siblings, 1 reply; 3+ messages in thread
From: Gianluca Gennari @ 2012-03-22 11:28 UTC (permalink / raw)
  To: Antti Palosaari; +Cc: linux-media

Il 22/03/2012 12:00, Antti Palosaari ha scritto:
> Hello
> I am running Kernel 3.3-rc7 + around week old linux-media.
> 
> During the implementation of MaxMedia UB425-TC and PCTV QuatroStick nano
> (520e) device support I ran very many crashes likely when unloading
> modules. Here is Kernel Panic [1].
> 
> Today it crashes just during PCTV 520e stress test. It have been
> scanning DVB-C channels in loop ~3 days now and it crashed without
> reason. Here is Kernel Panic [2].
> 
> Could someone look those and guess what is reason em28xx is so unstable
> currently?
> 
> 
> [1]
> http://palosaari.fi/linux/v4l-dvb/em28xx_crashes/IMG_20120318_225505.jpg
> [2] http://palosaari.fi/linux/v4l-dvb/em28xx_crashes/
> 
> regards
> Antti

Hi Antti,
it may be due to this patch:

http://patchwork.linuxtv.org/patch/9875/

Can you try to revert it and see if the problems disappear?
I've never seen this crashes on my systems, but my hardware and my use
cases are totally different.

Looks like the problems originates into em28xx_irq_callback() and/or
em28xx_dvb_isoc_copy().

Regards,
Gianluca

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] em28xx-dvb: stop URBs when stopping the streaming
  2012-03-22 11:28 ` Gianluca Gennari
@ 2012-03-22 12:48   ` Gianluca Gennari
  0 siblings, 0 replies; 3+ messages in thread
From: Gianluca Gennari @ 2012-03-22 12:48 UTC (permalink / raw)
  To: linux-media, mchehab; +Cc: crope, Gianluca Gennari

Stop the URBs in em28xx_stop_streaming(), so that em28xx_irq_callback()
cannot be called after the streaming has stopped.

This should eliminate the crashes reported by Antti Palosaari and the warnings
reported by Andy Furniss.

Signed-off-by: Gianluca Gennari <gennarone@gmail.com>
---
 drivers/media/video/em28xx/em28xx-core.c |   26 +++++++++++++++++++++++++-
 drivers/media/video/em28xx/em28xx-dvb.c  |    2 +-
 drivers/media/video/em28xx/em28xx.h      |    1 +
 3 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c
index 53a9fb9..cbbe399 100644
--- a/drivers/media/video/em28xx/em28xx-core.c
+++ b/drivers/media/video/em28xx/em28xx-core.c
@@ -666,7 +666,6 @@ int em28xx_capture_start(struct em28xx *dev, int start)
 
 	return rc;
 }
-EXPORT_SYMBOL_GPL(em28xx_capture_start);
 
 int em28xx_vbi_supported(struct em28xx *dev)
 {
@@ -1008,6 +1007,31 @@ void em28xx_uninit_isoc(struct em28xx *dev, enum em28xx_mode mode)
 EXPORT_SYMBOL_GPL(em28xx_uninit_isoc);
 
 /*
+ * Stop URBs
+ */
+void em28xx_stop_urbs(struct em28xx *dev)
+{
+	int i;
+	struct urb *urb;
+	struct em28xx_usb_isoc_bufs *isoc_bufs = &dev->isoc_ctl.digital_bufs;
+
+	em28xx_isocdbg("em28xx: called em28xx_stop_urbs\n");
+
+	for (i = 0; i < isoc_bufs->num_bufs; i++) {
+		urb = isoc_bufs->urb[i];
+		if (urb) {
+			if (!irqs_disabled())
+				usb_kill_urb(urb);
+			else
+				usb_unlink_urb(urb);
+		}
+	}
+
+	em28xx_capture_start(dev, 0);
+}
+EXPORT_SYMBOL_GPL(em28xx_stop_urbs);
+
+/*
  * Allocate URBs
  */
 int em28xx_alloc_isoc(struct em28xx *dev, enum em28xx_mode mode,
diff --git a/drivers/media/video/em28xx/em28xx-dvb.c b/drivers/media/video/em28xx/em28xx-dvb.c
index 503a8d5..2d73ee2 100644
--- a/drivers/media/video/em28xx/em28xx-dvb.c
+++ b/drivers/media/video/em28xx/em28xx-dvb.c
@@ -183,7 +183,7 @@ static int em28xx_stop_streaming(struct em28xx_dvb *dvb)
 {
 	struct em28xx *dev = dvb->adapter.priv;
 
-	em28xx_capture_start(dev, 0);
+	em28xx_stop_urbs(dev);
 
 	em28xx_set_mode(dev, EM28XX_SUSPEND);
 
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h
index 2868b19..286b9f8 100644
--- a/drivers/media/video/em28xx/em28xx.h
+++ b/drivers/media/video/em28xx/em28xx.h
@@ -695,6 +695,7 @@ int em28xx_init_isoc(struct em28xx *dev, enum em28xx_mode mode,
 		     int max_packets, int num_bufs, int max_pkt_size,
 		     int (*isoc_copy) (struct em28xx *dev, struct urb *urb));
 void em28xx_uninit_isoc(struct em28xx *dev, enum em28xx_mode mode);
+void em28xx_stop_urbs(struct em28xx *dev);
 int em28xx_isoc_dvb_max_packetsize(struct em28xx *dev);
 int em28xx_set_mode(struct em28xx *dev, enum em28xx_mode set_mode);
 int em28xx_gpio_set(struct em28xx *dev, struct em28xx_reg_seq *gpio);
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-03-22 12:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-22 11:00 current em28xx driver crashes Antti Palosaari
2012-03-22 11:28 ` Gianluca Gennari
2012-03-22 12:48   ` [PATCH] em28xx-dvb: stop URBs when stopping the streaming Gianluca Gennari

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).