Message ID | 20230306100722.28485-1-johan+linaro@kernel.org |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1760079wrd; Mon, 6 Mar 2023 02:23:42 -0800 (PST) X-Google-Smtp-Source: AK7set8FT7MF0o0CzJOww87pQKmlQ59uUZ8SJZPFPoZmmbUaELKxAn2/s8LBfWaJZlV23d+PKWze X-Received: by 2002:a17:906:4cda:b0:870:58ae:842e with SMTP id q26-20020a1709064cda00b0087058ae842emr11432596ejt.24.1678098222040; Mon, 06 Mar 2023 02:23:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678098222; cv=none; d=google.com; s=arc-20160816; b=EXzGv5x4h8l/awFOVb8DyRE9xRKAkeM3X0qYhQn9uJvUF6XyJA0oLWsa+zL0Rp7k03 jSF7BdogySp3PGK+TUNe18Z6ChyATfWCOwTqVcJP2bcUQMmGY45WiGzPnP/Z17B6wW0P 8/wo30g/cxdAk1u2Sv3Tbi5lTIIyLWqUne4403ZQYDjU9UHWTkMK3hiYU7swuV/fnTwh cbD+3vplPjhZBAEXphN8xsYTWjLt04e0f3/S+jgQkGkCLh+MwGdBQncbXxKMjSLZQBK6 UH9V2HIwtJ+3QCspFpi5UJdy4XgO2bE1EftyQLE46HQRofe5oLk/u1zHgvyqJAgGn4yj 33ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=pcnRg2hmXOUVHJYMcOCYDP2TRMTD/DJN+gia8L3VZ3Q=; b=VCMJSTkjQ2EPYJdZyffSMopp/pyNxJDDd3XUBRoDUJpR68aVOfZlQU3k3bmgA14WnD BJPt/fmtERwj5qEX2SQi6YmxlIMs0YcENtoL0iRaIV/uc97nT7p/XeHYOFgtZiKYzFaf QCyJYSFm2odwL6L09c/IhFlNOC5gdlJABQe7ayIFYfw1WAWNBEENwZxb5fXL+eGDHBIH KN9N8A6jZGqGxHTLJDGLF+sdYw9Mj3stzVRGsSgDFl7XsH1+BO+e04FPSkx69ibb/3h8 1V2bKpdOXDKMvoWqIz1sanvZBgTa2HPaDrLBUs5Ek5Kz2MssvtOx8oN2zIzJUVbXiISM a8oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rt0Rn6T3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mj8-20020a170906af8800b008b223acdc5esi5589746ejb.226.2023.03.06.02.23.18; Mon, 06 Mar 2023 02:23:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rt0Rn6T3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230386AbjCFKJo (ORCPT <rfc822;toshivichauhan@gmail.com> + 99 others); Mon, 6 Mar 2023 05:09:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230288AbjCFKJX (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 6 Mar 2023 05:09:23 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FE21222EF; Mon, 6 Mar 2023 02:09:21 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CC88FB80D1F; Mon, 6 Mar 2023 10:09:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 864EAC4339E; Mon, 6 Mar 2023 10:09:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678097358; bh=rgz7DkiR3NGSdYC6VIDyJIROjaHJdAcLrZHovIKQqTY=; h=From:To:Cc:Subject:Date:From; b=rt0Rn6T3lEfqba/Z5G+GS52LAph5WQwapMERJL+R1JUS7rpu7cd5CAr+ebFzIQbAE c/LoQffAl8hgg1QxEPWeVyefKugN4sPCm2Zw+MNdySXEXaIOyNa3RxQJ6nI0/7FFd0 Inbw+1NarVhguGtegVLtK3JhG5pkOyCuxa9LcsjUpujzRmMyOhS4hNodFtAWAkJF9l XJxI4QPpAa+9jP2V/8Hv6Y1hHlyvAcvRz8RVnuCEEi6y31AOiwLRpUt0/eILMF/838 pF19Hfx5ScWRpvIG6EJ+Vl1qf9dvvAhNGEnl7TgzGQTZ9BxnSLlLYJDsDfN/jy6HHV DS3dcArX4gpzQ== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from <johan+linaro@kernel.org>) id 1pZ7n4-0007QY-TO; Mon, 06 Mar 2023 11:09:58 +0100 From: Johan Hovold <johan+linaro@kernel.org> To: Rob Clark <robdclark@gmail.com>, Abhinav Kumar <quic_abhinavk@quicinc.com>, Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Cc: Sean Paul <sean@poorly.run>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Johan Hovold <johan+linaro@kernel.org> Subject: [PATCH 00/10] drm/msm: fix bind error handling Date: Mon, 6 Mar 2023 11:07:12 +0100 Message-Id: <20230306100722.28485-1-johan+linaro@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759613521278508966?= X-GMAIL-MSGID: =?utf-8?q?1759613521278508966?= |
Series |
drm/msm: fix bind error handling
|
|
Message
Johan Hovold
March 6, 2023, 10:07 a.m. UTC
I had reasons to look closer at the MSM DRM driver error handling and realised that it had suffered from a fair amount of bit rot over the years. Unfortunately, I started fixing this in my 6.2 branch and failed to notice two partial and, as it turned out, broken attempts to address this that are now in 6.3-rc1. Instead of trying to salvage this incrementally, I'm reverting the two broken commits so that clean and backportable fixes can be added in their place. Included are also two related cleanups. Johan Johan Hovold (10): Revert "drm/msm: Add missing check and destroy for alloc_ordered_workqueue" Revert "drm/msm: Fix failure paths in msm_drm_init()" drm/msm: fix NULL-deref on snapshot tear down drm/msm: fix NULL-deref on irq uninstall drm/msm: fix drm device leak on bind errors drm/msm: fix vram leak on bind errors drm/msm: fix missing wq allocation error handling drm/msm: fix workqueue leak on bind errors drm/msm: use drmm_mode_config_init() drm/msm: move include directive drivers/gpu/drm/msm/disp/msm_disp_snapshot.c | 3 - drivers/gpu/drm/msm/msm_drv.c | 67 +++++++++++++------- 2 files changed, 44 insertions(+), 26 deletions(-)
Comments
On Mon, Mar 06, 2023 at 11:07:12AM +0100, Johan Hovold wrote: > I had reasons to look closer at the MSM DRM driver error handling and > realised that it had suffered from a fair amount of bit rot over the > years. > > Unfortunately, I started fixing this in my 6.2 branch and failed to > notice two partial and, as it turned out, broken attempts to address > this that are now in 6.3-rc1. > > Instead of trying to salvage this incrementally, I'm reverting the two > broken commits so that clean and backportable fixes can be added in > their place. > > Included are also two related cleanups. Any further comments to these patches (except for 9/10, which should be dropped)? As the patches being reverted here were first added in 6.3-rc1 there is still time to get this into 6.3-rc (e.g. before AUTOSEL starts trying to backport them). Johan > Johan Hovold (10): > Revert "drm/msm: Add missing check and destroy for > alloc_ordered_workqueue" > Revert "drm/msm: Fix failure paths in msm_drm_init()" > drm/msm: fix NULL-deref on snapshot tear down > drm/msm: fix NULL-deref on irq uninstall > drm/msm: fix drm device leak on bind errors > drm/msm: fix vram leak on bind errors > drm/msm: fix missing wq allocation error handling > drm/msm: fix workqueue leak on bind errors > drm/msm: use drmm_mode_config_init() > drm/msm: move include directive > > drivers/gpu/drm/msm/disp/msm_disp_snapshot.c | 3 - > drivers/gpu/drm/msm/msm_drv.c | 67 +++++++++++++------- > 2 files changed, 44 insertions(+), 26 deletions(-)
On 21/03/2023 15:02, Johan Hovold wrote: > On Mon, Mar 06, 2023 at 11:07:12AM +0100, Johan Hovold wrote: >> I had reasons to look closer at the MSM DRM driver error handling and >> realised that it had suffered from a fair amount of bit rot over the >> years. >> >> Unfortunately, I started fixing this in my 6.2 branch and failed to >> notice two partial and, as it turned out, broken attempts to address >> this that are now in 6.3-rc1. >> >> Instead of trying to salvage this incrementally, I'm reverting the two >> broken commits so that clean and backportable fixes can be added in >> their place. >> >> Included are also two related cleanups. > > Any further comments to these patches (except for 9/10, which should be > dropped)? > > As the patches being reverted here were first added in 6.3-rc1 there is > still time to get this into 6.3-rc (e.g. before AUTOSEL starts trying to > backport them). I will take a look at the patches. Additional question, as you have been looking into this area. We have plenty of code which is only called under the `if (kms)` condition. Could you hopefully move these parts to separate functions, so that the error handling is also simpler? If not, I'll put this to my todo list, but it might take some time before I have time for that. > > Johan > >> Johan Hovold (10): >> Revert "drm/msm: Add missing check and destroy for >> alloc_ordered_workqueue" >> Revert "drm/msm: Fix failure paths in msm_drm_init()" >> drm/msm: fix NULL-deref on snapshot tear down >> drm/msm: fix NULL-deref on irq uninstall >> drm/msm: fix drm device leak on bind errors >> drm/msm: fix vram leak on bind errors >> drm/msm: fix missing wq allocation error handling >> drm/msm: fix workqueue leak on bind errors >> drm/msm: use drmm_mode_config_init() >> drm/msm: move include directive >> >> drivers/gpu/drm/msm/disp/msm_disp_snapshot.c | 3 - >> drivers/gpu/drm/msm/msm_drv.c | 67 +++++++++++++------- >> 2 files changed, 44 insertions(+), 26 deletions(-)
On Tue, Mar 21, 2023 at 05:21:56PM +0200, Dmitry Baryshkov wrote: > On 21/03/2023 15:02, Johan Hovold wrote: > > On Mon, Mar 06, 2023 at 11:07:12AM +0100, Johan Hovold wrote: > >> I had reasons to look closer at the MSM DRM driver error handling and > >> realised that it had suffered from a fair amount of bit rot over the > >> years. > >> > >> Unfortunately, I started fixing this in my 6.2 branch and failed to > >> notice two partial and, as it turned out, broken attempts to address > >> this that are now in 6.3-rc1. > >> > >> Instead of trying to salvage this incrementally, I'm reverting the two > >> broken commits so that clean and backportable fixes can be added in > >> their place. > >> > >> Included are also two related cleanups. > > > > Any further comments to these patches (except for 9/10, which should be > > dropped)? > > > > As the patches being reverted here were first added in 6.3-rc1 there is > > still time to get this into 6.3-rc (e.g. before AUTOSEL starts trying to > > backport them). > > I will take a look at the patches. Additional question, as you have been > looking into this area. We have plenty of code which is only called > under the `if (kms)` condition. Could you hopefully move these parts to > separate functions, so that the error handling is also simpler? If not, > I'll put this to my todo list, but it might take some time before I have > time for that. There's definitely room for cleaning up the bind/unbind paths further, but for this series I focus on correctness while maintaining symmetry (e.g. if an allocation was done under if (kms), then the release should be done under the same). I don't think I will have time to look at this further for a few weeks either, but I'll add it to my list of future work as well and I'll check in with you before actually working on it. Johan
On Mon, 06 Mar 2023 11:07:12 +0100, Johan Hovold wrote: > I had reasons to look closer at the MSM DRM driver error handling and > realised that it had suffered from a fair amount of bit rot over the > years. > > Unfortunately, I started fixing this in my 6.2 branch and failed to > notice two partial and, as it turned out, broken attempts to address > this that are now in 6.3-rc1. > > [...] Applied, thanks! [01/10] Revert "drm/msm: Add missing check and destroy for alloc_ordered_workqueue" https://gitlab.freedesktop.org/lumag/msm/-/commit/ebf761d6a02f [02/10] Revert "drm/msm: Fix failure paths in msm_drm_init()" https://gitlab.freedesktop.org/lumag/msm/-/commit/35a08e19a1c6 [03/10] drm/msm: fix NULL-deref on snapshot tear down https://gitlab.freedesktop.org/lumag/msm/-/commit/d3234fe12b3b [04/10] drm/msm: fix NULL-deref on irq uninstall https://gitlab.freedesktop.org/lumag/msm/-/commit/0b5ffe5be6fd [05/10] drm/msm: fix drm device leak on bind errors https://gitlab.freedesktop.org/lumag/msm/-/commit/6a44f0dbd141 [06/10] drm/msm: fix vram leak on bind errors https://gitlab.freedesktop.org/lumag/msm/-/commit/e6091a855649 [07/10] drm/msm: fix missing wq allocation error handling https://gitlab.freedesktop.org/lumag/msm/-/commit/9c6027d5a3f4 [08/10] drm/msm: fix workqueue leak on bind errors https://gitlab.freedesktop.org/lumag/msm/-/commit/023691129696 [10/10] drm/msm: move include directive https://gitlab.freedesktop.org/lumag/msm/-/commit/110fd0d5b032 Best regards,