From patchwork Wed Aug 16 14:22:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zuo, Jerry" X-Patchwork-Id: 9904167 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 12E65600CA for ; Wed, 16 Aug 2017 16:56:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0496828A1B for ; Wed, 16 Aug 2017 16:56:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ED8AF28A47; Wed, 16 Aug 2017 16:56:14 +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.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham 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 6EAD828A48 for ; Wed, 16 Aug 2017 16:56:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C881F89DA3; Wed, 16 Aug 2017 16:56:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 9182 seconds by postgrey-1.35 at gabe; Wed, 16 Aug 2017 16:56:11 UTC Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0070.outbound.protection.outlook.com [104.47.40.70]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7E51089DA3; Wed, 16 Aug 2017 16:56:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=++sFl8Ualq9aYnJKvcb8mPQini53fcAp1SuAqOvaGE4=; b=K6aAaoG/RneeG9kCWvujE3eekN2W/nCauBl5lWsfapNUL1sP2t5IqdaCOua4Rf1aoS+fCCoKpTYtlbSLo/cvS+d5lZVhiOCs9dACSJ2kVeB8t3xo7yZmRy0JmvFWuDQLsg3oLk4pfQmmjDtJjuBBArjnUBgsvsFbtVfM6dlnATs= Received: from BN6PR12CA0045.namprd12.prod.outlook.com (10.160.47.31) by DM5PR12MB1275.namprd12.prod.outlook.com (10.168.237.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1341.21; Wed, 16 Aug 2017 14:23:07 +0000 Received: from BY2NAM03FT024.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::203) by BN6PR12CA0045.outlook.office365.com (2603:10b6:405:70::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1341.21 via Frontend Transport; Wed, 16 Aug 2017 14:23:07 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by BY2NAM03FT024.mail.protection.outlook.com (10.152.84.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.1341.15 via Frontend Transport; Wed, 16 Aug 2017 14:23:06 +0000 Received: from SATLEXDAG04.amd.com (10.181.40.9) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server (TLS) id 14.3.361.1; Wed, 16 Aug 2017 09:23:05 -0500 Received: from localhost.localdomain (10.180.168.240) by satlexdag04.amd.com (10.181.40.9) with Microsoft SMTP Server id 14.3.361.1; Wed, 16 Aug 2017 10:23:04 -0400 From: Jerry Zuo To: , Subject: [PATCH] drm/amd/display: put commit when -ERESTARTSYS received Date: Wed, 16 Aug 2017 10:22:24 -0400 Message-ID: <20170816142224.25173-1-Jerry.Zuo@amd.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(39860400002)(2980300002)(428002)(189002)(199003)(72206003)(97736004)(356003)(478600001)(8936002)(68736007)(305945005)(50986999)(4326008)(36756003)(101416001)(626005)(189998001)(8676002)(81156014)(81166006)(1076002)(50466002)(86362001)(50226002)(53936002)(77096006)(2906002)(5660300001)(49486002)(6666003)(5003940100001)(47776003)(54906002)(105586002)(106466001)(48376002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR12MB1275; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2NAM03FT024; 1:MVO7fhrQxBKkcQcS1+/BOT/AjSTDIs7KAtKHTTQUIQXYjn+cyTSDcGkV/250ktr5h1DRdCYIpNtPvgBWVHWEqypq63alpWonRLTjDddFwafEbMDn70oF0jnN54bmooJE X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c4bbeaa4-4df6-45f5-07f3-08d4e4b24ffd X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(300000503095)(300135400095)(2017052603031)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:DM5PR12MB1275; X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1275; 3:o5lHWJVYatzxa1QGPCvV1T5bgW/WHa0z8OCmX4IiHKT9sBuntvIY0cpQcOKX4oj4QKQckEX0Z4+VRc7PaR5NirQEzjzQc443xfqbu3mlnLJUYIj7zGncVP55Lvk6rdcbon5CvBOHozIP1sOhAEl3cDQyxJ14vZL4rmRcVcijWqWWDgHP4QiZRGzxu2D8AubpHoSgy9BZ/WoBz+1L1SLzDHYcxbRCkxwU8WCth8Y3N71b1fL1X4eqRT2SdDDN/ENpoN1yDWifR2JYYW2O9fY3o3nBzSn1OxI3tqPuxzIZgPOvZQ5Tu4LdGHpXATwze39AqcoxjhrbRX4hZ8mgorj2OLpL4yYDUXWDvdBOs03Jh6U=; 25:bnTvlcj/lKUi4K2uKKs6FiC3oWOuRiXK8OiJN82o51sV/QTfcau/CcJhn4ZBfdlDx6Js0On2UAkBJ7hbC0sxCoBn+tiiSp32b1r/Bvl1G22GI2rpcnT4fhyKpsO9fUjaiAfGng24gFd5moZT+AwUKMYd+Q27ntM8TF7WiimCYFWOpBbF/KpKXpTquZ+kZ58mHjoWAuhbgs+WXyMjk22LgvcCVM0J4smgdCZLcQsQbUPv6RrzN1age6fxGQbv1dWYMRBBgOaR1nPG4jRjp/Vl2NA+FB7xvdOuv9cE/LgiGrkAFGhTSCT0BnwxmPpHnOGDvIG2vcfZAIpg4KAmQcl0Dg== X-MS-TrafficTypeDiagnostic: DM5PR12MB1275: X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1275; 31:DljPKsKjMHhH+rU9I6j4RAcGk+yA8AcLVZODfco8ZL6sEZ80LPSXiJUhJQFcAaZEI+qVk923ZfvCt4r4q1oEDVugxECo1rJIE2EeGmNTGRwNosXVG/qauRouND/AG/INj/Yg/oEl+yvBcEsUUI9O2E3XYY2M8XYSYZi0lkIdrKyUG57b576pzp5Ol+u8kpVWDUofIk6znI5f4kJpACoClZIgJLea1aV7qTQgp7zeYsA=; 20:nkGGDpWchmwxh4G2AS2t8yvDgzGV2Z2ietPkJjB9uIWSJSXZ0XjQd++nvJJ7nuifHmrD6hKYHgqxfi/SRM2Vjea/CkoiBSAYoBPu3WGP22nOfcN798598xgncddqZ9IUcy/5G6gEvjCv6zkM6gfDbfjtqmNtrIVa/P6ev3EQ9YMJwg6QacsNNqUATplGdqS688qdK/ChAKanvSIyMQ1Al822J9uFWjKDpQb4D1iQwg1UDQDvOX+a5a5IZU5Vdx1SWqA370WECVaWE8ditrVq8kqMw5g+mZlLeyk8hb+MNZa9ItY7ksjzQyVMGNGwqkzSCxE8x/2hnvi/edCneiaX4EarlYzsD+Ofa9an44pL9k/Y7kyM9FpQtPjWIbr1Mjt1m249DhBsMff3bLR5SHkidrj+Yzf/98yNPanYWefwCPjDM2fvh1+1OAEGB0P5cSjp4XuK8LP/hWSbT2FpLLBgBSJtrFdi5NtPgvM6ah/hqiDF4ubYkx0r63Oi8S0zQA0j X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(13016025)(5005006)(13018025)(3002001)(100000703101)(100105400095)(10201501046)(93006095)(93003095)(6055026)(6041248)(20161123555025)(20161123562025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM5PR12MB1275; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM5PR12MB1275; X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1275; 4:ri4MocvxQhYar3f7Hy0j6DD0BktGe9Hz09b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IQea9Q7KEtMDxNZNY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1275; 20:RQPYB2RMod6wEKExTxUGfJLQTZ/DwLnogKktB11Km/Kq4z4kWDk4bzqb9XVLikqzhWbASqD+SgBgzzXDHd4la+aJSMWfhMTKxJALV0ojjssUPk2JSr8RMPB2rONzThK9DLAJW67mOnP4pOCOskJfxRNWrHdJZpDtyp6/47TBEb42IcSfLQw8xrfG31bk0xmifsc6DxIBOtiJLUDM1Cn7ZVAxVc8AJyu4/VKZ6T1EtMjM0pkHeHkijvp32MuS3Rgh X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2017 14:23:06.1345 (UTC) X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1275 Cc: daniel.vetter@ffwll.ch, Jerry Zuo 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 During page flip atomic_check and atomic_commit can return -ERESTARTSYS to restart the ioctl. When this happens we fail to put the commit object leading to a memory leak. Signed-off-by: Jerry Zuo --- drivers/gpu/drm/drm_atomic.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index f32506a7c1d6..f2f623dacf90 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -1642,14 +1642,35 @@ int drm_atomic_nonblocking_commit(struct drm_atomic_state *state) { struct drm_mode_config *config = &state->dev->mode_config; int ret; + int i; + struct drm_crtc *crtc; + struct drm_crtc_state *crtc_state; ret = drm_atomic_check_only(state); - if (ret) + if (ret) { + if (ret == -ERESTARTSYS) + goto fail; + return ret; + } DRM_DEBUG_ATOMIC("commiting %p nonblocking\n", state); - return config->funcs->atomic_commit(state->dev, state, true); + ret = config->funcs->atomic_commit(state->dev, state, true); + if (ret == -ERESTARTSYS) + goto fail; + + return ret; + + /* cleanup commit object if commit fails with ERESTARTSYS */ +fail: + for_each_crtc_in_state(state, crtc, crtc_state, i) { + if (state->crtcs[i].commit) { + drm_crtc_commit_put(state->crtcs[i].commit); + } + } + + return ret; } EXPORT_SYMBOL(drm_atomic_nonblocking_commit);