From patchwork Wed Dec 13 17:23:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maarten Lankhorst X-Patchwork-Id: 10110465 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 47A7D60327 for ; Wed, 13 Dec 2017 17:23:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2EA31292EE for ; Wed, 13 Dec 2017 17:23:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 23247292DD; Wed, 13 Dec 2017 17:23:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E8A1828FA3 for ; Wed, 13 Dec 2017 17:23:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E7FA36E546; Wed, 13 Dec 2017 17:23:43 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id 307116E0E0; Wed, 13 Dec 2017 17:23:42 +0000 (UTC) X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Dec 2017 09:23:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,397,1508828400"; d="scan'208";a="2446326" Received: from kseifrie-mobl.ger.corp.intel.com (HELO [10.252.51.161]) ([10.252.51.161]) by orsmga007.jf.intel.com with ESMTP; 13 Dec 2017 09:23:39 -0800 Subject: Re: Non-blocking commits on -ERESTARTSYS To: Leo Li , dri-devel@lists.freedesktop.org, Daniel Vetter References: <018d7df5-15cb-38f5-8ade-53db7b197c1a@amd.com> From: Maarten Lankhorst Message-ID: <19f321ab-8896-f746-3d75-e50e680b8c00@linux.intel.com> Date: Wed, 13 Dec 2017 18:23:37 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <018d7df5-15cb-38f5-8ade-53db7b197c1a@amd.com> Content-Language: en-US Cc: "Zuo, Jerry" , Intel Graphics Development X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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.. 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);