You are not logged in.

#1 2023-06-11 16:45:01

hamelg
Member
From: France
Registered: 2008-06-19
Posts: 126

dvb broken with 6.3.7

My dvb-t adapter no longer works after upgrading linux kernel to 6.3.7. 6.3.6 works well.

On startup, Mythbackend hangs and these errors appear in the dmesg logs :

juin 11 16:02:56 darkstar kernel: INFO: task mythbackend:2659 blocked for more than 122 seconds.
juin 11 16:02:56 darkstar kernel:       Tainted: G           OE      6.3.7-arch1-1 #1
juin 11 16:02:56 darkstar kernel: "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
juin 11 16:02:56 darkstar kernel: task:mythbackend     state:D stack:0     pid:2659  ppid:1      flags:0x00000002
juin 11 16:02:56 darkstar kernel: Call Trace:
juin 11 16:02:56 darkstar kernel:  <TASK>
juin 11 16:02:56 darkstar kernel:  __schedule+0x443/0x1400
juin 11 16:02:56 darkstar kernel:  ? sysvec_apic_timer_interrupt+0xe/0x90
juin 11 16:02:56 darkstar kernel:  schedule+0x5e/0xd0
juin 11 16:02:56 darkstar kernel:  schedule_preempt_disabled+0x15/0x30
juin 11 16:02:56 darkstar kernel:  __mutex_lock.constprop.0+0x39a/0x6a0
juin 11 16:02:56 darkstar kernel:  ? drain_stock+0x5e/0xa0
juin 11 16:02:56 darkstar kernel:  dvb_frontend_stop+0x3b/0x1e0 [dvb_core fa4ed5e13d63ae02972c3d6d952f98420ae6d574]
juin 11 16:02:56 darkstar kernel:  ? __mod_memcg_lruvec_state+0x45/0x90
juin 11 16:02:56 darkstar kernel:  ? mod_memcg_lruvec_state+0x15/0x30
juin 11 16:02:56 darkstar kernel:  dvb_frontend_open+0x1ac/0x5b0 [dvb_core fa4ed5e13d63ae02972c3d6d952f98420ae6d574]
juin 11 16:02:56 darkstar kernel:  dvb_device_open+0xbd/0x120 [dvb_core fa4ed5e13d63ae02972c3d6d952f98420ae6d574]
juin 11 16:02:56 darkstar kernel:  chrdev_open+0xc8/0x250
juin 11 16:02:56 darkstar kernel:  ? __pfx_chrdev_open+0x10/0x10
juin 11 16:02:56 darkstar kernel:  do_dentry_open+0x1e5/0x460
juin 11 16:02:56 darkstar kernel:  path_openat+0xd47/0x1170
juin 11 16:02:56 darkstar kernel:  do_filp_open+0xb3/0x160
juin 11 16:02:56 darkstar kernel:  do_sys_openat2+0xaf/0x170
juin 11 16:02:56 darkstar kernel:  __x64_sys_openat+0x57/0xa0
juin 11 16:02:56 darkstar kernel:  do_syscall_64+0x60/0x90
juin 11 16:02:56 darkstar kernel:  ? syscall_exit_to_user_mode+0x1b/0x40
juin 11 16:02:56 darkstar kernel:  ? do_syscall_64+0x6c/0x90
juin 11 16:02:56 darkstar kernel:  ? exc_page_fault+0x7c/0x180
juin 11 16:02:56 darkstar kernel:  entry_SYSCALL_64_after_hwframe+0x72/0xdc
juin 11 16:02:56 darkstar kernel: RIP: 0033:0x7f58f850f900
juin 11 16:02:56 darkstar kernel: RSP: 002b:00007ffc9c0e82f0 EFLAGS: 00000293 ORIG_RAX: 0000000000000101
juin 11 16:02:56 darkstar kernel: RAX: ffffffffffffffda RBX: 0000000000000802 RCX: 00007f58f850f900
juin 11 16:02:56 darkstar kernel: RDX: 0000000000000802 RSI: 0000563d19340d78 RDI: 00000000ffffff9c
juin 11 16:02:56 darkstar kernel: RBP: 0000563d19340d78 R08: 0000000000000000 R09: 0000000000000018
juin 11 16:02:56 darkstar kernel: R10: 0000000000000000 R11: 0000000000000293 R12: 0000563d1933c190
juin 11 16:02:56 darkstar kernel: R13: 00007ffc9c0e8388 R14: 00007ffc9c0e8390 R15: 00007ffc9c0e84f0
juin 11 16:02:56 darkstar kernel:  </TASK>

The culprit is a set of dvb-related fixes committed in 6.3.7. Some have reported the issue and a fix has been committed:

https://lore.kernel.org/lkml/da5382ad-0 … @lio96.de/

Offline

#2 2023-06-12 15:56:39

agapito
Member
From: Spain
Registered: 2008-11-13
Posts: 633

Re: dvb broken with 6.3.7

I had this problem and this patch fixes it:

---
 drivers/media/dvb-core/dvb_frontend.c | 53 +++++----------------------
 include/media/dvb_frontend.h          |  6 +--
 2 files changed, 10 insertions(+), 49 deletions(-)

diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c
index bc6950a5740f..9293b058ab99 100644
--- a/drivers/media/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb-core/dvb_frontend.c
@@ -817,26 +817,15 @@ static void dvb_frontend_stop(struct dvb_frontend *fe)

 	dev_dbg(fe->dvb->device, "%s:\n", __func__);

-	mutex_lock(&fe->remove_mutex);
-
 	if (fe->exit != DVB_FE_DEVICE_REMOVED)
 		fe->exit = DVB_FE_NORMAL_EXIT;
 	mb();

-	if (!fepriv->thread) {
-		mutex_unlock(&fe->remove_mutex);
+	if (!fepriv->thread)
 		return;
-	}

 	kthread_stop(fepriv->thread);

-	mutex_unlock(&fe->remove_mutex);
-
-	if (fepriv->dvbdev->users < -1) {
-		wait_event(fepriv->dvbdev->wait_queue,
-			   fepriv->dvbdev->users == -1);
-	}
-
 	sema_init(&fepriv->sem, 1);
 	fepriv->state = FESTATE_IDLE;

@@ -2780,13 +2769,9 @@ static int dvb_frontend_open(struct inode *inode, struct file *file)
 	struct dvb_adapter *adapter = fe->dvb;
 	int ret;

-	mutex_lock(&fe->remove_mutex);
-
 	dev_dbg(fe->dvb->device, "%s:\n", __func__);
-	if (fe->exit == DVB_FE_DEVICE_REMOVED) {
-		ret = -ENODEV;
-		goto err_remove_mutex;
-	}
+	if (fe->exit == DVB_FE_DEVICE_REMOVED)
+		return -ENODEV;

 	if (adapter->mfe_shared == 2) {
 		mutex_lock(&adapter->mfe_lock);
@@ -2794,8 +2779,7 @@ static int dvb_frontend_open(struct inode *inode, struct file *file)
 			if (adapter->mfe_dvbdev &&
 			    !adapter->mfe_dvbdev->writers) {
 				mutex_unlock(&adapter->mfe_lock);
-				ret = -EBUSY;
-				goto err_remove_mutex;
+				return -EBUSY;
 			}
 			adapter->mfe_dvbdev = dvbdev;
 		}
@@ -2818,10 +2802,8 @@ static int dvb_frontend_open(struct inode *inode, struct file *file)
 			while (mferetry-- && (mfedev->users != -1 ||
 					      mfepriv->thread)) {
 				if (msleep_interruptible(500)) {
-					if (signal_pending(current)) {
-						ret = -EINTR;
-						goto err_remove_mutex;
-					}
+					if (signal_pending(current))
+						return -EINTR;
 				}
 			}

@@ -2833,8 +2815,7 @@ static int dvb_frontend_open(struct inode *inode, struct file *file)
 				if (mfedev->users != -1 ||
 				    mfepriv->thread) {
 					mutex_unlock(&adapter->mfe_lock);
-					ret = -EBUSY;
-					goto err_remove_mutex;
+					return -EBUSY;
 				}
 				adapter->mfe_dvbdev = dvbdev;
 			}
@@ -2893,8 +2874,6 @@ static int dvb_frontend_open(struct inode *inode, struct file *file)

 	if (adapter->mfe_shared)
 		mutex_unlock(&adapter->mfe_lock);
-
-	mutex_unlock(&fe->remove_mutex);
 	return ret;

 err3:
@@ -2916,9 +2895,6 @@ static int dvb_frontend_open(struct inode *inode, struct file *file)
 err0:
 	if (adapter->mfe_shared)
 		mutex_unlock(&adapter->mfe_lock);
-
-err_remove_mutex:
-	mutex_unlock(&fe->remove_mutex);
 	return ret;
 }

@@ -2929,8 +2905,6 @@ static int dvb_frontend_release(struct inode *inode, struct file *file)
 	struct dvb_frontend_private *fepriv = fe->frontend_priv;
 	int ret;

-	mutex_lock(&fe->remove_mutex);
-
 	dev_dbg(fe->dvb->device, "%s:\n", __func__);

 	if ((file->f_flags & O_ACCMODE) != O_RDONLY) {
@@ -2952,18 +2926,10 @@ static int dvb_frontend_release(struct inode *inode, struct file *file)
 		}
 		mutex_unlock(&fe->dvb->mdev_lock);
 #endif
+		if (fe->exit != DVB_FE_NO_EXIT)
+			wake_up(&dvbdev->wait_queue);
 		if (fe->ops.ts_bus_ctrl)
 			fe->ops.ts_bus_ctrl(fe, 0);
-
-		if (fe->exit != DVB_FE_NO_EXIT) {
-			mutex_unlock(&fe->remove_mutex);
-			wake_up(&dvbdev->wait_queue);
-		} else {
-			mutex_unlock(&fe->remove_mutex);
-		}
-
-	} else {
-		mutex_unlock(&fe->remove_mutex);
 	}

 	dvb_frontend_put(fe);
@@ -3064,7 +3030,6 @@ int dvb_register_frontend(struct dvb_adapter *dvb,
 	fepriv = fe->frontend_priv;

 	kref_init(&fe->refcount);
-	mutex_init(&fe->remove_mutex);

 	/*
 	 * After initialization, there need to be two references: one
diff --git a/include/media/dvb_frontend.h b/include/media/dvb_frontend.h
index 367d5381217b..e7c44870f20d 100644
--- a/include/media/dvb_frontend.h
+++ b/include/media/dvb_frontend.h
@@ -686,10 +686,7 @@ struct dtv_frontend_properties {
  * @id:			Frontend ID
  * @exit:		Used to inform the DVB core that the frontend
  *			thread should exit (usually, means that the hardware
- *			got disconnected).
- * @remove_mutex:	mutex that avoids a race condition between a callback
- *			called when the hardware is disconnected and the
- *			file_operations of dvb_frontend.
+ *			got disconnected.
  */

 struct dvb_frontend {
@@ -707,7 +704,6 @@ struct dvb_frontend {
 	int (*callback)(void *adapter_priv, int component, int cmd, int arg);
 	int id;
 	unsigned int exit;
-	struct mutex remove_mutex;
 };

 /**
--
 

Excuse my poor English.

Offline

#3 2023-06-16 08:13:05

C-Klaus
Member
Registered: 2015-04-29
Posts: 23

Re: dvb broken with 6.3.7

Same problem here running tvheadend using dvb-s even with newest kernel 6.3.8. With kernel 6.3.6 all is fine.

Offline

#4 2023-06-17 12:47:07

loqs
Member
Registered: 2014-03-06
Posts: 17,141

Re: dvb broken with 6.3.7

C-Klaus wrote:

Same problem here running tvheadend using dvb-s even with newest kernel 6.3.8.

Edit:
Queued for 6.3.9
https://git.kernel.org/pub/scm/linux/ke … 6476812f63

Last edited by loqs (2023-06-18 14:44:24)

Offline

Board footer

Powered by FluxBB