1. 24 5月, 2019 5 次提交
  2. 03 5月, 2019 1 次提交
  3. 25 4月, 2019 2 次提交
    • C
      drm/i915: Invert the GEM wakeref hierarchy · 79ffac85
      Chris Wilson 提交于
      In the current scheme, on submitting a request we take a single global
      GEM wakeref, which trickles down to wake up all GT power domains. This
      is undesirable as we would like to be able to localise our power
      management to the available power domains and to remove the global GEM
      operations from the heart of the driver. (The intent there is to push
      global GEM decisions to the boundary as used by the GEM user interface.)
      
      Now during request construction, each request is responsible via its
      logical context to acquire a wakeref on each power domain it intends to
      utilize. Currently, each request takes a wakeref on the engine(s) and
      the engines themselves take a chipset wakeref. This gives us a
      transition on each engine which we can extend if we want to insert more
      powermangement control (such as soft rc6). The global GEM operations
      that currently require a struct_mutex are reduced to listening to pm
      events from the chipset GT wakeref. As we reduce the struct_mutex
      requirement, these listeners should evaporate.
      
      Perhaps the biggest immediate change is that this removes the
      struct_mutex requirement around GT power management, allowing us greater
      flexibility in request construction. Another important knock-on effect,
      is that by tracking engine usage, we can insert a switch back to the
      kernel context on that engine immediately, avoiding any extra delay or
      inserting global synchronisation barriers. This makes tracking when an
      engine and its associated contexts are idle much easier -- important for
      when we forgo our assumed execution ordering and need idle barriers to
      unpin used contexts. In the process, it means we remove a large chunk of
      code whose only purpose was to switch back to the kernel context.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Cc: Imre Deak <imre.deak@intel.com>
      Reviewed-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190424200717.1686-5-chris@chris-wilson.co.uk
      79ffac85
    • C
      drm/i915: Move GraphicsTechnology files under gt/ · 112ed2d3
      Chris Wilson 提交于
      Start partitioning off the code that talks to the hardware (GT) from the
      uapi layers and move the device facing code under gt/
      
      One casualty is s/intel_ringbuffer.h/intel_engine.h/ with the plan to
      subdivide that header and body further (and split out the submission
      code from the ringbuffer and logical context handling). This patch aims
      to be simple motion so git can fixup inflight patches with little mess.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Acked-by: NJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Acked-by: NJani Nikula <jani.nikula@intel.com>
      Acked-by: NRodrigo Vivi <rodrigo.vivi@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190424174839.7141-1-chris@chris-wilson.co.uk
      112ed2d3
  4. 20 4月, 2019 1 次提交
  5. 30 3月, 2019 1 次提交
  6. 21 2月, 2019 1 次提交
  7. 17 1月, 2019 1 次提交
  8. 31 12月, 2018 1 次提交
  9. 13 12月, 2018 1 次提交
  10. 17 10月, 2018 1 次提交
  11. 11 9月, 2018 1 次提交
  12. 29 6月, 2018 2 次提交
  13. 12 6月, 2018 1 次提交
  14. 26 5月, 2018 1 次提交
  15. 29 3月, 2018 2 次提交
  16. 24 3月, 2018 1 次提交
  17. 21 3月, 2018 1 次提交
  18. 20 3月, 2018 1 次提交
  19. 19 3月, 2018 4 次提交
  20. 15 3月, 2018 1 次提交
  21. 14 3月, 2018 2 次提交
    • J
      drm/i915/guc: Check the locking status of GuC WOPCM registers · f08e2035
      Jackie Li 提交于
      GuC WOPCM registers are write-once registers. Current driver code accesses
      these registers without checking the accessibility to these registers which
      will lead to unpredictable driver behaviors if these registers were touch
      by other components (such as faulty BIOS code).
      
      This patch moves the GuC WOPCM registers updating code into intel_wopcm.c
      and adds check before and after the update to GuC WOPCM registers so that
      we can make sure the driver is in a known state after writing to these
      write-once registers.
      
      v6:
       - Made sure module reloading won't bug the kernel while doing
         locking status checking
      
      v7:
       - Fixed patch format issues
      
      v8:
       - Fixed coding style issue on register lock bit macro definition (Sagar)
      
      v9:
       - Avoided to use redundant !! to cast uint to bool (Chris)
       - Return error code instead of GEM_BUG_ON for locked with invalid register
         values case (Sagar)
       - Updated guc_wopcm_hw_init to use guc_wopcm as first parameter (Michal)
       - Added code to set and validate the HuC_LOADING_AGENT_GUC bit in GuC
         WOPCM offset register based on the presence of HuC firmware (Michal)
       - Use bit fields instead of macros for GuC WOPCM flags (Michal)
      
      v10:
       - Refined variable names, removed redundant comments (Joonas)
       - Introduced lockable_reg to handle the write once register write and
         propagate the write error to caller (Joonas)
       - Used lockable_reg abstraction to avoid locking bit check on generic
         i915_reg_t (Michal)
       - Added log message for error paths (Michal)
       - Removed hw_updated flag and only relies on real hardware status
      
      v11:
       - Replaced lockable_reg with simplified function (Michal)
       - Used new macros for locking bits of WOPCM size/offset registers instead
         of using BIT(0) directly (Michal)
       - use intel_wopcm_init_hw() called from intel_gem_init_hw() to do GuC
         WOPCM register setup instead of calling from intel_uc_init_hw() (Michal)
      
      v12:
       - Updated function kernel-doc to align with code changes (Michal)
       - Updated code to use wopcm pointer directly (Michal)
      
      v13:
       - Updated the ordering of s-o-b/cc/r-b tags (Sagar)
      
      BSpec: 10875, 10833
      Signed-off-by: NJackie Li <yaodong.li@intel.com>
      Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com> (v11)
      Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> (v12)
      Reviewed-by: NJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Signed-off-by: NJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/1520987574-19351-5-git-send-email-yaodong.li@intel.com
      f08e2035
    • J
      drm/i915: Implement dynamic GuC WOPCM offset and size calculation · 6b0478fb
      Jackie Li 提交于
      Hardware may have specific restrictions on GuC WOPCM offset and size. On
      Gen9, the value of the GuC WOPCM size register needs to be larger than the
      value of GuC WOPCM offset register + a Gen9 specific offset (144KB) for
      reserved GuC WOPCM. Fail to enforce such a restriction on GuC WOPCM size
      will lead to GuC firmware execution failures. On the other hand, with
      current static GuC WOPCM offset and size values (512KB for both offset and
      size), the GuC WOPCM size verification will fail on Gen9 even if it can be
      fixed by lowering the GuC WOPCM offset by calculating its value based on
      HuC firmware size (which is likely less than 200KB on Gen9), so that we can
      have a GuC WOPCM size value which is large enough to pass the GuC WOPCM
      size check.
      
      This patch updates the reserved GuC WOPCM size for RC6 context on Gen9 to
      24KB to strictly align with the Gen9 GuC WOPCM layout. It also adds support
      to verify the GuC WOPCM size aganist the Gen9 hardware restrictions. To
      meet all above requirements, let's provide dynamic partitioning of the
      WOPCM that will be based on platform specific HuC/GuC firmware sizes.
      
      v2:
       - Removed intel_wopcm_init (Ville/Sagar/Joonas)
       - Renamed and Moved the intel_wopcm_partition into intel_guc (Sagar)
       - Removed unnecessary function calls (Joonas)
       - Init GuC WOPCM partition as soon as firmware fetching is completed
      
      v3:
       - Fixed indentation issues (Chris)
       - Removed layering violation code (Chris/Michal)
       - Created separat files for GuC wopcm code  (Michal)
       - Used inline function to avoid code duplication (Michal)
      
      v4:
       - Preset the GuC WOPCM top during early GuC init (Chris)
       - Fail intel_uc_init_hw() as soon as GuC WOPCM partitioning failed
      
      v5:
       - Moved GuC DMA WOPCM register updating code into intel_wopcm.c
       - Took care of the locking status before writing to GuC DMA
         Write-Once registers. (Joonas)
      
      v6:
       - Made sure the GuC WOPCM size to be multiple of 4K (4K aligned)
      
      v8:
       - Updated comments and fixed naming issues (Sagar/Joonas)
       - Updated commit message to include more description about the hardware
         restriction on GuC WOPCM size (Sagar)
      
      v9:
       - Minor changes variable names and code comments (Sagar)
       - Added detailed GuC WOPCM layout drawing (Sagar/Michal)
       - Refined macro definitions to be reader friendly (Michal)
       - Removed redundent check to valid flag (Michal)
       - Unified first parameter for exported GuC WOPCM functions (Michal)
       - Refined the name and parameter list of hardware restriction checking
         functions (Michal)
      
      v10:
       - Used shorter function name for internal functions (Joonas)
       - Moved init-ealry function into c file (Joonas)
       - Consolidated and removed redundant size checks (Joonas/Michal)
       - Removed unnecessary unlikely() from code which is only called once
         during boot (Joonas)
       - More fixes to kernel-doc format and content (Michal)
       - Avoided the use of PAGE_MASK for 4K pages (Michal)
       - Added error log messages to error paths (Michal)
      
      v11:
       - Replaced intel_guc_wopcm with more generic intel_wopcm and attached
         intel_wopcm to drm_i915_private instead intel_guc (Michal)
       - dynamic calculation of GuC non-wopcm memory start (a.k.a WOPCM Top
         offset from GuC WOPCM base) (Michal)
       - Moved WOPCM marco definitions into .c source file (Michal)
       - Exported WOPCM layout diagram as kernel-doc (Michal)
      
      v12:
       - Updated naming, function kernel-doc to align with new changes (Michal)
      
      v13:
       - Updated the ordering of s-o-b/cc/r-b tags (Sagar)
       - Corrected one tense error in comment (Sagar)
       - Corrected typos and removed spurious comments (Joonas)
      
      Bspec: 12690
      Signed-off-by: NJackie Li <yaodong.li@intel.com>
      Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
      Cc: Sagar Arun Kamble <sagar.a.kamble@intel.com>
      Cc: Sujaritha Sundaresan <sujaritha.sundaresan@intel.com>
      Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
      Cc: John Spotswood <john.a.spotswood@intel.com>
      Cc: Oscar Mateo <oscar.mateo@intel.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Reviewed-by: Sagar Arun Kamble <sagar.a.kamble@intel.com> (v8)
      Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> (v9)
      Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com> (v11)
      Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> (v12)
      Reviewed-by: NJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Signed-off-by: NJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/1520987574-19351-2-git-send-email-yaodong.li@intel.com
      6b0478fb
  22. 13 3月, 2018 2 次提交
  23. 10 3月, 2018 1 次提交
  24. 03 3月, 2018 1 次提交
  25. 02 3月, 2018 1 次提交
  26. 01 2月, 2018 2 次提交
    • S
      drm/i915/guc: Add uc_fini_wq in gem_init unwind path · c950af50
      Sagar Arun Kamble 提交于
      While moving code around for solving lockdep issue for GuC log relay,
      spotted that uc_fini_wq is not being called in failure path in gem_init.
      Missed in the below commit. Add it.
      
      v2: Removed GEM_BUG_ON(!HAS_GUC()) from intel_uc_fini_wq as init happens
      only based on enable_guc module parameter and does not consider has_guc
      capability. (Michal)
      Signed-off-by: NSagar Arun Kamble <sagar.a.kamble@intel.com>
      Fixes: 3176ff49 ("drm/i915/guc: Move GuC workqueue allocations outside of the mutex")
      Cc: Michał Winiarski <michal.winiarski@intel.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: NMichał Winiarski <michal.winiarski@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/1515588857-10283-1-git-send-email-sagar.a.kamble@intel.comSigned-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      (cherry picked from commit da943b5a)
      Signed-off-by: NRodrigo Vivi <rodrigo.vivi@intel.com>
      c950af50
    • M
      drm/i915/guc: Don't forget to free GuC error log · bf67ce62
      Michal Wajdeczko 提交于
      We're freeing GuC error log in uc_fini_hw() that matches
      corresponding uc_init_hw() but we missed the point that this
      log object is copied on error path and in case of failure in
      uc_init_hw() we will leak this object as uc_fini_hw() is
      never called.
      
      If we free this log object as part of the late uC cleanup, where
      we also release other firmware objects, we can avoid this BUG:
      
      [70841.001413] BUG drm_i915_gem_object (Tainted: G     U  W       ): Objects remaining in drm_i915_gem_object on __kmem_cache_shutdown()
      [70841.001436] INFO: Slab 0x00000000c94e41af objects=21 used=1 fp=0x000000001d60c40a flags=0x8000000000008100
      
      [70841.001466] Call Trace:
      [70841.001471]  dump_stack+0x5e/0x8e
      [70841.001476]  slab_err+0x99/0xb0
      [70841.001483]  ? __slab_alloc.isra.24.constprop.29+0x62/0x70
      [70841.001491]  ? __kmalloc+0x1f5/0x320
      [70841.001497]  __kmem_cache_shutdown+0x18b/0x400
      [70841.001505]  shutdown_cache+0x13/0x1c0
      [70841.001511]  kmem_cache_destroy+0x1c2/0x240
      [70841.001517]  ? __mutex_unlock_slowpath+0x38/0x270
      [70841.001559]  i915_gem_load_cleanup+0xbc/0x130 [i915]
      [70841.001595]  i915_driver_cleanup_early+0x11/0x60 [i915]
      [70841.001630]  i915_driver_load+0x708/0x1720 [i915]
      [70841.001638]  ? trace_hardirqs_on_caller+0xe2/0x1c0
      [70841.001673]  i915_pci_probe+0x2d/0x90 [i915]
      [70841.001680]  pci_device_probe+0x9c/0x120
      [70841.001687]  driver_probe_device+0x2a9/0x490
      [70841.001694]  __driver_attach+0xd9/0xe0
      [70841.001700]  ? driver_probe_device+0x490/0x490
      [70841.001705]  bus_for_each_dev+0x57/0x90
      [70841.001712]  bus_add_driver+0x1eb/0x260
      [70841.001717]  ? 0xffffffffa0685000
      [70841.001723]  driver_register+0x52/0xc0
      [70841.001728]  ? 0xffffffffa0685000
      [70841.001733]  do_one_initcall+0x39/0x170
      [70841.001739]  ? rcu_read_lock_sched_held+0x6f/0x80
      [70841.001746]  ? kmem_cache_alloc_trace+0x27b/0x2e0
      [70841.001753]  do_init_module+0x56/0x1ec
      [70841.001759]  load_module+0x219e/0x2550
      [70841.001766]  ? vfs_read+0x121/0x140
      [70841.001774]  ? SyS_finit_module+0xa5/0xe0
      [70841.001779]  SyS_finit_module+0xa5/0xe0
      [70841.001788]  entry_SYSCALL_64_fastpath+0x22/0x8f
      
      [70841.001806] INFO: Object 0x00000000eab7ed96 @offset=6208
      [70841.001850] INFO: Allocated in i915_gem_object_create.part.32+0x1f/0x260 [i915] age=38 cpu=0 pid=2708
      [70841.001861] 	kmem_cache_alloc+0x23d/0x2d0
      [70841.001897] 	i915_gem_object_create.part.32+0x1f/0x260 [i915]
      [70841.001937] 	intel_guc_allocate_vma+0x15/0x100 [i915]
      [70841.001977] 	intel_guc_log_create+0x34/0x1c0 [i915]
      [70841.002014] 	intel_guc_init+0x5a/0x100 [i915]
      [70841.002051] 	intel_uc_init+0x3e/0xb0 [i915]
      [70841.002089] 	i915_gem_init+0x18e/0x540 [i915]
      [70841.002123] 	i915_driver_load+0xa7a/0x1720 [i915]
      [70841.002159] 	i915_pci_probe+0x2d/0x90 [i915]
      [70841.002165] 	pci_device_probe+0x9c/0x120
      [70841.002171] 	driver_probe_device+0x2a9/0x490
      [70841.002177] 	__driver_attach+0xd9/0xe0
      [70841.002182] 	bus_for_each_dev+0x57/0x90
      [70841.002188] 	bus_add_driver+0x1eb/0x260
      [70841.002193] 	driver_register+0x52/0xc0
      [70841.002198] 	do_one_initcall+0x39/0x170
      [70841.002462] kmem_cache_destroy drm_i915_gem_object: Slab cache still has objects
      
      [70841.002491] Call Trace:
      [70841.002497]  dump_stack+0x5e/0x8e
      [70841.002503]  kmem_cache_destroy+0x1e0/0x240
      [70841.002509]  ? __mutex_unlock_slowpath+0x38/0x270
      [70841.002551]  i915_gem_load_cleanup+0xbc/0x130 [i915]
      [70841.002586]  i915_driver_cleanup_early+0x11/0x60 [i915]
      [70841.002621]  i915_driver_load+0x708/0x1720 [i915]
      [70841.002629]  ? trace_hardirqs_on_caller+0xe2/0x1c0
      [70841.002664]  i915_pci_probe+0x2d/0x90 [i915]
      [70841.002671]  pci_device_probe+0x9c/0x120
      [70841.002678]  driver_probe_device+0x2a9/0x490
      [70841.002684]  __driver_attach+0xd9/0xe0
      [70841.002690]  ? driver_probe_device+0x490/0x490
      [70841.002696]  bus_for_each_dev+0x57/0x90
      [70841.002702]  bus_add_driver+0x1eb/0x260
      [70841.002708]  ? 0xffffffffa0685000
      [70841.002713]  driver_register+0x52/0xc0
      [70841.002719]  ? 0xffffffffa0685000
      [70841.002724]  do_one_initcall+0x39/0x170
      [70841.002731]  ? rcu_read_lock_sched_held+0x6f/0x80
      [70841.002737]  ? kmem_cache_alloc_trace+0x27b/0x2e0
      [70841.002745]  do_init_module+0x56/0x1ec
      [70841.002751]  load_module+0x219e/0x2550
      [70841.002758]  ? vfs_read+0x121/0x140
      [70841.002766]  ? SyS_finit_module+0xa5/0xe0
      [70841.002772]  SyS_finit_module+0xa5/0xe0
      [70841.002781]  entry_SYSCALL_64_fastpath+0x22/0x8f
      Signed-off-by: NMichal Wajdeczko <michal.wajdeczko@intel.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Sagar Arun Kamble <sagar.a.kamble@intel.com>
      Cc: Michal Winiarski <michal.winiarski@intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20180131173241.19704-2-michal.wajdeczko@intel.comReviewed-by: NSagar Arun Kamble <sagar.a.kamble@intel.com>
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      bf67ce62
  27. 25 1月, 2018 1 次提交
    • S
      drm/i915/guc: Fix lockdep due to log relay channel handling under struct_mutex · 70deeadd
      Sagar Arun Kamble 提交于
      This patch fixes lockdep issue due to circular locking dependency of
      struct_mutex, i_mutex_key, mmap_sem, relay_channels_mutex.
      For GuC log relay channel we create debugfs file that requires i_mutex_key
      lock and we are doing that under struct_mutex. So we introduced newer
      dependency as:
          &dev->struct_mutex --> &sb->s_type->i_mutex_key#3 --> &mm->mmap_sem
      However, there is dependency from mmap_sem to struct_mutex. Hence we
      separate the relay create/destroy operation from under struct_mutex.
      Also added runtime check of relay buffer status.
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      
      ======================================================
      WARNING: possible circular locking dependency detected
      4.15.0-rc6-CI-Patchwork_7614+ #1 Not tainted
      ------------------------------------------------------
      debugfs_test/1388 is trying to acquire lock:
       (&dev->struct_mutex){+.+.}, at: [<00000000d5e1d915>] i915_mutex_lock_interruptible+0x47/0x130 [i915]
      
      but task is already holding lock:
       (&mm->mmap_sem){++++}, at: [<0000000029a9c131>] __do_page_fault+0x106/0x560
      
      which lock already depends on the new lock.
      
      the existing dependency chain (in reverse order) is:
      
      -> #3 (&mm->mmap_sem){++++}:
             _copy_to_user+0x1e/0x70
             filldir+0x8c/0xf0
             dcache_readdir+0xeb/0x160
             iterate_dir+0xdc/0x140
             SyS_getdents+0xa0/0x130
             entry_SYSCALL_64_fastpath+0x1c/0x89
      
      -> #2 (&sb->s_type->i_mutex_key#3){++++}:
             start_creating+0x59/0x110
             __debugfs_create_file+0x2e/0xe0
             relay_create_buf_file+0x62/0x80
             relay_late_setup_files+0x84/0x250
             guc_log_late_setup+0x4f/0x110 [i915]
             i915_guc_log_register+0x32/0x40 [i915]
             i915_driver_load+0x7b6/0x1720 [i915]
             i915_pci_probe+0x2e/0x90 [i915]
             pci_device_probe+0x9c/0x120
             driver_probe_device+0x2a3/0x480
             __driver_attach+0xd9/0xe0
             bus_for_each_dev+0x57/0x90
             bus_add_driver+0x168/0x260
             driver_register+0x52/0xc0
             do_one_initcall+0x39/0x150
             do_init_module+0x56/0x1ef
             load_module+0x231c/0x2d70
             SyS_finit_module+0xa5/0xe0
             entry_SYSCALL_64_fastpath+0x1c/0x89
      
      -> #1 (relay_channels_mutex){+.+.}:
             relay_open+0x12c/0x2b0
             intel_guc_log_runtime_create+0xab/0x230 [i915]
             intel_guc_init+0x81/0x120 [i915]
             intel_uc_init+0x29/0xa0 [i915]
             i915_gem_init+0x182/0x530 [i915]
             i915_driver_load+0xaa9/0x1720 [i915]
             i915_pci_probe+0x2e/0x90 [i915]
             pci_device_probe+0x9c/0x120
             driver_probe_device+0x2a3/0x480
             __driver_attach+0xd9/0xe0
             bus_for_each_dev+0x57/0x90
             bus_add_driver+0x168/0x260
             driver_register+0x52/0xc0
             do_one_initcall+0x39/0x150
             do_init_module+0x56/0x1ef
             load_module+0x231c/0x2d70
             SyS_finit_module+0xa5/0xe0
             entry_SYSCALL_64_fastpath+0x1c/0x89
      
      -> #0 (&dev->struct_mutex){+.+.}:
             __mutex_lock+0x81/0x9b0
             i915_mutex_lock_interruptible+0x47/0x130 [i915]
             i915_gem_fault+0x201/0x790 [i915]
             __do_fault+0x15/0x70
             __handle_mm_fault+0x677/0xdc0
             handle_mm_fault+0x14f/0x2f0
             __do_page_fault+0x2d1/0x560
             page_fault+0x4c/0x60
      
      other info that might help us debug this:
      
      Chain exists of:
        &dev->struct_mutex --> &sb->s_type->i_mutex_key#3 --> &mm->mmap_sem
      
       Possible unsafe locking scenario:
      
             CPU0                    CPU1
             ----                    ----
        lock(&mm->mmap_sem);
                                     lock(&sb->s_type->i_mutex_key#3);
                                     lock(&mm->mmap_sem);
        lock(&dev->struct_mutex);
      
       *** DEADLOCK ***
      
      1 lock held by debugfs_test/1388:
       #0:  (&mm->mmap_sem){++++}, at: [<0000000029a9c131>] __do_page_fault+0x106/0x560
      
      stack backtrace:
      CPU: 2 PID: 1388 Comm: debugfs_test Not tainted 4.15.0-rc6-CI-Patchwork_7614+ #1
      Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./J4205-ITX, BIOS P1.10 09/29/2016
      Call Trace:
       dump_stack+0x5f/0x86
       print_circular_bug.isra.18+0x1d0/0x2c0
       __lock_acquire+0x14ae/0x1b60
       ? lock_acquire+0xaf/0x200
       lock_acquire+0xaf/0x200
       ? i915_mutex_lock_interruptible+0x47/0x130 [i915]
       __mutex_lock+0x81/0x9b0
       ? i915_mutex_lock_interruptible+0x47/0x130 [i915]
       ? i915_mutex_lock_interruptible+0x47/0x130 [i915]
       ? i915_mutex_lock_interruptible+0x47/0x130 [i915]
       i915_mutex_lock_interruptible+0x47/0x130 [i915]
       ? __pm_runtime_resume+0x4f/0x80
       i915_gem_fault+0x201/0x790 [i915]
       __do_fault+0x15/0x70
       ? _raw_spin_unlock+0x29/0x40
       __handle_mm_fault+0x677/0xdc0
       handle_mm_fault+0x14f/0x2f0
       __do_page_fault+0x2d1/0x560
       ? page_fault+0x36/0x60
       page_fault+0x4c/0x60
      
      v2: Added lock protection to guc->log.runtime.relay_chan (Chris)
          Fixed locking inside guc_flush_logs uncovered by new lockdep.
      
      v3: Locking guc_read_update_log_buffer entirely with relay_lock. (Chris)
          Prepared intel_guc_init_early. Moved relay_lock inside relay_create
          relay_destroy, relay_file_create, guc_read_update_log_buffer. (Michal)
          Removed struct_mutex lock around guc_log_flush and removed usage
          of guc_log_has_relay() from runtime_create path as it needs
          struct_mutex lock.
      
      v4: Handle NULL relay sub buffer pointer earlier in read_update_log_buffer
          (Chris). Fixed comment suffix **/. (Michal)
      
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104693
      Testcase: igt/debugfs_test/read_all_entries # with enable_guc=1 and guc_log_level=1
      Signed-off-by: NSagar Arun Kamble <sagar.a.kamble@intel.com>
      Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
      Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Marta Lofstedt <marta.lofstedt@intel.com>
      Cc: Michal Winiarski <michal.winiarski@intel.com>
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Link: https://patchwork.freedesktop.org/patch/msgid/1516808821-3638-3-git-send-email-sagar.a.kamble@intel.com
      70deeadd