linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG] process stuck when closing saa7146 [dvb_ttpci]
@ 2016-09-11 13:33 Philipp Matthias Hahn
  2016-09-16 10:00 ` [PATCH] Potential fix for "[BUG] process stuck when closing saa7146 [dvb_ttpci]" Andrey Utkin
  0 siblings, 1 reply; 5+ messages in thread
From: Philipp Matthias Hahn @ 2016-09-11 13:33 UTC (permalink / raw)
  To: linux-media; +Cc: Hans Verkuil

Hello,

I own a 
| 04:07.0 Multimedia controller: Philips Semiconductors SAA7146 (rev 01)
|         Subsystem: Siemens AG Fujitsu/Siemens DVB-C card rev1.5
|         Flags: bus master, medium devsel, latency 64, IRQ 16
|         Memory at febff800 (32-bit, non-prefetchable) [size=512]
|         Kernel driver in use: av7110
|         Kernel modules: dvb_ttpci
with the analog module, which I still sometimes use to digitalize some old
videos. I'm using ffmpeg to read /dev/video0, which sometimes doesn't terminate
when I stop the proces with SIGINT. The Linux kernel then starts logging this message:

> INFO: task ffmpeg:9864 blocked for more than 120 seconds.
>       Tainted: P           O    4.6.7 #3
> "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
> ffmpeg          D ffff880177cc7b00     0  9864      1 0x00000000
>  ffff880177cc7b00 0000000000000202 0000000000000202 ffffffff8180b4c0
>  ffff88019d79e4c0 ffffffff81064050 ffff880177cc7ae0 ffff880177cc8000
>  ffff880177cc7b18 ffff8801fd41d648 ffff8802307acca0 ffff8802307acc70
> Call Trace:
>  [<ffffffff81064050>] ? preempt_count_add+0x89/0xab
>  [<ffffffff81477215>] schedule+0x86/0x9e
>  [<ffffffff81477215>] ? schedule+0x86/0x9e
>  [<ffffffffa0fe1c96>] videobuf_waiton+0x131/0x15e [videobuf_core]
>  [<ffffffff8107727b>] ? wait_woken+0x6d/0x6d
>  [<ffffffffa1017be9>] saa7146_dma_free+0x39/0x5b [saa7146_vv]
>  [<ffffffffa10186c4>] buffer_release+0x2a/0x3e [saa7146_vv]
>  [<ffffffffa0fee4a8>] videobuf_vm_close+0xd8/0x103 [videobuf_dma_sg]
>  [<ffffffff8112049e>] remove_vma+0x25/0x4d
>  [<ffffffff81121a32>] exit_mmap+0xce/0xf7
>  [<ffffffff8104381d>] mmput+0x4e/0xe2
>  [<ffffffff810491fd>] do_exit+0x372/0x920
>  [<ffffffff81049813>] do_group_exit+0x3c/0x98
>  [<ffffffff810522ef>] get_signal+0x4e8/0x56e
>  [<ffffffff810710a5>] ? task_dead_fair+0xd/0xf
>  [<ffffffff81017020>] do_signal+0x23/0x521
>  [<ffffffff81479e82>] ? _raw_spin_unlock_irqrestore+0x13/0x25
>  [<ffffffff8109710d>] ? hrtimer_try_to_cancel+0xd7/0x104
>  [<ffffffff8109b306>] ? ktime_get+0x4c/0xa1
>  [<ffffffff81096ea6>] ? update_rmtp+0x46/0x5b
>  [<ffffffff81097ce0>] ? hrtimer_nanosleep+0xe4/0x10e
>  [<ffffffff81096e3c>] ? hrtimer_init+0xeb/0xeb
>  [<ffffffff810014f8>] exit_to_usermode_loop+0x4f/0x93
>  [<ffffffff810019fe>] syscall_return_slowpath+0x3b/0x46
>  [<ffffffff8147a355>] entry_SYSCALL_64_fastpath+0x8d/0x8f

I'm running Debian-Sid on linux-4.6.7.
I need to reboot the PC to get back a working /dev/video0

- Is this a known problem?
- Is the a fix?
- What extra data is needed to fix it?

Thanks in advance.
Philipp
-- 
  / /  (_)__  __ ____  __ Philipp Hahn
 / /__/ / _ \/ // /\ \/ /
/____/_/_//_/\_,_/ /_/\_\ pmhahn@pmhahn.de

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

* [PATCH] Potential fix for "[BUG] process stuck when closing saa7146 [dvb_ttpci]"
  2016-09-11 13:33 [BUG] process stuck when closing saa7146 [dvb_ttpci] Philipp Matthias Hahn
@ 2016-09-16 10:00 ` Andrey Utkin
  2016-09-19  5:08   ` Philipp Hahn
  0 siblings, 1 reply; 5+ messages in thread
From: Andrey Utkin @ 2016-09-16 10:00 UTC (permalink / raw)
  To: linux-media, pmhahn+video; +Cc: hverkuil, Andrey Utkin

Hi Philipp,
Please try this patch. It is purely speculative as I don't have the hardware,
but I hope my approach is right.

---
 drivers/media/common/saa7146/saa7146_video.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/media/common/saa7146/saa7146_video.c b/drivers/media/common/saa7146/saa7146_video.c
index ea2f3bf..93c64f0 100644
--- a/drivers/media/common/saa7146/saa7146_video.c
+++ b/drivers/media/common/saa7146/saa7146_video.c
@@ -390,6 +390,7 @@ static int video_end(struct saa7146_fh *fh, struct file *file)
 {
 	struct saa7146_dev *dev = fh->dev;
 	struct saa7146_vv *vv = dev->vv_data;
+	struct saa7146_dmaqueue *q = &vv->video_dmaq;
 	struct saa7146_format *fmt = NULL;
 	unsigned long flags;
 	unsigned int resource;
@@ -428,6 +429,9 @@ static int video_end(struct saa7146_fh *fh, struct file *file)
 	/* shut down all used video dma transfers */
 	saa7146_write(dev, MC1, dmas);
 
+	if(q->curr)
+		saa7146_buffer_finish(dev, q, VIDEOBUF_DONE);
+
 	spin_unlock_irqrestore(&dev->slock, flags);
 
 	vv->video_fh = NULL;
-- 
2.9.2


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

* Re: [PATCH] Potential fix for "[BUG] process stuck when closing saa7146 [dvb_ttpci]"
  2016-09-16 10:00 ` [PATCH] Potential fix for "[BUG] process stuck when closing saa7146 [dvb_ttpci]" Andrey Utkin
@ 2016-09-19  5:08   ` Philipp Hahn
  2016-10-16 21:52     ` Philipp Matthias Hahn
  0 siblings, 1 reply; 5+ messages in thread
From: Philipp Hahn @ 2016-09-19  5:08 UTC (permalink / raw)
  To: Andrey Utkin, linux-media; +Cc: hverkuil

Hello Andrey,

Am 16.09.2016 um 12:00 schrieb Andrey Utkin:
> Please try this patch. It is purely speculative as I don't have the hardware,
> but I hope my approach is right.

Thanks you for the patch; I've built a new kernel but didn't have the
time to test it yet; I'll mail you again as soon as I have tested it.

Thanks you for looking into that issues.

Philipp

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

* Re: [PATCH] Potential fix for "[BUG] process stuck when closing saa7146 [dvb_ttpci]"
  2016-09-19  5:08   ` Philipp Hahn
@ 2016-10-16 21:52     ` Philipp Matthias Hahn
  2018-02-10 12:28       ` Philipp Matthias Hahn
  0 siblings, 1 reply; 5+ messages in thread
From: Philipp Matthias Hahn @ 2016-10-16 21:52 UTC (permalink / raw)
  To: Andrey Utkin; +Cc: linux-media, hverkuil

Hello Andrey,

On Mon, Sep 19, 2016 at 07:08:52AM +0200, Philipp Hahn wrote:
> Am 16.09.2016 um 12:00 schrieb Andrey Utkin:
> > Please try this patch. It is purely speculative as I don't have the hardware,
> > but I hope my approach is right.
> 
> Thanks you for the patch; I've built a new kernel but didn't have the
> time to test it yet; I'll mail you again as soon as I have tested it.

I tested your patch and during my limites testing I wan't able to
reproduce the previous problem. Seems you fixed it.

Tested-by: Philipp Matthias Hahn <pmhahn@pmhahn.de>

Thanks you again for looking into that issues.

Philipp
-- 
  / /  (_)__  __ ____  __ Philipp Hahn
 / /__/ / _ \/ // /\ \/ /
/____/_/_//_/\_,_/ /_/\_\ pmhahn@pmhahn.de

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

* Re: [PATCH] Potential fix for "[BUG] process stuck when closing saa7146 [dvb_ttpci]"
  2016-10-16 21:52     ` Philipp Matthias Hahn
@ 2018-02-10 12:28       ` Philipp Matthias Hahn
  0 siblings, 0 replies; 5+ messages in thread
From: Philipp Matthias Hahn @ 2018-02-10 12:28 UTC (permalink / raw)
  To: Andrey Utkin; +Cc: linux-media, hverkuil

Hello Andrey,

On Sun, Oct 16, 2016 at 11:52:19PM +0200, Philipp Matthias Hahn wrote:
> On Mon, Sep 19, 2016 at 07:08:52AM +0200, Philipp Hahn wrote:
> > Am 16.09.2016 um 12:00 schrieb Andrey Utkin:
> > > Please try this patch. It is purely speculative as I don't have the hardware,
> > > but I hope my approach is right.
> > 
> > Thanks you for the patch; I've built a new kernel but didn't have the
> > time to test it yet; I'll mail you again as soon as I have tested it.
> 
> I tested your patch and during my limites testing I wan't able to
> reproduce the previous problem. Seems you fixed it.
> 
> Tested-by: Philipp Matthias Hahn <pmhahn@pmhahn.de>
> 
> Thanks you again for looking into that issues.

Bad news: I'm running linux-4.15.2 by now and again got a stuck ffmpeg
process after accessing /dev/video0:

| INFO: task read_thread:20579 blocked for more than 120 seconds.
|       Tainted: P           O     4.15.2 #1
| "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
| read_thread     D    0 20579   2949 0x80000000
| Call Trace:
|  ? __schedule+0x646/0x697
|  schedule+0x79/0x94
|  videobuf_waiton+0x11c/0x148 [videobuf_core]
|  ? wait_woken+0x68/0x68
|  saa7146_dma_free+0x34/0x55 [saa7146_vv]
|  buffer_release+0x25/0x33 [saa7146_vv]
|  videobuf_vm_close+0xd6/0x103 [videobuf_dma_sg]
|  remove_vma+0x23/0x49
|  exit_mmap+0xea/0x114
|  mmput+0x45/0xdb
|  do_exit+0x3a0/0x8c1
|  do_group_exit+0x95/0x95
|  get_signal+0x41c/0x447
|  do_signal+0x1e/0x4c2
|  ? __schedule+0x646/0x697
|  ? do_task_dead+0x38/0x3a
|  ? SyS_futex+0x127/0x137
|  exit_to_usermode_loop+0x1f/0x69
|  do_syscall_64+0xe3/0xea
|  entry_SYSCALL_64_after_hwframe+0x21/0x86
| RIP: 0033:0x7f56429927fd
| RSP: 002b:00007f56217b3550 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
| RAX: fffffffffffffe00 RBX: 00007f5608002320 RCX: 00007f56429927fd
| RDX: 0000000000000000 RSI: 0000000000000080 RDI: 00007f560800234c
| RBP: 0000000000000000 R08: 0000000000000000 R09: 00007f5608002320
| R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000003
| R13: 00007f56080022f8 R14: 0000000000000000 R15: 00007f560800234c

Your previous patch is applied since v4.10-rc1~71^2^2~34 , so the issue seems
to be not fixed.
The tainting is from the NVidia driver.

Philipp

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

end of thread, other threads:[~2018-02-10 12:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-11 13:33 [BUG] process stuck when closing saa7146 [dvb_ttpci] Philipp Matthias Hahn
2016-09-16 10:00 ` [PATCH] Potential fix for "[BUG] process stuck when closing saa7146 [dvb_ttpci]" Andrey Utkin
2016-09-19  5:08   ` Philipp Hahn
2016-10-16 21:52     ` Philipp Matthias Hahn
2018-02-10 12:28       ` Philipp Matthias Hahn

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).