From mboxrd@z Thu Jan 1 00:00:00 1970 From: Maarten Lankhorst Subject: Re: Non-blocking commits on -ERESTARTSYS Date: Wed, 13 Dec 2017 18:23:37 +0100 Message-ID: <19f321ab-8896-f746-3d75-e50e680b8c00@linux.intel.com> References: <018d7df5-15cb-38f5-8ade-53db7b197c1a@amd.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------B4D761A800BD6604EF6B065C" Return-path: In-Reply-To: <018d7df5-15cb-38f5-8ade-53db7b197c1a@amd.com> Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Leo Li , dri-devel@lists.freedesktop.org, Daniel Vetter Cc: "Zuo, Jerry" , Harry Wentland , Intel Graphics Development List-Id: intel-gfx@lists.freedesktop.org This is a multi-part message in MIME format. --------------B4D761A800BD6604EF6B065C Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Op 13-12-17 om 17:19 schreef Leo Li: > Hi Daniel, Maarten, > > Just digging an old thread out of the grave: > https://lists.freedesktop.org/archives/dri-devel/2017-August/150495.html > > It's suppose to fix a memory leak on the drm_commit object during > non-blocking commits. Within drm_atomic_helper_setup_commit, a reference > to the commit object is obtained by the new_crtc_state. This reference > is suppose to be 'put' once flip_done is signaled (via the > release_crtc_commit callback), but never happens if .prepare_fb returns > -ERESTARTSYS: drm_atomic_helper_commit early returns before the > commit_tail work is queued. > > We're starting to bump into this issue again. Regarding Daniel's > suggestion for an IGT test, has there been any work done on it? I'd be > interested in taking a look otherwise. As a side note, I can also > reproduce this on i915. > > Thanks, > Leo I'm curious, isn't it better to handle this in __drm_atomic_helper_crtc_destroy_state with the attached patch? No idea if sane though, but drivers are supposed to clear crtc_state->event on success.. --------------B4D761A800BD6604EF6B065C Content-Type: text/x-diff; name="drop-extra-refcount.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="drop-extra-refcount.patch" diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 593b30d38ce0..e71233b4c651 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -3435,6 +3435,8 @@ EXPORT_SYMBOL(drm_atomic_helper_crtc_duplicate_state); void __drm_atomic_helper_crtc_destroy_state(struct drm_crtc_state *state) { if (state->commit) { + if (state->event) + drm_crtc_commit_put(state->commit); kfree(state->commit->event); state->commit->event = NULL; drm_crtc_commit_put(state->commit); --------------B4D761A800BD6604EF6B065C Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vaW50ZWwtZ2Z4Cg== --------------B4D761A800BD6604EF6B065C--