1. 21 10月, 2015 1 次提交
  2. 01 10月, 2015 6 次提交
  3. 26 9月, 2015 3 次提交
    • H
      [media] v4l2-compat-ioctl32: replace pr_warn by pr_debug · 9ec32cc7
      Hans Verkuil 提交于
      Every time compat32 encounters an unknown ioctl it will call pr_warn.
      However, that's very irritating since it is perfectly normal that this
      happens. For example, applications often try to call an ioctl to see if
      it exists, and if that's used with an older kernel where compat32 doesn't
      support that ioctl yet, then it starts spamming the kernel log.
      
      So replace pr_warn by pr_debug.
      Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
      Acked-by: NSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      9ec32cc7
    • A
      [media] v4l2-compat-ioctl32: fix alignment for ARM64 · 655e9780
      Andrzej Hajda 提交于
      Alignment/padding rules on AMD64 and ARM64 differs. To allow properly match
      compatible ioctls on ARM64 kernels without breaking AMD64 some fields
      should be aligned using compat_s64 type and in one case struct should be
      unpacked.
      Signed-off-by: NAndrzej Hajda <a.hajda@samsung.com>
      Cc: <stable@vger.kernel.org>      # for v3.10 and up
      [hans.verkuil@cisco.com: use compat_u64 instead of compat_s64 in v4l2_input32]
      Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      655e9780
    • Z
      [media] m2m: fix bad unlock balance · f1a81afc
      Zahari Doychev 提交于
      This patch removes unnecessary mutex queue unlock/lock sequence causing bad
      unlock balance in v4l2_m2m_poll when the last buffer on the destination
      queue has been dequeued and adds spin lock protection for the done list
      list_empty calls.
      
      [  144.990873] =====================================
      [  144.995584] [ BUG: bad unlock balance detected! ]
      [  145.000301] 4.1.0-00137-ga105070 #98 Tainted: G        W
      [  145.006140] -------------------------------------
      [  145.010851] demux:sink/487 is trying to release lock (&dev->dev_mutex) at:
      [  145.017785] [<808cc578>] mutex_unlock+0x18/0x1c
      [  145.022322] but there are no more locks to release!
      [  145.027205]
      [  145.027205] other info that might help us debug this:
      [  145.033741] no locks held by demux:sink/487.
      [  145.038015]
      [  145.038015] stack backtrace:
      [  145.042385] CPU: 2 PID: 487 Comm: demux:sink Tainted: G        W       4.1.0-00137-ga105070 #98
      [  145.051089] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
      [  145.057622] Backtrace:
      [  145.060102] [<80014a4c>] (dump_backtrace) from [<80014cc4>] (show_stack+0x20/0x24)
      [  145.067679]  r6:80cedf78 r5:00000000 r4:00000000 r3:00000000
      [  145.073421] [<80014ca4>] (show_stack) from [<808c61e0>] (dump_stack+0x8c/0xa4)
      [  145.080661] [<808c6154>] (dump_stack) from [<80072b64>] (print_unlock_imbalance_bug+0xb8/0xe8)
      [  145.089277]  r6:808cc578 r5:ac6cd050 r4:ac38e400 r3:00000001
      [  145.095020] [<80072aac>] (print_unlock_imbalance_bug) from [<80077db4>] (lock_release+0x1a4/0x250)
      [  145.103983]  r6:808cc578 r5:ac6cd050 r4:ac38e400 r3:00000000
      [  145.109728] [<80077c10>] (lock_release) from [<808cc470>] (__mutex_unlock_slowpath+0xc4/0x1b4)
      [  145.118344]  r9:acb27a41 r8:00000000 r7:81553814 r6:808cc578 r5:60030013 r4:ac6cd01c
      [  145.126190] [<808cc3ac>] (__mutex_unlock_slowpath) from [<808cc578>] (mutex_unlock+0x18/0x1c)
      [  145.134720]  r7:00000000 r6:aced7cd4 r5:00000041 r4:acb87800
      [  145.140468] [<808cc560>] (mutex_unlock) from [<805a98b8>] (v4l2_m2m_fop_poll+0x5c/0x64)
      [  145.148494] [<805a985c>] (v4l2_m2m_fop_poll) from [<805955a0>] (v4l2_poll+0x6c/0xa0)
      [  145.156243]  r6:aced7bec r5:00000000 r4:ac6cc380 r3:805a985c
      [  145.161991] [<80595534>] (v4l2_poll) from [<80156edc>] (do_sys_poll+0x230/0x4c0)
      [  145.169391]  r5:00000000 r4:aced7be4
      [  145.173013] [<80156cac>] (do_sys_poll) from [<801574a8>] (SyS_ppoll+0x1d4/0x1fc)
      [  145.180414]  r10:00000000 r9:aced6000 r8:00000000 r7:00000000 r6:75c04538 r5:00000002
      [  145.188338]  r4:00000000
      [  145.190906] [<801572d4>] (SyS_ppoll) from [<800108c0>] (ret_fast_syscall+0x0/0x54)
      [  145.198481]  r8:80010aa4 r7:00000150 r6:75c04538 r5:00000002 r4:00000008
      Signed-off-by: NZahari Doychev <zahari.doychev@linux.com>
      Acked-by: NMarek Szyprowski <m.szyprowski@samsung.com>
      Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      f1a81afc
  4. 17 8月, 2015 6 次提交
  5. 12 8月, 2015 1 次提交
  6. 11 8月, 2015 3 次提交
    • P
      [media] v4l2: move tracepoint generation into separate file · 9deb6ad6
      Philipp Zabel 提交于
      To compile videobuf2-core as a module, the vb2_* tracepoints must be
      exported from the videodev module. Instead of exporting vb2 tracepoint
      symbols from v4l2-ioctl.c, move the tracepoint generation into a separate
      file. This patch fixes the following build error in the modpost stage,
      introduced by 2091f518 ("[media] videobuf2: add trace events"):
      
          ERROR: "__tracepoint_vb2_buf_done" undefined!
          ERROR: "__tracepoint_vb2_dqbuf" undefined!
          ERROR: "__tracepoint_vb2_qbuf" undefined!
          ERROR: "__tracepoint_vb2_buf_queue" undefined!
      Suggested-by: NSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NPhilipp Zabel <p.zabel@pengutronix.de>
      Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      9deb6ad6
    • L
      [media] v4l2-ioctl: Give more information when device_caps are missing · 6d7570c4
      Laura Abbott 提交于
      Currently, the warning for missing device_caps gives a backtrace like so:
      
      [<ffffffff8175c199>] dump_stack+0x45/0x57
      [<ffffffff8109ad5a>] warn_slowpath_common+0x8a/0xc0
      [<ffffffff8109ae8a>] warn_slowpath_null+0x1a/0x20
      [<ffffffffa0237453>] v4l_querycap+0x43/0x80 [videodev]
      [<ffffffffa0237734>] __video_do_ioctl+0x2a4/0x320 [videodev]
      [<ffffffff812207e5>] ? do_last+0x195/0x1210
      [<ffffffffa023a11e>] video_usercopy+0x22e/0x5b0 [videodev]
      [<ffffffffa0237490>] ? v4l_querycap+0x80/0x80 [videodev]
      [<ffffffffa023a4b5>] video_ioctl2+0x15/0x20 [videodev]
      [<ffffffffa0233733>] v4l2_ioctl+0x113/0x150 [videodev]
      [<ffffffff81225798>] do_vfs_ioctl+0x2f8/0x4f0
      [<ffffffff8113b2d4>] ? __audit_syscall_entry+0xb4/0x110
      [<ffffffff81022d7c>] ? do_audit_syscall_entry+0x6c/0x70
      [<ffffffff81225a11>] SyS_ioctl+0x81/0xa0
      [<ffffffff8113b526>] ? __audit_syscall_exit+0x1f6/0x2a0
      [<ffffffff81763549>] system_call_fastpath+0x12/0x17
      
      This indicates that device_caps are missing but doesn't give
      much of a clue which driver is actually at fault. Improve
      the warning output by showing the capabilities and the
      responsible driver.
      Signed-off-by: NLaura Abbott <labbott@fedoraproject.org>
      Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      6d7570c4
    • H
      [media] v4l2-mem2mem: drop lock in v4l2_m2m_fop_mmap · e752577e
      Hans Verkuil 提交于
      The v4l2_m2m_fop_mmap function takes the core mutex, but this will result in a potential
      circular locking dependency:
      
      [  262.517164] ======================================================
      [  262.517166] [ INFO: possible circular locking dependency detected ]
      [  262.517169] 4.2.0-rc2-koryphon #844 Not tainted
      [  262.517171] -------------------------------------------------------
      [  262.517173] v4l2-compliance/1379 is trying to acquire lock:
      [  262.517175]  (&dev->dev_mutex){+.+.+.}, at: [<ffffffffa000ddab>] v4l2_m2m_fop_mmap+0x2b/0x90 [v4l2_mem2mem]
      [  262.517187]
                     but task is already holding lock:
      [  262.517189]  (&mm->mmap_sem){++++++}, at: [<ffffffff81159309>] vm_mmap_pgoff+0x69/0xc0
      [  262.517199]
                     which lock already depends on the new lock.
      
      [  262.517202]
                     the existing dependency chain (in reverse order) is:
      [  262.517204]
                     -> #1 (&mm->mmap_sem){++++++}:
      [  262.517209]        [<ffffffff810d0e6b>] __lock_acquire+0x62b/0xe80
      [  262.517215]        [<ffffffff810d2095>] lock_acquire+0x65/0x90
      [  262.517218]        [<ffffffff811612e5>] __might_fault+0x75/0xa0
      [  262.517222]        [<ffffffffa06dead9>] video_usercopy+0x3e9/0x4e0 [videodev]
      [  262.517231]        [<ffffffffa06debe0>] video_ioctl2+0x10/0x20 [videodev]
      [  262.517238]        [<ffffffffa06d8663>] v4l2_ioctl+0xc3/0xe0 [videodev]
      [  262.517243]        [<ffffffff811a8cac>] do_vfs_ioctl+0x2fc/0x550
      [  262.517248]        [<ffffffff811a8f74>] SyS_ioctl+0x74/0x80
      [  262.517252]        [<ffffffff81a4d2ee>] entry_SYSCALL_64_fastpath+0x12/0x76
      [  262.517258]
                     -> #0 (&dev->dev_mutex){+.+.+.}:
      [  262.517262]        [<ffffffff810cf464>] validate_chain.isra.38+0xd04/0x1170
      [  262.517266]        [<ffffffff810d0e6b>] __lock_acquire+0x62b/0xe80
      [  262.517270]        [<ffffffff810d2095>] lock_acquire+0x65/0x90
      [  262.517273]        [<ffffffff81a48e3c>] mutex_lock_interruptible_nested+0x6c/0x4b0
      [  262.517279]        [<ffffffffa000ddab>] v4l2_m2m_fop_mmap+0x2b/0x90 [v4l2_mem2mem]
      [  262.517284]        [<ffffffffa06d80ff>] v4l2_mmap+0x4f/0x90 [videodev]
      [  262.517288]        [<ffffffff8116b06c>] mmap_region+0x38c/0x5b0
      [  262.517293]        [<ffffffff8116b585>] do_mmap_pgoff+0x2f5/0x3e0
      [  262.517297]        [<ffffffff8115932a>] vm_mmap_pgoff+0x8a/0xc0
      [  262.517300]        [<ffffffff81169bab>] SyS_mmap_pgoff+0x1cb/0x270
      [  262.517304]        [<ffffffff8100876d>] SyS_mmap+0x1d/0x20
      [  262.517309]        [<ffffffff81a4d2ee>] entry_SYSCALL_64_fastpath+0x12/0x76
      [  262.517313]
                     other info that might help us debug this:
      
      [  262.517315]  Possible unsafe locking scenario:
      
      [  262.517318]        CPU0                    CPU1
      [  262.517319]        ----                    ----
      [  262.517321]   lock(&mm->mmap_sem);
      [  262.517324]                                lock(&dev->dev_mutex);
      [  262.517327]                                lock(&mm->mmap_sem);
      [  262.517329]   lock(&dev->dev_mutex);
      [  262.517332]
                      *** DEADLOCK ***
      
      Since vb2_fop_mmap doesn't take the lock, neither should v4l2_m2m_fop_mmap.
      Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
      Tested-by: NMikhail Ulyanov <mikhail.ulyanov@cogentembedded.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      e752577e
  7. 10 8月, 2015 1 次提交
  8. 07 8月, 2015 1 次提交
  9. 17 7月, 2015 5 次提交
  10. 06 7月, 2015 5 次提交
  11. 23 6月, 2015 1 次提交
  12. 22 6月, 2015 1 次提交
  13. 19 6月, 2015 1 次提交
    • H
      [media] Revert "[media] vb2: Push mmap_sem down to memops" · 511a1b8a
      Hans Verkuil 提交于
      This reverts commit 48b25a3a.
      
      That commit caused two regressions. The first is a BUG:
      
      Jun 14 18:42:15 test-media kernel: [  115.972299] BUG: unable to handle kernel NULL pointer dereference at 0000000000000100
      Jun 14 18:42:15 test-media kernel: [  115.972307] IP: [<ffffffff810d5cd0>] __lock_acquire+0x2f0/0x2070
      Jun 14 18:42:15 test-media kernel: [  115.972316] PGD 0
      Jun 14 18:42:15 test-media kernel: [  115.972318] Oops: 0000 [#1] PREEMPT SMP
      Jun 14 18:42:15 test-media kernel: [  115.972321] Modules linked in: vivid v4l2_dv_timings videobuf2_vmalloc videobuf2_memops videobuf2_core v4l2_common videodev media vmw_balloon vmw_vmci acpi_cpufreq processor button
      Jun 14 18:42:15 test-media kernel: [  115.972333] CPU: 0 PID: 1542 Comm: v4l2-ctl Not tainted 4.1.0-rc3-test-media #1190
      Jun 14 18:42:15 test-media kernel: [  115.972336] Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 05/20/2014
      Jun 14 18:42:15 test-media kernel: [  115.972337] task: ffff880220ce4200 ti: ffff88021d16c000 task.ti: ffff88021d16c000
      Jun 14 18:42:15 test-media kernel: [  115.972339] RIP: 0010:[<ffffffff810d5cd0>]  [<ffffffff810d5cd0>] __lock_acquire+0x2f0/0x2070
      Jun 14 18:42:15 test-media kernel: [  115.972342] RSP: 0018:ffff88021d16f9b8  EFLAGS: 00010002
      Jun 14 18:42:15 test-media kernel: [  115.972343] RAX: 0000000000000046 RBX: 0000000000000292 RCX: 0000000000000001
      Jun 14 18:42:15 test-media kernel: [  115.972345] RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000100
      Jun 14 18:42:15 test-media kernel: [  115.972346] RBP: ffff88021d16fa88 R08: 0000000000000001 R09: 0000000000000000
      Jun 14 18:42:15 test-media kernel: [  115.972347] R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000001
      Jun 14 18:42:15 test-media kernel: [  115.972348] R13: ffff880220ce4200 R14: 0000000000000100 R15: 0000000000000000
      Jun 14 18:42:15 test-media kernel: [  115.972350] FS:  00007f2441e7f740(0000) GS:ffff880236e00000(0000) knlGS:0000000000000000
      Jun 14 18:42:15 test-media kernel: [  115.972351] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
      Jun 14 18:42:15 test-media kernel: [  115.972353] CR2: 0000000000000100 CR3: 0000000001e0b000 CR4: 00000000001406f0
      Jun 14 18:42:15 test-media kernel: [  115.972424] Stack:
      Jun 14 18:42:15 test-media kernel: [  115.972427]  ffff88021d16fa98 ffffffff810d6543 0000000000000006 0000000000000246
      Jun 14 18:42:15 test-media kernel: [  115.972431]  ffff88021d16fa08 ffffffff810d532d ffff880220ce4a78 ffff880200000000
      Jun 14 18:42:15 test-media kernel: [  115.972433]  ffff880200000001 0000000000000000 0000000000000001 000000000093a4a0
      Jun 14 18:42:15 test-media kernel: [  115.972436] Call Trace:
      Jun 14 18:42:15 test-media kernel: [  115.972440]  [<ffffffff810d6543>] ? __lock_acquire+0xb63/0x2070
      Jun 14 18:42:15 test-media kernel: [  115.972443]  [<ffffffff810d532d>] ? mark_held_locks+0x6d/0xa0
      Jun 14 18:42:15 test-media kernel: [  115.972445]  [<ffffffff810d37a8>] ? __lock_is_held+0x58/0x80
      Jun 14 18:42:15 test-media kernel: [  115.972447]  [<ffffffff810d852c>] lock_acquire+0x6c/0xa0
      Jun 14 18:42:15 test-media kernel: [  115.972452]  [<ffffffffa039f1f6>] ? vb2_vmalloc_put_userptr+0x36/0x110 [videobuf2_vmalloc]
      Jun 14 18:42:15 test-media kernel: [  115.972458]  [<ffffffff819b1a92>] down_read+0x42/0x60
      Jun 14 18:42:15 test-media kernel: [  115.972460]  [<ffffffffa039f1f6>] ? vb2_vmalloc_put_userptr+0x36/0x110 [videobuf2_vmalloc]
      Jun 14 18:42:15 test-media kernel: [  115.972463]  [<ffffffff819af1b1>] ? mutex_lock_nested+0x2b1/0x560
      Jun 14 18:42:15 test-media kernel: [  115.972467]  [<ffffffffa038fdc5>] ? vb2_queue_release+0x25/0x40 [videobuf2_core]
      Jun 14 18:42:15 test-media kernel: [  115.972469]  [<ffffffffa039f1f6>] vb2_vmalloc_put_userptr+0x36/0x110 [videobuf2_vmalloc]
      Jun 14 18:42:15 test-media kernel: [  115.972472]  [<ffffffffa038b626>] __vb2_queue_free+0x146/0x5e0 [videobuf2_core]
      Jun 14 18:42:15 test-media kernel: [  115.972475]  [<ffffffffa038fdd3>] vb2_queue_release+0x33/0x40 [videobuf2_core]
      Jun 14 18:42:15 test-media kernel: [  115.972478]  [<ffffffffa038fe75>] _vb2_fop_release+0x95/0xb0 [videobuf2_core]
      Jun 14 18:42:15 test-media kernel: [  115.972481]  [<ffffffffa038feb9>] vb2_fop_release+0x29/0x50 [videobuf2_core]
      Jun 14 18:42:15 test-media kernel: [  115.972485]  [<ffffffffa03ad372>] vivid_fop_release+0x92/0x230 [vivid]
      Jun 14 18:42:15 test-media kernel: [  115.972491]  [<ffffffffa0358460>] v4l2_release+0x30/0x80 [videodev]
      Jun 14 18:42:15 test-media kernel: [  115.972496]  [<ffffffff811a51d5>] __fput+0xe5/0x200
      Jun 14 18:42:15 test-media kernel: [  115.972498]  [<ffffffff811a5339>] ____fput+0x9/0x10
      Jun 14 18:42:15 test-media kernel: [  115.972501]  [<ffffffff810a9fa4>] task_work_run+0xc4/0xf0
      Jun 14 18:42:15 test-media kernel: [  115.972504]  [<ffffffff8108c670>] do_exit+0x3a0/0xaf0
      Jun 14 18:42:15 test-media kernel: [  115.972507]  [<ffffffff819b3a9b>] ? _raw_spin_unlock_irq+0x2b/0x60
      Jun 14 18:42:15 test-media kernel: [  115.972509]  [<ffffffff8108e0ff>] do_group_exit+0x4f/0xe0
      Jun 14 18:42:15 test-media kernel: [  115.972511]  [<ffffffff8109a170>] get_signal+0x200/0x8c0
      Jun 14 18:42:15 test-media kernel: [  115.972514]  [<ffffffff819b14b5>] ? __mutex_unlock_slowpath+0xf5/0x240
      Jun 14 18:42:15 test-media kernel: [  115.972518]  [<ffffffff81002593>] do_signal+0x23/0x820
      Jun 14 18:42:15 test-media kernel: [  115.972521]  [<ffffffff819b1609>] ? mutex_unlock+0x9/0x10
      Jun 14 18:42:15 test-media kernel: [  115.972524]  [<ffffffffa0358648>] ? v4l2_ioctl+0x78/0xf0 [videodev]
      Jun 14 18:42:15 test-media kernel: [  115.972526]  [<ffffffff819b4653>] ? int_very_careful+0x5/0x46
      Jun 14 18:42:15 test-media kernel: [  115.972529]  [<ffffffff810d54bd>] ? trace_hardirqs_on_caller+0x15d/0x200
      Jun 14 18:42:15 test-media kernel: [  115.972531]  [<ffffffff81002de0>] do_notify_resume+0x50/0x60
      Jun 14 18:42:15 test-media kernel: [  115.972533]  [<ffffffff819b46a6>] int_signal+0x12/0x17
      Jun 14 18:42:15 test-media kernel: [  115.972534] Code: ca 81 31 c0 e8 7a e2 8c 00 e8 aa 1d 8d 00 0f 1f 44 00 00 31 db 48 81 c4 a8 00 00 00 89 d8 5b 41 5c 41 5d 41 5e 41 5f 5d c3 66 90 <49> 81 3e 40 4e 02 82 b8 00 00 00 00 44 0f 44 e0 41 83 ff 01 0f
      Jun 14 18:42:15 test-media kernel: [  115.972567] RIP  [<ffffffff810d5cd0>] __lock_acquire+0x2f0/0x2070
      Jun 14 18:42:15 test-media kernel: [  115.972569]  RSP <ffff88021d16f9b8>
      Jun 14 18:42:15 test-media kernel: [  115.972570] CR2: 0000000000000100
      Jun 14 18:42:15 test-media kernel: [  115.972573] ---[ end trace 25595c2b8560cb57 ]---
      Jun 14 18:42:15 test-media kernel: [  115.972575] Fixing recursive fault but reboot is needed!
      
      This can be reproduced by loading the vivid driver and running:
      
      v4l2-ctl --stream-user
      
      and pressing Ctrl-C. You may have to try a few times, but in my experience this BUG
      is triggered quite quickly.
      
      The second is a possible deadlock:
      
      Jun 14 18:44:07 test-media kernel: [   49.376650] ======================================================
      Jun 14 18:44:07 test-media kernel: [   49.376651] [ INFO: possible circular locking dependency detected ]
      Jun 14 18:44:07 test-media kernel: [   49.376653] 4.1.0-rc3-test-media #1190 Not tainted
      Jun 14 18:44:07 test-media kernel: [   49.376654] -------------------------------------------------------
      Jun 14 18:44:07 test-media kernel: [   49.376655] v4l2-compliance/1468 is trying to acquire lock:
      Jun 14 18:44:07 test-media kernel: [   49.376657]  (&mm->mmap_sem){++++++}, at: [<ffffffffa03a81f6>] vb2_vmalloc_put_userptr+0x36/0x110 [videobuf2_vmalloc]
      Jun 14 18:44:07 test-media kernel: [   49.376665]
      Jun 14 18:44:07 test-media kernel: [   49.376665] but task is already holding lock:
      Jun 14 18:44:07 test-media kernel: [   49.376666]  (&q->mmap_lock){+.+...}, at: [<ffffffffa0398dc5>] vb2_queue_release+0x25/0x40 [videobuf2_core]
      Jun 14 18:44:07 test-media kernel: [   49.376670]
      Jun 14 18:44:07 test-media kernel: [   49.376670] which lock already depends on the new lock.
      Jun 14 18:44:07 test-media kernel: [   49.376670]
      Jun 14 18:44:07 test-media kernel: [   49.376671]
      Jun 14 18:44:07 test-media kernel: [   49.376671] the existing dependency chain (in reverse order) is:
      Jun 14 18:44:07 test-media kernel: [   49.376672]
      Jun 14 18:44:07 test-media kernel: [   49.376672] -> #1 (&q->mmap_lock){+.+...}:
      Jun 14 18:44:07 test-media kernel: [   49.376675]        [<ffffffff810d852c>] lock_acquire+0x6c/0xa0
      Jun 14 18:44:07 test-media kernel: [   49.376682]        [<ffffffff819aef5e>] mutex_lock_nested+0x5e/0x560
      Jun 14 18:44:07 test-media kernel: [   49.376689]        [<ffffffffa03934a2>] vb2_mmap+0x232/0x350 [videobuf2_core]
      Jun 14 18:44:07 test-media kernel: [   49.376691]        [<ffffffffa0395a60>] vb2_fop_mmap+0x20/0x30 [videobuf2_core]
      Jun 14 18:44:07 test-media kernel: [   49.376694]        [<ffffffffa0361102>] v4l2_mmap+0x52/0x90 [videodev]
      Jun 14 18:44:07 test-media kernel: [   49.376698]        [<ffffffff81177e33>] mmap_region+0x3b3/0x5e0
      Jun 14 18:44:07 test-media kernel: [   49.376701]        [<ffffffff81178377>] do_mmap_pgoff+0x317/0x400
      Jun 14 18:44:07 test-media kernel: [   49.376703]        [<ffffffff81165320>] vm_mmap_pgoff+0x90/0xc0
      Jun 14 18:44:07 test-media kernel: [   49.376708]        [<ffffffff81176867>] SyS_mmap_pgoff+0x1d7/0x280
      Jun 14 18:44:07 test-media kernel: [   49.376709]        [<ffffffff81007f8d>] SyS_mmap+0x1d/0x20
      Jun 14 18:44:07 test-media kernel: [   49.376714]        [<ffffffff819b44ae>] system_call_fastpath+0x12/0x76
      Jun 14 18:44:07 test-media kernel: [   49.376716]
      Jun 14 18:44:07 test-media kernel: [   49.376716] -> #0 (&mm->mmap_sem){++++++}:
      Jun 14 18:44:07 test-media kernel: [   49.376718]        [<ffffffff810d79b3>] __lock_acquire+0x1fd3/0x2070
      Jun 14 18:44:07 test-media kernel: [   49.376720]        [<ffffffff810d852c>] lock_acquire+0x6c/0xa0
      Jun 14 18:44:07 test-media kernel: [   49.376721]        [<ffffffff819b1a92>] down_read+0x42/0x60
      Jun 14 18:44:07 test-media kernel: [   49.376723]        [<ffffffffa03a81f6>] vb2_vmalloc_put_userptr+0x36/0x110 [videobuf2_vmalloc]
      Jun 14 18:44:07 test-media kernel: [   49.376725]        [<ffffffffa0394626>] __vb2_queue_free+0x146/0x5e0 [videobuf2_core]
      Jun 14 18:44:07 test-media kernel: [   49.376727]        [<ffffffffa0398dd3>] vb2_queue_release+0x33/0x40 [videobuf2_core]
      Jun 14 18:44:07 test-media kernel: [   49.376729]        [<ffffffffa0398e75>] _vb2_fop_release+0x95/0xb0 [videobuf2_core]
      Jun 14 18:44:07 test-media kernel: [   49.376731]        [<ffffffffa0398eb9>] vb2_fop_release+0x29/0x50 [videobuf2_core]
      Jun 14 18:44:07 test-media kernel: [   49.376733]        [<ffffffffa03b6372>] vivid_fop_release+0x92/0x230 [vivid]
      Jun 14 18:44:07 test-media kernel: [   49.376737]        [<ffffffffa0361460>] v4l2_release+0x30/0x80 [videodev]
      Jun 14 18:44:07 test-media kernel: [   49.376739]        [<ffffffff811a51d5>] __fput+0xe5/0x200
      Jun 14 18:44:07 test-media kernel: [   49.376744]        [<ffffffff811a5339>] ____fput+0x9/0x10
      Jun 14 18:44:07 test-media kernel: [   49.376746]        [<ffffffff810a9fa4>] task_work_run+0xc4/0xf0
      Jun 14 18:44:07 test-media kernel: [   49.376749]        [<ffffffff81002dd1>] do_notify_resume+0x41/0x60
      Jun 14 18:44:07 test-media kernel: [   49.376752]        [<ffffffff819b46a6>] int_signal+0x12/0x17
      Jun 14 18:44:07 test-media kernel: [   49.376754]
      Jun 14 18:44:07 test-media kernel: [   49.376754] other info that might help us debug this:
      Jun 14 18:44:07 test-media kernel: [   49.376754]
      Jun 14 18:44:07 test-media kernel: [   49.376755]  Possible unsafe locking scenario:
      Jun 14 18:44:07 test-media kernel: [   49.376755]
      Jun 14 18:44:07 test-media kernel: [   49.376756]        CPU0                    CPU1
      Jun 14 18:44:07 test-media kernel: [   49.376757]        ----                    ----
      Jun 14 18:44:07 test-media kernel: [   49.376758]   lock(&q->mmap_lock);
      Jun 14 18:44:07 test-media kernel: [   49.376759]                                lock(&mm->mmap_sem);
      Jun 14 18:44:07 test-media kernel: [   49.376760]                                lock(&q->mmap_lock);
      Jun 14 18:44:07 test-media kernel: [   49.376761]   lock(&mm->mmap_sem);
      Jun 14 18:44:07 test-media kernel: [   49.376763]
      Jun 14 18:44:07 test-media kernel: [   49.376763]  *** DEADLOCK ***
      Jun 14 18:44:07 test-media kernel: [   49.376763]
      Jun 14 18:44:07 test-media kernel: [   49.376764] 2 locks held by v4l2-compliance/1468:
      Jun 14 18:44:07 test-media kernel: [   49.376765]  #0:  (&dev->mutex#3){+.+.+.}, at: [<ffffffffa0398e0a>] _vb2_fop_release+0x2a/0xb0 [videobuf2_core]
      Jun 14 18:44:07 test-media kernel: [   49.376770]  #1:  (&q->mmap_lock){+.+...}, at: [<ffffffffa0398dc5>] vb2_queue_release+0x25/0x40 [videobuf2_core]
      Jun 14 18:44:07 test-media kernel: [   49.376773]
      Jun 14 18:44:07 test-media kernel: [   49.376773] stack backtrace:
      Jun 14 18:44:07 test-media kernel: [   49.376776] CPU: 2 PID: 1468 Comm: v4l2-compliance Not tainted 4.1.0-rc3-test-media #1190
      Jun 14 18:44:07 test-media kernel: [   49.376777] Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 05/20/2014
      Jun 14 18:44:07 test-media kernel: [   49.376779]  ffffffff8279e0b0 ffff88021d6f7ba8 ffffffff819a7aac 0000000000000011
      Jun 14 18:44:07 test-media kernel: [   49.376781]  ffffffff8279e0b0 ffff88021d6f7bf8 ffffffff819a3964 ffff88021d6f7bd8
      Jun 14 18:44:07 test-media kernel: [   49.376783]  ffff8800ac8aa100 0000000000000002 ffff8800ac8aa9a0 0000000000000002
      Jun 14 18:44:07 test-media kernel: [   49.376785] Call Trace:
      Jun 14 18:44:07 test-media kernel: [   49.376788]  [<ffffffff819a7aac>] dump_stack+0x4f/0x7b
      Jun 14 18:44:07 test-media kernel: [   49.376792]  [<ffffffff819a3964>] print_circular_bug+0x20f/0x251
      Jun 14 18:44:07 test-media kernel: [   49.376793]  [<ffffffff810d79b3>] __lock_acquire+0x1fd3/0x2070
      Jun 14 18:44:07 test-media kernel: [   49.376795]  [<ffffffff810d6543>] ? __lock_acquire+0xb63/0x2070
      Jun 14 18:44:07 test-media kernel: [   49.376797]  [<ffffffff810d37a8>] ? __lock_is_held+0x58/0x80
      Jun 14 18:44:07 test-media kernel: [   49.376798]  [<ffffffff810d852c>] lock_acquire+0x6c/0xa0
      Jun 14 18:44:07 test-media kernel: [   49.376800]  [<ffffffffa03a81f6>] ? vb2_vmalloc_put_userptr+0x36/0x110 [videobuf2_vmalloc]
      Jun 14 18:44:07 test-media kernel: [   49.376802]  [<ffffffff819b1a92>] down_read+0x42/0x60
      Jun 14 18:44:07 test-media kernel: [   49.376803]  [<ffffffffa03a81f6>] ? vb2_vmalloc_put_userptr+0x36/0x110 [videobuf2_vmalloc]
      Jun 14 18:44:07 test-media kernel: [   49.376805]  [<ffffffff819af1b1>] ? mutex_lock_nested+0x2b1/0x560
      Jun 14 18:44:07 test-media kernel: [   49.376807]  [<ffffffffa0398dc5>] ? vb2_queue_release+0x25/0x40 [videobuf2_core]
      Jun 14 18:44:07 test-media kernel: [   49.376808]  [<ffffffffa03a81f6>] vb2_vmalloc_put_userptr+0x36/0x110 [videobuf2_vmalloc]
      Jun 14 18:44:07 test-media kernel: [   49.376810]  [<ffffffffa0398e0a>] ? _vb2_fop_release+0x2a/0xb0 [videobuf2_core]
      Jun 14 18:44:07 test-media kernel: [   49.376812]  [<ffffffffa0394626>] __vb2_queue_free+0x146/0x5e0 [videobuf2_core]
      Jun 14 18:44:07 test-media kernel: [   49.376814]  [<ffffffffa0398dd3>] vb2_queue_release+0x33/0x40 [videobuf2_core]
      Jun 14 18:44:07 test-media kernel: [   49.376816]  [<ffffffffa0398e75>] _vb2_fop_release+0x95/0xb0 [videobuf2_core]
      Jun 14 18:44:07 test-media kernel: [   49.376818]  [<ffffffffa0398eb9>] vb2_fop_release+0x29/0x50 [videobuf2_core]
      Jun 14 18:44:07 test-media kernel: [   49.376820]  [<ffffffffa03b6372>] vivid_fop_release+0x92/0x230 [vivid]
      Jun 14 18:44:07 test-media kernel: [   49.376822]  [<ffffffffa0361460>] v4l2_release+0x30/0x80 [videodev]
      Jun 14 18:44:07 test-media kernel: [   49.376824]  [<ffffffff811a51d5>] __fput+0xe5/0x200
      Jun 14 18:44:07 test-media kernel: [   49.376825]  [<ffffffff819b4653>] ? int_very_careful+0x5/0x46
      Jun 14 18:44:07 test-media kernel: [   49.376827]  [<ffffffff811a5339>] ____fput+0x9/0x10
      Jun 14 18:44:07 test-media kernel: [   49.376828]  [<ffffffff810a9fa4>] task_work_run+0xc4/0xf0
      Jun 14 18:44:07 test-media kernel: [   49.376830]  [<ffffffff81002dd1>] do_notify_resume+0x41/0x60
      Jun 14 18:44:07 test-media kernel: [   49.376832]  [<ffffffff819b46a6>] int_signal+0x12/0x17
      
      This can be triggered by loading the vivid module with the module option 'no_error_inj=1'
      and running 'v4l2-compliance -s5'. Again, it may take a few attempts to trigger this
      but for me it happens quite quickly.
      
      Without this patch I cannot reproduce these two issues. So reverting is the best
      solution for now.
      Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      511a1b8a
  14. 16 6月, 2015 1 次提交
  15. 10 6月, 2015 4 次提交