drm/core: Do not call drm_framebuffer_remove internally during teardown.
Subsystems (2)
Maarten Lankhorst
maintainerPATCH 1/1 drm/core: Do not call drm_framebuffer_remove internally during teardown.
This may cause issues because encoders are already destroyed so removing active primaries may use freed memory. Instead free the fb directly, ignoring refcount.
--- drivers/gpu/drm/drm_crtc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_crtc.c +1 -1
@@ -5742,7 +5742,7 @@ void drm_mode_config_cleanup(struct drm_device *dev)*/ WARN_ON (!list_empty (&dev->mode_config.fb_list));list_for_each_entry_safe (fb, fbt, &dev->mode_config.fb_list, head) { -drm_framebuffer_remove (fb); +drm_framebuffer_free (&fb->refcount); } list_for_each_entry_safe(plane, plt, &dev->mode_config.plane_list,
Signature · 6 lines
2.1.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 3 lines · Maarten Lankhorst
This may cause issues because encoders are already destroyed so removing active primaries may use freed memory. Instead free the fb directly, ignoring refcount.
So what about fixing the cause, not the symptom? That is remove framebuffers before nuking crtc/encoders/etc.
Quoted 26 lines
Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/drm_crtc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/drm_crtc.c +1
-1@@ -5742,7 +5742,7 @@ void drm_mode_config_cleanup(struct drm_device *dev)*/ WARN_ON (!list_empty (&dev->mode_config.fb_list));list_for_each_entry_safe (fb, fbt, &dev->mode_config.fb_list, head) { -drm_framebuffer_remove (fb); +drm_framebuffer_free (&fb->refcount); } list_for_each_entry_safe(plane, plt, &dev->mode_config.plane_list,Signature · 6 lines
2.1.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 7 lines · Ville Syrjälä
Quoted 3 lines · Maarten Lankhorst
This may cause issues because encoders are already destroyed so removing active primaries may use freed memory. Instead free the fb directly, ignoring refcount.
So what about fixing the cause, not the symptom? That is remove framebuffers before nuking crtc/encoders/etc.
Also by that point we shouldn't have any framebuffers left (the WARN_ON is for that), so not sure what's the point of this patch. -Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Maarten Lankhorst
maintainerOp 09-09-15 om 13:59 schreef Daniel Vetter:
Quoted 11 lines
Quoted 6 lines · Ville Syrjälä
Quoted 3 lines · Maarten Lankhorst
This may cause issues because encoders are already destroyed so removing active primaries may use freed memory. Instead free the fb directly, ignoring refcount.
So what about fixing the cause, not the symptom? That is remove framebuffers before nuking crtc/encoders/etc.
Also by that point we shouldn't have any framebuffers left (the
WARN_ONis for that), so not sure what's the point of this patch. -Daniel
Yes, but the current way would crash on atomic because encoders are already done. This removes a caller of drm_framebuffer_remove and uses the correct destroy function regardless even when refcounts are leaked. :)
~Maarten
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 9 lines · Maarten Lankhorst
Op 09-09-15 om 13:59 schreef Daniel Vetter:
Quoted 8 lines
Quoted 6 lines · Ville Syrjälä
Quoted 3 lines · Maarten Lankhorst
This may cause issues because encoders are already destroyed so removing active primaries may use freed memory. Instead free the fb directly, ignoring refcount.
So what about fixing the cause, not the symptom? That is remove framebuffers before nuking crtc/encoders/etc.
Quoted 7 lines
Quoted 3 lines
Also by that point we shouldn't have any framebuffers left (the
WARN_ONis for that), so not sure what's the point of this patch. -DanielYes, but the current way would crash on atomic because encoders are already done. This removes a caller of
drm_framebuffer_removeand uses the correct destroy function regardless even when refcounts are leaked. :)
Makes some sense I guess ... applied to drm-misc, thanks. -Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel