linux/drivers/gpu/drm
Chris Wilson e9681366ea drm/i915: Do not store the error pointer for a failed userptr registration
If we fail to create our mmu notification, we report the error back and
currently store the error inside the i915_mm_struct. This not only causes
subsequent registerations of the same mm to fail (an issue if the first
was interrupted by a signal and needed to be restarted) but also causes
us to eventually try and free the error pointer.

[   73.419599] BUG: unable to handle kernel NULL pointer dereference at 000000000000004c
[   73.419831] IP: [<ffffffff8114af33>] mmu_notifier_unregister+0x23/0x130
[   73.420065] PGD 8650c067 PUD 870bb067 PMD 0
[   73.420319] Oops: 0000 [#1] SMP DEBUG_PAGEALLOC
[   73.420580] CPU: 0 PID: 42 Comm: kworker/0:1 Tainted: G        W      3.17.0-rc6+ #1561
[   73.420837] Hardware name: Intel Corporation SandyBridge Platform/LosLunas CRB, BIOS ASNBCPT1.86C.0075.P00.1106281639 06/28/2011
[   73.421405] Workqueue: events __i915_mm_struct_free__worker
[   73.421724] task: ffff880088a81220 ti: ffff880088168000 task.ti: ffff880088168000
[   73.422051] RIP: 0010:[<ffffffff8114af33>]  [<ffffffff8114af33>] mmu_notifier_unregister+0x23/0x130
[   73.422410] RSP: 0018:ffff88008816bd50  EFLAGS: 00010286
[   73.422765] RAX: 0000000000000003 RBX: ffff880086485400 RCX: 0000000000000000
[   73.423137] RDX: ffff88016d80ee90 RSI: ffff880086485400 RDI: 0000000000000044
[   73.423513] RBP: ffff88008816bd70 R08: 0000000000000001 R09: 0000000000000000
[   73.423895] R10: 0000000000000320 R11: 0000000000000001 R12: 0000000000000044
[   73.424282] R13: ffff880166e5f008 R14: ffff88016d815200 R15: ffff880166e5f040
[   73.424682] FS:  0000000000000000(0000) GS:ffff88016d800000(0000) knlGS:0000000000000000
[   73.425099] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   73.425537] CR2: 000000000000004c CR3: 0000000087f5f000 CR4: 00000000000407f0
[   73.426157] Stack:
[   73.426597]  ffff880088a81248 ffff880166e5f038 fffffffffffffffc ffff880166e5f008
[   73.427096]  ffff88008816bd98 ffffffff814a75f2 ffff880166e5f038 ffff8800880f8a28
[   73.427603]  ffff88016d812ac0 ffff88008816be00 ffffffff8106321a ffffffff810631af
[   73.428119] Call Trace:
[   73.428606]  [<ffffffff814a75f2>] __i915_mm_struct_free__worker+0x42/0x80
[   73.429116]  [<ffffffff8106321a>] process_one_work+0x1ba/0x610
[   73.429632]  [<ffffffff810631af>] ? process_one_work+0x14f/0x610
[   73.430153]  [<ffffffff810636db>] worker_thread+0x6b/0x4a0
[   73.430671]  [<ffffffff8108d67d>] ? trace_hardirqs_on+0xd/0x10
[   73.431501]  [<ffffffff81063670>] ? process_one_work+0x610/0x610
[   73.432030]  [<ffffffff8106a206>] kthread+0xf6/0x110
[   73.432561]  [<ffffffff8106a110>] ? __kthread_parkme+0x80/0x80
[   73.433100]  [<ffffffff8169c22c>] ret_from_fork+0x7c/0xb0
[   73.433644]  [<ffffffff8106a110>] ? __kthread_parkme+0x80/0x80
[   73.434194] Code: 0f 1f 84 00 00 00 00 00 66 66 66 66 90 8b 46 4c 85 c0 0f 8e 10 01 00 00 55 48 89 e5 41 55 41 54 53 48 89 f3 49 89 fc 48 83 ec 08 <48> 83 7f 08 00 0f 84 b1 00 00 00 48 c7 c7 40 e6 ac 82 e8 26 65
[   73.435942] RIP  [<ffffffff8114af33>] mmu_notifier_unregister+0x23/0x130
[   73.437017]  RSP <ffff88008816bd50>
[   73.437704] CR2: 000000000000004c

Fixes regression from commit ad46cb533d
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Aug 7 14:20:40 2014 +0100

    drm/i915: Prevent recursive deadlock on releasing a busy userptr

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=84207
Testcase: igt/gem_render_copy_redux
Testcase: igt/gem_userptr_blits/create-destroy-sync
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jacek Danecki <jacek.danecki@intel.com>
Cc: "Gong, Zhipeng" <zhipeng.gong@intel.com>
Cc: Jacek Danecki <jacek.danecki@intel.com>
Cc: "Ursulin, Tvrtko" <tvrtko.ursulin@intel.com>
Cc: stable@vger.kernel.org
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2014-09-29 15:19:59 +02:00
..
armada drm: add driver->set_busid() callback 2014-09-10 17:43:04 +10:00
ast Merge branch 'drm-next-ast-fixes' of ssh://people.freedesktop.org/~/linux into drm-next 2014-09-16 14:59:16 +10:00
bochs drm: add driver->set_busid() callback 2014-09-10 17:43:04 +10:00
bridge drm: add register and unregister functions for connectors 2014-06-19 08:55:28 +02:00
cirrus drm: add driver->set_busid() callback 2014-09-10 17:43:04 +10:00
exynos Merge tag 'drm-intel-next-2014-09-05' of git://anongit.freedesktop.org/drm-intel into drm-next 2014-09-16 16:02:09 +10:00
gma500 Merge tag 'drm-intel-next-2014-09-05' of git://anongit.freedesktop.org/drm-intel into drm-next 2014-09-16 16:02:09 +10:00
i2c drm/tda998x: update for new drm connector APIs. 2014-08-05 10:34:33 +10:00
i810 drm: Move drm_memory.c map support declarations to <drm/drm_legacy.h> 2014-09-12 15:28:12 +02:00
i915 drm/i915: Do not store the error pointer for a failed userptr registration 2014-09-29 15:19:59 +02:00
mga drm: Move drm_memory.c map support declarations to <drm/drm_legacy.h> 2014-09-12 15:28:12 +02:00
mgag200 drm: Move legacy buffer structures to <drm/drm_legacy.h> 2014-09-12 15:28:12 +02:00
msm Linux 3.17-rc5 2014-09-16 11:38:04 +10:00
nouveau Linux 3.17-rc5 2014-09-16 11:38:04 +10:00
omapdrm drm: add driver->set_busid() callback 2014-09-10 17:43:04 +10:00
panel drm/panel/simple: add optronics B101XTN01.0 (v3) 2014-09-10 11:19:07 -04:00
qxl drm/ttm: allow fence to be added as shared 2014-09-11 10:46:00 -04:00
r128 drm: Move drm_memory.c map support declarations to <drm/drm_legacy.h> 2014-09-12 15:28:12 +02:00
radeon Merge tag 'drm-intel-next-2014-09-05' of git://anongit.freedesktop.org/drm-intel into drm-next 2014-09-16 16:02:09 +10:00
rcar-du drm/rcar-du: Add OF support 2014-09-15 11:55:47 +03:00
savage drm: Move drm_memory.c map support declarations to <drm/drm_legacy.h> 2014-09-12 15:28:12 +02:00
shmobile drm/shmob: Update copyright notice 2014-09-15 11:34:07 +03:00
sis drm: Create drm legacy driver header 2014-09-12 11:08:55 +02:00
sti Linux 3.17-rc5 2014-09-16 11:38:04 +10:00
tdfx drm: add driver->set_busid() callback 2014-09-10 17:43:04 +10:00
tegra drm/tegra: Renaming DP training vswing pre emph defines 2014-09-03 11:05:41 +02:00
tilcdc drm/tilcdc: panel: Add support for enable GPIO 2014-09-17 10:55:27 +10:00
ttm drm/ttm: make sure format string cannot leak in 2014-09-17 11:15:01 +10:00
udl drm: merge drm_usb into udl 2014-09-10 17:43:27 +10:00
via drm: Move legacy buffer structures to <drm/drm_legacy.h> 2014-09-12 15:28:12 +02:00
vmwgfx Linux 3.17-rc5 2014-09-16 11:38:04 +10:00
ati_pcigart.c drm: split ati_pcigart.h out of drmP.h 2014-09-12 14:11:14 +10:00
drm_agpsupport.c drm: move AGP definitions harder 2014-09-10 17:40:11 +10:00
drm_auth.c drm: Move piles of functions from drmP.h to drm_internal.h 2014-09-12 11:16:29 +02:00
drm_bufs.c drm: Move __drm_pci_free to drm_legacy.h 2014-09-12 11:08:56 +02:00
drm_cache.c
drm_context.c drm: mark drm_context support as legacy 2014-08-05 19:38:12 +02:00
drm_crtc_helper.c drm/crtc-helper: use drm_framebuffer flags 2014-07-08 11:18:47 +10:00
drm_crtc_internal.h
drm_crtc.c Linux 3.17-rc5 2014-09-16 11:38:04 +10:00
drm_debugfs.c drm: Move piles of functions from drmP.h to drm_internal.h 2014-09-12 11:16:29 +02:00
drm_dma.c drm: Move legacy buffer structures to <drm/drm_legacy.h> 2014-09-12 15:28:12 +02:00
drm_dp_helper.c drm/dp: add a hw mutex around the transfer functions. (v2) 2014-06-05 09:54:29 +10:00
drm_dp_mst_topology.c drm: Don't return 0 for a value used as a denominator 2014-08-14 21:24:29 +02:00
drm_drv.c drm: Move DRM_MAGIC_HASH_ORDER into drm_drv.c 2014-09-12 15:28:14 +02:00
drm_edid_load.c drm: replace drm_get_connector_name() with direct name field use 2014-06-04 13:17:41 +10:00
drm_edid.c drm/edid: Reduce horizontal timings for pixel replicated modes 2014-09-15 08:56:29 +02:00
drm_encoder_slave.c
drm_fb_cma_helper.c drm: Introduce drm_fb_helper_prepare() 2014-07-08 11:31:28 +10:00
drm_fb_helper.c Merge tag 'drm-intel-next-2014-09-01' of git://anongit.freedesktop.org/drm-intel into drm-next 2014-09-03 08:30:48 +10:00
drm_flip_work.c
drm_fops.c drm: unexport drm_global_mutex 2014-09-12 11:19:47 +02:00
drm_gem_cma_helper.c drm: gem_cma: Use ERR_CAST helper 2014-07-21 14:36:45 +10:00
drm_gem.c Merge tag 'topic/core-stuff-2014-09-15' of git://anongit.freedesktop.org/drm-intel into drm-next 2014-09-15 19:55:55 +10:00
drm_global.c
drm_hashtab.c list: fix order of arguments for hlist_add_after(_rcu) 2014-08-06 18:01:24 -07:00
drm_info.c Merge tag 'topic/core-stuff-2014-09-15' of git://anongit.freedesktop.org/drm-intel into drm-next 2014-09-15 19:55:55 +10:00
drm_internal.h drm: Move drm_class to drm_internal.h 2014-09-12 15:28:14 +02:00
drm_ioc32.c
drm_ioctl.c drm: Purge ioctl forward declarations from drmP.h 2014-09-12 15:27:47 +02:00
drm_irq.c drm: Move vblank related module options into drm_irq.c 2014-09-12 11:14:56 +02:00
drm_legacy.h drm: Create drm legacy driver header 2014-09-12 11:08:55 +02:00
drm_lock.c drm: unexport drm_global_mutex 2014-09-12 11:19:47 +02:00
drm_memory.c drm: Move drm_memory.c map support declarations to <drm/drm_legacy.h> 2014-09-12 15:28:12 +02:00
drm_mipi_dsi.c drm/dsi: Use peripheral's channel for DCS commands 2014-07-22 09:06:32 +02:00
drm_mm.c
drm_modes.c drm: Perform cmdline mode parsing during connector initialisation 2014-08-06 14:50:12 +02:00
drm_modeset_lock.c drm: Docbook fixes 2014-08-14 21:24:17 +02:00
drm_of.c drm: add of_graph endpoint helper to find possible CRTCs 2014-07-11 15:38:28 +01:00
drm_panel.c
drm_pci.c drm: Move legacy buffer structures to <drm/drm_legacy.h> 2014-09-12 15:28:12 +02:00
drm_plane_helper.c drm/plane-helper: Use proper plane init function 2014-07-18 15:39:28 +02:00
drm_platform.c drm: Goody bye, drm_bus! 2014-09-10 17:43:10 +10:00
drm_prime.c drm: Move piles of functions from drmP.h to drm_internal.h 2014-09-12 11:16:29 +02:00
drm_probe_helper.c drm: Perform cmdline mode parsing during connector initialisation 2014-08-06 14:50:12 +02:00
drm_rect.c drm: Add drm_rect rotation functions 2014-07-11 23:44:12 +02:00
drm_scatter.c drm: Move sg functions into drm_legacy.h 2014-09-12 11:08:54 +02:00
drm_sysfs.c drm: Move piles of functions from drmP.h to drm_internal.h 2014-09-12 11:16:29 +02:00
drm_trace_points.c
drm_trace.h
drm_vm.c drm: Move __drm_pci_free to drm_legacy.h 2014-09-12 11:08:56 +02:00
drm_vma_manager.c
Kconfig drm: merge drm_usb into udl 2014-09-10 17:43:27 +10:00
Makefile drm: merge drm_usb into udl 2014-09-10 17:43:27 +10:00
README.drm

************************************************************
* For the very latest on DRI development, please see:      *
*     http://dri.freedesktop.org/                          *
************************************************************

The Direct Rendering Manager (drm) is a device-independent kernel-level
device driver that provides support for the XFree86 Direct Rendering
Infrastructure (DRI).

The DRM supports the Direct Rendering Infrastructure (DRI) in four major
ways:

    1. The DRM provides synchronized access to the graphics hardware via
       the use of an optimized two-tiered lock.

    2. The DRM enforces the DRI security policy for access to the graphics
       hardware by only allowing authenticated X11 clients access to
       restricted regions of memory.

    3. The DRM provides a generic DMA engine, complete with multiple
       queues and the ability to detect the need for an OpenGL context
       switch.

    4. The DRM is extensible via the use of small device-specific modules
       that rely extensively on the API exported by the DRM module.


Documentation on the DRI is available from:
    http://dri.freedesktop.org/wiki/Documentation
    http://sourceforge.net/project/showfiles.php?group_id=387
    http://dri.sourceforge.net/doc/

For specific information about kernel-level support, see:

    The Direct Rendering Manager, Kernel Support for the Direct Rendering
    Infrastructure
    http://dri.sourceforge.net/doc/drm_low_level.html

    Hardware Locking for the Direct Rendering Infrastructure
    http://dri.sourceforge.net/doc/hardware_locking_low_level.html

    A Security Analysis of the Direct Rendering Infrastructure
    http://dri.sourceforge.net/doc/security_low_level.html