drm/i915: Hide GEM shutdown in i915_gem_fini
Subsystems (2)
PATCH 1/1 drm/i915: Hide GEM shutdown in i915_gem_fini
From: Tvrtko Ursulin <[email protected]>
As we have i915_gem_init, do the reverse in new i915_gem_fini so the fragile order of doing things is hidden from the outside and only at one place.
--- drivers/gpu/drm/i915/i915_dma.c | 6 ++---- drivers/gpu/drm/i915/i915_drv.h | 2 +- drivers/gpu/drm/i915/i915_gem.c | 40 ++++++++++++++++++++++++---------------- 3 files changed, 27 insertions(+), 21 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +2 -4
@@ -444,8 +444,7 @@ static int i915_load_modeset_init(struct drm_device *dev) cleanup_gem:mutex_lock (&dev->struct_mutex); -i915_gem_context_fini (dev); -i915_gem_cleanup_engines (dev); +i915_gem_fini (dev);mutex_unlock (&dev->struct_mutex); cleanup_irq:intel_guc_ucode_fini (dev);
@@ -1256,8 +1255,7 @@ int i915_driver_unload(struct drm_device *dev)intel_guc_ucode_fini (dev);mutex_lock (&dev->struct_mutex); -i915_gem_context_fini (dev); -i915_gem_cleanup_engines (dev); +i915_gem_fini (dev);mutex_unlock (&dev->struct_mutex);intel_fbc_cleanup_cfb (dev_priv);
drivers/gpu/drm/i915/i915_drv.h +1 -1
@@ -3060,11 +3060,11 @@ static inline bool i915_stop_ring_allow_warn(struct drm_i915_private *dev_priv)void i915_gem_reset (struct drm_device *dev);bool i915_gem_clflush_object (struct drm_i915_gem_object *obj,bool force);int __must_check i915_gem_init (struct drm_device *dev); +void __must_check i915_gem_fini (struct drm_device *dev);int i915_gem_init_rings (struct drm_device *dev);int __must_check i915_gem_init_hw (struct drm_device *dev);int i915_gem_l3_remap (struct drm_i915_gem_request *req,int slice);void i915_gem_init_swizzling (struct drm_device *dev); -void i915_gem_cleanup_engines (struct drm_device *dev);int __must_check i915_gpu_idle (struct drm_device *dev);int __must_check i915_gem_suspend (struct drm_device *dev); void __i915_add_request(struct drm_i915_gem_request *req,
drivers/gpu/drm/i915/i915_gem.c +24 -16
@@ -4834,6 +4834,26 @@ cleanup_render_ring:return ret; } +static void +i915_gem_cleanup_engines (struct drm_device *dev) +{ +struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_engine_cs *ring; +int i; + +for_each_ring (ring, dev_priv, i) + dev_priv->gt.cleanup_ring (ring); + +if (i915.enable_execlists) { +/* +* Neither the BIOS, ourselves or any other kernel +* expects the system to be in execlists mode on startup, +* so we need to reset the GPU back to legacy mode. +*/ +intel_gpu_reset (dev); + } +} +int i915_gem_init_hw (struct drm_device *dev) {
@@ -5011,24 +5031,12 @@ out_unlock:return ret; } -void -i915_gem_cleanup_engines (struct drm_device *dev) +void i915_gem_fini (struct drm_device *dev) { -struct drm_i915_private *dev_priv = dev->dev_private; -struct intel_engine_cs *ring; -int i; - -for_each_ring (ring, dev_priv, i) - dev_priv->gt.cleanup_ring (ring); +lockdep_assert_held (&dev->struct_mutex); -if (i915.enable_execlists) { -/* -* Neither the BIOS, ourselves or any other kernel -* expects the system to be in execlists mode on startup, -* so we need to reset the GPU back to legacy mode. -*/ -intel_gpu_reset (dev); - } +i915_gem_context_fini (dev); +i915_gem_cleanup_engines (dev); } static void
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 74 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
As we have
i915_gem_init, do the reverse in newi915_gem_finiso the fragile order of doing things is hidden from the outside and only at one place.Signed-off-by Tvrtko Ursulin <[email protected]>Cc Nick Hoath <[email protected]>Cc David Gordon <[email protected]>Cc Chris Wilson <[email protected]>Cc Mika Kuoppala <[email protected]>--- drivers/gpu/drm/i915/i915_dma.c | 6 ++---- drivers/gpu/drm/i915/i915_drv.h | 2 +- drivers/gpu/drm/i915/i915_gem.c | 40 ++++++++++++++++++++++++---------------- 3 files changed, 27 insertions(+), 21 deletions(-)drivers/gpu/drm/i915/i915_dma.c +2
-4@@ -444,8 +444,7 @@ static int i915_load_modeset_init(struct drm_device *dev) cleanup_gem:mutex_lock (&dev->struct_mutex); -i915_gem_context_fini (dev); -i915_gem_cleanup_engines (dev); +i915_gem_fini (dev);mutex_unlock (&dev->struct_mutex); cleanup_irq:intel_guc_ucode_fini (dev);@@ -1256,8 +1255,7 @@ int i915_driver_unload(struct drm_device *dev)intel_guc_ucode_fini (dev);mutex_lock (&dev->struct_mutex); -i915_gem_context_fini (dev); -i915_gem_cleanup_engines (dev); +i915_gem_fini (dev);mutex_unlock (&dev->struct_mutex);intel_fbc_cleanup_cfb (dev_priv);drivers/gpu/drm/i915/i915_drv.h +1
-1@@ -3060,11 +3060,11 @@ static inline bool i915_stop_ring_allow_warn(struct drm_i915_private *dev_priv)void i915_gem_reset (struct drm_device *dev);bool i915_gem_clflush_object (struct drm_i915_gem_object *obj,bool force);int __must_check i915_gem_init (struct drm_device *dev); +void __must_check i915_gem_fini (struct drm_device *dev);int i915_gem_init_rings (struct drm_device *dev);int __must_check i915_gem_init_hw (struct drm_device *dev);int i915_gem_l3_remap (struct drm_i915_gem_request *req,int slice);void i915_gem_init_swizzling (struct drm_device *dev); -void i915_gem_cleanup_engines (struct drm_device *dev);int __must_check i915_gpu_idle (struct drm_device *dev);int __must_check i915_gem_suspend (struct drm_device *dev); void __i915_add_request(struct drm_i915_gem_request *req,drivers/gpu/drm/i915/i915_gem.c +8
-0@@ -4834,6 +4834,26 @@ cleanup_render_ring:return ret; } +static void +i915_gem_cleanup_engines (struct drm_device *dev) +{ +struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_engine_cs *ring; +int i; + +for_each_ring (ring, dev_priv, i)
drivers/gpu/drm/i915/i915_gem.c cleanup_render_ring: · line 4854
Quoted 10 lines
drivers/gpu/drm/i915/i915_gem.c +10
-0+ dev_priv->gt.cleanup_ring (ring); + +if (i915.enable_execlists) { +/* +* Neither the BIOS, ourselves or any other kernel +* expects the system to be in execlists mode on startup, +* so we need to reset the GPU back to legacy mode. +*/ +intel_gpu_reset (dev); + }
This needs to be before contex-fini. If you move this outside of the mutex, we can then use i915_gpu_reset() and do the full state cleanup. Similarly that also moves the mutex handling inside i915_gem_fini as well.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
kbuild test robot
build botreproduce:
Hi Tvrtko,
[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on next-20160211]
[cannot apply to v4.5-rc3]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
url: https://github.com/0day-ci/linux/commits/Tvrtko-Ursulin/drm-i915-Hide-GEM-shutdown-in-i915_gem_fini/20160211-234159 base: git://anongit.freedesktop.org/drm-intel for-linux-next config: i386-randconfig-i0-201606 (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=i386
All warnings (new ones prefixed by >>):
In file included from drivers/gpu/drm/i915/i915_drv.c:34:0:
>> drivers/gpu/drm/i915/i915_drv.h:3057:40: warning: 'warn_unused_result' attribute ignored [-Wattributes]
void __must_check i915_gem_fini(struct drm_device *dev);
^vim +/warn_unused_result +3057 drivers/gpu/drm/i915/i915_drv.h
3041
3042 static inline bool i915_stop_ring_allow_ban(struct drm_i915_private *dev_priv)
3043 {
3044 return dev_priv->gpu_error.stop_rings == 0 ||
3045 dev_priv->gpu_error.stop_rings & I915_STOP_RING_ALLOW_BAN;
3046 }
3047
3048 static inline bool i915_stop_ring_allow_warn(struct drm_i915_private *dev_priv)
3049 {
3050 return dev_priv->gpu_error.stop_rings == 0 ||
3051 dev_priv->gpu_error.stop_rings & I915_STOP_RING_ALLOW_WARN;
3052 }
3053
3054 void i915_gem_reset(struct drm_device *dev);
3055 bool i915_gem_clflush_object(struct drm_i915_gem_object *obj, bool force);
3056 int __must_check i915_gem_init(struct drm_device *dev);
> 3057 void __must_check i915_gem_fini(struct drm_device *dev);
3058 int i915_gem_init_rings(struct drm_device *dev);
3059 int __must_check i915_gem_init_hw(struct drm_device *dev);
3060 int i915_gem_l3_remap(struct drm_i915_gem_request *req, int slice);
3061 void i915_gem_init_swizzling(struct drm_device *dev);
3062 int __must_check i915_gpu_idle(struct drm_device *dev);
3063 int __must_check i915_gem_suspend(struct drm_device *dev);
3064 void __i915_add_request(struct drm_i915_gem_request *req,
3065 struct drm_i915_gem_object *batch_obj,
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for drm/i915: Hide GEM shutdown in i915_gem_fini
In reply to Tvrtko Ursulin== Summary ==
== Summary ==
Series 3296v1 drm/i915: Hide GEM shutdown in i915_gem_fini
2016-02-11T15:39:33.521840 http://patchwork.freedesktop.org/api/1.0/series/3296/revisions/1/mbox/
Applying: drm/i915: Hide GEM shutdown in i915_gem_fini Repository lacks necessary blobs to fall back on 3-way merge. Cannot fall back to three-way merge.
Patch failed at 0001 drm/i915: Hide GEM shutdown in i915_gem_fini
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx