drm/i915: Move drm_framebuffer_unreference out of struct_mutex for takeover
Subsystems (2)
PATCH 1/1 drm/i915: Move drm_framebuffer_unreference out of struct_mutex for takeover
From: Tvrtko Ursulin <[email protected]>
intel_user_framebuffer_destroy() requires the struct_mutex for its object bookkeeping, so this means that all calls to drm_framebuffer_unreference must be held without that lock.
This is a simplified version of the identically named patch by Chris Wilson.
References: https://bugs.freedesktop.org/show_bug.cgi?id=89166
--- drivers/gpu/drm/i915/intel_display.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/gpu/drm/i915/intel_display.c +10 -0
@@ -14020,11 +14020,21 @@ void intel_modeset_gem_init(struct drm_device *dev) c->primary->fb, c->primary->state, NULL)) { +/* +* We must drop struct_mutex when calling +* drm_framebuffer_unreference and it is safe to do so +* because it is not needed at this point anyway. +* At this stage the driver is still single-threaded and +* we are taking it only to silence a warning in +* intel_pin_and_fence_fb_obj. +*/ +mutex_unlock (&dev->struct_mutex);DRM_ERROR ("failed to pin boot fb on pipe %d\n" ,to_intel_crtc (c)->pipe);drm_framebuffer_unreference (c->primary->fb); c->primary->fb =NULL ;update_state_fb (c->primary); +mutex_lock (&dev->struct_mutex); } }mutex_unlock (&dev->struct_mutex);
Signature · 6 lines
2.3.2 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 31 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
intel_user_framebuffer_destroy()requires thestruct_mutexfor its object bookkeeping, so this means that all calls todrm_framebuffer_unreferencemust be held without that lock.This is a simplified version of the identically named patch by Chris Wilson.
References: https://bugs.freedesktop.org/show_bug.cgi?id=89166
Cc Chris Wilson <[email protected]>Signed-off-by Tvrtko Ursulin <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 10 ++++++++++ 1 file changed, 10 insertions(+)drivers/gpu/drm/i915/intel_display.c +8
-0@@ -14020,11 +14020,21 @@ void intel_modeset_gem_init(struct drm_device *dev) c->primary->fb, c->primary->state, NULL)) { +/* +* We must drop struct_mutex when calling +* drm_framebuffer_unreference and it is safe to do so +* because it is not needed at this point anyway. +* At this stage the driver is still single-threaded and +* we are taking it only to silence a warning in +* intel_pin_and_fence_fb_obj. +*/
drivers/gpu/drm/i915/intel_display.c void intel_modeset_gem_init(struct drm_device *dev) · line 14040
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +2
-0+mutex_unlock (&dev->struct_mutex);DRM_ERROR ("failed to pin boot fb on pipe %d\n" ,to_intel_crtc (c)->pipe);drm_framebuffer_unreference (c->primary->fb); c->primary->fb =NULL ;update_state_fb (c->primary); +mutex_lock (&dev->struct_mutex); } }mutex_unlock (&dev->struct_mutex);
Just grab the mutex around the pin_and_fence inside the loop. It doesn't protect anything else.
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 37 lines · Ville Syrjälä
Quoted 36 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
intel_user_framebuffer_destroy()requires thestruct_mutexfor its object bookkeeping, so this means that all calls todrm_framebuffer_unreferencemust be held without that lock.This is a simplified version of the identically named patch by Chris Wilson.
References: https://bugs.freedesktop.org/show_bug.cgi?id=89166
Cc Chris Wilson <[email protected]>Signed-off-by Tvrtko Ursulin <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 10 ++++++++++ 1 file changed, 10 insertions(+)drivers/gpu/drm/i915/intel_display.c +9
-0@@ -14020,11 +14020,21 @@ void intel_modeset_gem_init(struct drm_device *dev) c->primary->fb, c->primary->state, NULL)) { +/* +* We must drop struct_mutex when calling +* drm_framebuffer_unreference and it is safe to do so +* because it is not needed at this point anyway. +* At this stage the driver is still single-threaded and +* we are taking it only to silence a warning in +* intel_pin_and_fence_fb_obj. +*/ +mutex_unlock (&dev->struct_mutex);DRM_ERROR ("failed to pin boot fb on pipe %d\n" ,to_intel_crtc (c)->pipe);drm_framebuffer_unreference (c->primary->fb); c->primary->fb =NULL ;
Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c void intel_modeset_gem_init(struct drm_device *dev) · line 14040
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +1
-0update_state_fb (c->primary); +mutex_lock (&dev->struct_mutex); } }mutex_unlock (&dev->struct_mutex);Just grab the mutex around the
pin_and_fenceinside the loop. It doesn't protect anything else.
Well the comment says so, but this way it only grabs and releases it once if there are multiple active crtcs and nothing fails. So I was hoping the comment was enough to explain the reality, even though the other option would be more obvious code strictly speaking.
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Jani Nikula
maintainerQuoted 47 lines · Tvrtko Ursulin
Quoted 37 lines · Ville Syrjälä
Quoted 36 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
intel_user_framebuffer_destroy()requires thestruct_mutexfor its object bookkeeping, so this means that all calls todrm_framebuffer_unreferencemust be held without that lock.This is a simplified version of the identically named patch by Chris Wilson.
References: https://bugs.freedesktop.org/show_bug.cgi?id=89166
Cc Chris Wilson <[email protected]>Signed-off-by Tvrtko Ursulin <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 10 ++++++++++ 1 file changed, 10 insertions(+)drivers/gpu/drm/i915/intel_display.c +9
-0@@ -14020,11 +14020,21 @@ void intel_modeset_gem_init(struct drm_device *dev) c->primary->fb, c->primary->state, NULL)) { +/* +* We must drop struct_mutex when calling +* drm_framebuffer_unreference and it is safe to do so +* because it is not needed at this point anyway. +* At this stage the driver is still single-threaded and +* we are taking it only to silence a warning in +* intel_pin_and_fence_fb_obj. +*/ +mutex_unlock (&dev->struct_mutex);DRM_ERROR ("failed to pin boot fb on pipe %d\n" ,to_intel_crtc (c)->pipe);drm_framebuffer_unreference (c->primary->fb); c->primary->fb =NULL ;Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c void intel_modeset_gem_init(struct drm_device *dev) · line 14040
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +1
-0update_state_fb (c->primary); +mutex_lock (&dev->struct_mutex); } }mutex_unlock (&dev->struct_mutex);Just grab the mutex around the
pin_and_fenceinside the loop. It doesn't protect anything else.
Quoted 4 lines
Well the comment says so, but this way it only grabs and releases it once if there are multiple active crtcs and nothing fails. So I was hoping the comment was enough to explain the reality, even though the other option would be more obvious code strictly speaking.
Tvrtko & Ville, can you reach a solution on this one? Or is there a new patch that I may have missed?
BR,
Jani.
Quoted 8 lines
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 48 lines · Jani Nikula
Quoted 47 lines · Tvrtko Ursulin
Quoted 45 lines · Ville Syrjälä
Quoted 31 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
intel_user_framebuffer_destroy()requires thestruct_mutexfor its object bookkeeping, so this means that all calls todrm_framebuffer_unreferencemust be held without that lock.This is a simplified version of the identically named patch by Chris Wilson.
References: https://bugs.freedesktop.org/show_bug.cgi?id=89166
Cc Chris Wilson <[email protected]>Signed-off-by Tvrtko Ursulin <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 10 ++++++++++ 1 file changed, 10 insertions(+)drivers/gpu/drm/i915/intel_display.c +8
-0@@ -14020,11 +14020,21 @@ void intel_modeset_gem_init(struct drm_device *dev) c->primary->fb, c->primary->state, NULL)) { +/* +* We must drop struct_mutex when calling +* drm_framebuffer_unreference and it is safe to do so +* because it is not needed at this point anyway. +* At this stage the driver is still single-threaded and +* we are taking it only to silence a warning in +* intel_pin_and_fence_fb_obj. +*/ drivers/gpu/drm/i915/intel_display.c void intel_modeset_gem_init(struct drm_device *dev) · line 14040
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +2
-0+mutex_unlock (&dev->struct_mutex);DRM_ERROR ("failed to pin boot fb on pipe %d\n" ,to_intel_crtc (c)->pipe);drm_framebuffer_unreference (c->primary->fb); c->primary->fb =NULL ;update_state_fb (c->primary); +mutex_lock (&dev->struct_mutex); } }mutex_unlock (&dev->struct_mutex);Just grab the mutex around the
pin_and_fenceinside the loop. It doesn't protect anything else.
Quoted 7 lines
Quoted 4 lines
Well the comment says so, but this way it only grabs and releases it once if there are multiple active crtcs and nothing fails. So I was hoping the comment was enough to explain the reality, even though the other option would be more obvious code strictly speaking.
Tvrtko & Ville, can you reach a solution on this one? Or is there a new patch that I may have missed?
It was pretty much bike shedding - I am happy with this version since it has a single lock/unlock on the normal path, compared to one pair per active display with what Ville wanted.
Either approach makes for unclear code so needs a big comment anyway. Which leaves only the exact placement of mutex_lock/unlock under discussion.
If we want to spend this much time on this that is.
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 58 lines · Tvrtko Ursulin
Quoted 48 lines · Jani Nikula
Quoted 47 lines · Tvrtko Ursulin
Quoted 45 lines · Ville Syrjälä
Quoted 31 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
intel_user_framebuffer_destroy()requires thestruct_mutexfor its object bookkeeping, so this means that all calls todrm_framebuffer_unreferencemust be held without that lock.This is a simplified version of the identically named patch by Chris Wilson.
References: https://bugs.freedesktop.org/show_bug.cgi?id=89166
Cc Chris Wilson <[email protected]>Signed-off-by Tvrtko Ursulin <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 10 ++++++++++ 1 file changed, 10 insertions(+)drivers/gpu/drm/i915/intel_display.c +8
-0@@ -14020,11 +14020,21 @@ void intel_modeset_gem_init(struct drm_device *dev) c->primary->fb, c->primary->state, NULL)) { +/* +* We must drop struct_mutex when calling +* drm_framebuffer_unreference and it is safe to do so +* because it is not needed at this point anyway. +* At this stage the driver is still single-threaded and +* we are taking it only to silence a warning in +* intel_pin_and_fence_fb_obj. +*/ drivers/gpu/drm/i915/intel_display.c void intel_modeset_gem_init(struct drm_device *dev) · line 14040
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +2
-0+mutex_unlock (&dev->struct_mutex);DRM_ERROR ("failed to pin boot fb on pipe %d\n" ,to_intel_crtc (c)->pipe);drm_framebuffer_unreference (c->primary->fb); c->primary->fb =NULL ;update_state_fb (c->primary); +mutex_lock (&dev->struct_mutex); } }mutex_unlock (&dev->struct_mutex);Just grab the mutex around the
pin_and_fenceinside the loop. It doesn't protect anything else.Quoted 7 lines
Quoted 4 lines
Well the comment says so, but this way it only grabs and releases it once if there are multiple active crtcs and nothing fails. So I was hoping the comment was enough to explain the reality, even though the other option would be more obvious code strictly speaking.
Tvrtko & Ville, can you reach a solution on this one? Or is there a new patch that I may have missed?
Quoted 6 lines
It was pretty much bike shedding - I am happy with this version since it has a single lock/unlock on the normal path, compared to one pair per active display with what Ville wanted.
Either approach makes for unclear code so needs a big comment anyway. Which leaves only the exact placement of mutex_lock/unlock under discussion.
I don't see what's unclear about locking only around the call that needs the lock.
Quoted 6 lines
If we want to spend this much time on this that is.
Regards,
Tvrtko
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Task id: 6061 -------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied
PNV -1 276/276 275/276
ILK 303/303 303/303 SNB 304/304 304/304 IVB 339/339 339/339 BYT 287/287 287/287 HSW 362/362 362/362 BDW 310/310 310/310
-------------------------------------Detailed-------------------------------------
Platform Test drm-intel-nightly Series Applied
*PNV igt@gem_userptr_blits@minor-unsync-interruptible PASS(2) DMESG_WARN(2)
(dmesg patch applied)WARNING:at_drivers/gpu/drm/i915/i915_gem_evict.c:#i915_gem_evict_vm[i915]()@WARNING:.* at .* i915_gem_evict_vm+0x
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx