Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2509383lqt; Mon, 22 Apr 2024 12:46:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUFsPuksOCWEGTc7Az6Ink+Zn+28si0MmC62yfbzwNbUXqXHD4NoAH7nysAXkEyd35yw7l7gLXDFL64oUbovD63zPT+fqCDyVo7ctTbjA== X-Google-Smtp-Source: AGHT+IGsAulWdAIaaIt5xjCH926CxY5FWFQDExNA0xXp2kCUDDdrPYVIW4I0yGYnlgjHGWpgt2dt X-Received: by 2002:a17:902:e742:b0:1ea:cc:b59e with SMTP id p2-20020a170902e74200b001ea00ccb59emr1371371plf.19.1713815186617; Mon, 22 Apr 2024 12:46:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713815186; cv=pass; d=google.com; s=arc-20160816; b=nl6NkEo8PgI0y6AN+ooGv+MzsNZCcZrP6q5bFdClv74N1mGAb245vZJASq9iFZz1s4 fPCmIKe5JQsjVqA0sVFibejAfLOGJJUEUO4frGPgsDW8MXZzOF6F39WKWkN4J8iawtHq UAqpvlMW1DcOM8+rCs2s+PSJ13mPjrItjZpYTNIAAJdBKqqf0X+rqWfmMqmlvUbm2tNe HLoZGtuGWKairx5LNpg3g/W0qoN7xAzH1Q9eGv0jNouU9G3Gzn6IHBnV+SUAGgIKEF7H T6otMdvTwGNjBcCqDIk1P8lfj/ldW0v6szkGMArQ93R77cgk1G7dVUnPtko5up6hTCjE GV2A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=oczHlzSC/UPaNc2LgQ5vSBFQ2KcNspCQ4fkb6GlVJw8=; fh=3IWJjaT1D3VodErV6s0bUfp7ubZ09LG8jq0ywmCAJGg=; b=cnQyzRijZVzdG+N7D+eXsc4uXefafddggK/r5qJ88BCIe+6x+ZXz0iAxS4dWFugssM S0weJnYpTg7MJCGOsGoKFymy2f9fbXRT+260ZZodBI8D2fwAYcMiVtv03xciWzEgwUSi 6IvA0A9Zwp0b7t197tdvAtIaK0PfpGaktelj6QNuSm2ZLllF8AP2dITghwxJIL/d1VIa /KZ4pOmMp1SBcGE9WmttwHuIzTBifSRrFYexH1ddVfO6jD8cWQD3rQ2um17EyowUal8Z VGCIUUCtqe59gLMJ89sGfkUtqJq+tFo5lm8P2x1yC85eqWXZMM5SxC1oOtRNA6U39W1Q z7yQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mrscIQKd; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-153937-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153937-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id e14-20020a170903240e00b001e797d47ee3si5792524plo.76.2024.04.22.12.46.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 12:46:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-153937-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mrscIQKd; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-153937-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153937-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 41B1128498E for ; Mon, 22 Apr 2024 19:46:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2F51F155397; Mon, 22 Apr 2024 19:46:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="mrscIQKd" Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 584D8155348 for ; Mon, 22 Apr 2024 19:45:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713815161; cv=none; b=P9EGXhFsTnxKRK/8bhNg01K0hxE6w5t1lyyYOd4YBe2X9DkQP6peMnf6Bd2lK+7QIHRaSdqKHXsfcfeUbhulxeblsCCgeUmCd6yzbzMPYjUBOZUCcmgQCvu9GLBZHwy6A5W+mtoc49uWmkJ8esgyXuX6Dyu/NbSKl3gz9mwsOkU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713815161; c=relaxed/simple; bh=Xko6z1fl55XyiHdSobQQnzhy7TR6fGyGMC1S0LXqISY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ZAwcbEl1V5x9KxbjusL8VOJYe/YXfGczb+G7JyXJSJpqjtEXsyUkEp2hjIXCTeQmcnvnUPAU3S3U3UP7CsU1heK/eqzQCmrp1sCzLsny6QNQ5sCNvAZBBVb+jJbSzJeQu8l1q6FQmq53SCADLrKIyZXNyBv7LUZhN2l/GimpxiM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=mrscIQKd; arc=none smtp.client-ip=209.85.167.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-51ac5923ef6so2712767e87.0 for ; Mon, 22 Apr 2024 12:45:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713815157; x=1714419957; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=oczHlzSC/UPaNc2LgQ5vSBFQ2KcNspCQ4fkb6GlVJw8=; b=mrscIQKdelKfn6uquWy1/MHya7yCswj6cwE9gBx49eeV8fIBoSC9/SM5M6VRZqPY7/ 8jiGh6I/pUmx15G1bU/al41Uf3Msh0dT+YTwdRdRRPfae4X2jthKpVPghaYSv9wtSK5N SpL26If9UDWJoPFe2KJjYfpL8JuIgixjlT/vBnyTzt52urVCLJ4Yb+4gf5iTcVbRRO3K 7DhrmUJrbLQUdtztbE5EgXLiZz4GEpkZUaiqWXxtHayFPaIgv1QS4d2VQkUTzakI4awp /Y49RRRYEq+UrYiNqIVN0o1qxjO0yzniF1MnFmxXxby8e0fq+nId0B4/TZJJGMOtSVaj gsTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713815157; x=1714419957; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=oczHlzSC/UPaNc2LgQ5vSBFQ2KcNspCQ4fkb6GlVJw8=; b=XxINM4vj0wSM+9td+JS0O2RRfJsy3Xr5suqBgAS2OHRz5VDFK4Xu3chGD+EJVPJ1TP PdwwCEM7TK523efXk5NrKhq44QO/VOCshmWjEb1ei6XJtA89OQ4O1Mq/luKwmQf7UFfh vclpfhksAeTom1ulFcbReLCG47h2kGNaW8hGDJ0CU3OkgchjqbE5HR05hihxrGGTkhsm dWf+Hs1fqqRPLDB7MMice72pTwxmm9SleC0WpQG12Ki8Lkxh8YHxXbqfHWa+NYmhODtv ROazBmfWmEvVXfkC4bEkp0smyWyISj++1a2xISd1R4R8fyPDcziAdqCwxwztLKqRn4PY wyGg== X-Forwarded-Encrypted: i=1; AJvYcCXmnYx/FJHSl2fpXYpBzpzSPnZRwR1i5jWxgzjJCozWTZfqbpL5cv8cBTD0icGlecHtdNuYqP1NudSKg/anbwsFXqXbkpokfaybiThB X-Gm-Message-State: AOJu0YyDupLU7esT5K9K+Z6BIdMBI/pdoNYaRttgOmTAalxa1U2vy/6Z qZrexgdQmLEahlWxOJ0xY/lMgM/90mExGuWmvFoXCjnLdp9lHLN3Q75J7OaIStc= X-Received: by 2002:a05:6512:20f:b0:519:65fe:ac10 with SMTP id a15-20020a056512020f00b0051965feac10mr201015lfo.32.1713815157475; Mon, 22 Apr 2024 12:45:57 -0700 (PDT) Received: from eriador.lumag.spb.ru (dzdbxzyyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a0c3:3a00::8a5]) by smtp.gmail.com with ESMTPSA id j14-20020a19f50e000000b005194167c042sm1806503lfb.171.2024.04.22.12.45.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 12:45:57 -0700 (PDT) Date: Mon, 22 Apr 2024 22:45:55 +0300 From: Dmitry Baryshkov To: Abhinav Kumar Cc: Rob Clark , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/3] drm/msm/mdp4: don't destroy mdp4_kms in mdp4_kms_init error path Message-ID: <4aovv43qe3nm7uwb32b655lv54rion6lw4ofegi4vkr4si2y27@w3rvyvcw7mda> References: <20240420-mdp4-fixes-v1-0-96a70f64fa85@linaro.org> <20240420-mdp4-fixes-v1-2-96a70f64fa85@linaro.org> <313d9eed-098f-c09b-eb5d-ac9ad56a8e1d@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <313d9eed-098f-c09b-eb5d-ac9ad56a8e1d@quicinc.com> On Mon, Apr 22, 2024 at 11:17:15AM -0700, Abhinav Kumar wrote: > > > On 4/19/2024 7:33 PM, Dmitry Baryshkov wrote: > > Since commit 3c74682637e6 ("drm/msm/mdp4: move resource allocation to > > the _probe function") the mdp4_kms data is allocated during probe. It is > > an error to destroy it during mdp4_kms_init(), as the data is still > > referenced by the drivers's data and can be used later in case of probe > > deferral. > > > > mdp4_destroy() currently detaches mmu, calls msm_kms_destroy() which > destroys pending timers and releases refcount on the aspace. > > It does not touch the mdp4_kms as that one is devm managed. > > In the comment https://patchwork.freedesktop.org/patch/590411/?series=132664&rev=1#comment_1074306, > we had discussed that the last component's reprobe attempt is affected > (which is not dpu or mdp4 or mdp5 right? ) > > If it was an interface (such as DSI OR DP), is it the aspace detach which is > causing the crash? I should have retained the trace log. I'll trigger the issue and post the trace. > > Another note is, mdp5 needs the same fix in that case. > > dpu_kms_init() looks fine. > > > Fixes: 3c74682637e6 ("drm/msm/mdp4: move resource allocation to the _probe function") > > Signed-off-by: Dmitry Baryshkov > > --- > > drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | 28 +++++++++------------------- > > 1 file changed, 9 insertions(+), 19 deletions(-) > > > > diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c > > index 4ba1cb74ad76..4c5f72b7e0e5 100644 > > --- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c > > +++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c > > @@ -392,7 +392,7 @@ static int mdp4_kms_init(struct drm_device *dev) > > ret = mdp_kms_init(&mdp4_kms->base, &kms_funcs); > > if (ret) { > > DRM_DEV_ERROR(dev->dev, "failed to init kms\n"); > > - goto fail; > > + return ret; > > } > > kms = priv->kms; > > @@ -403,7 +403,7 @@ static int mdp4_kms_init(struct drm_device *dev) > > ret = regulator_enable(mdp4_kms->vdd); > > if (ret) { > > DRM_DEV_ERROR(dev->dev, "failed to enable regulator vdd: %d\n", ret); > > - goto fail; > > + return ret; > > } > > } > > @@ -414,8 +414,7 @@ static int mdp4_kms_init(struct drm_device *dev) > > if (major != 4) { > > DRM_DEV_ERROR(dev->dev, "unexpected MDP version: v%d.%d\n", > > major, minor); > > - ret = -ENXIO; > > - goto fail; > > + return -ENXIO; > > } > > mdp4_kms->rev = minor; > > @@ -423,8 +422,7 @@ static int mdp4_kms_init(struct drm_device *dev) > > if (mdp4_kms->rev >= 2) { > > if (!mdp4_kms->lut_clk) { > > DRM_DEV_ERROR(dev->dev, "failed to get lut_clk\n"); > > - ret = -ENODEV; > > - goto fail; > > + return -ENODEV; > > } > > clk_set_rate(mdp4_kms->lut_clk, max_clk); > > } > > @@ -445,8 +443,7 @@ static int mdp4_kms_init(struct drm_device *dev) > > mmu = msm_iommu_new(&pdev->dev, 0); > > if (IS_ERR(mmu)) { > > - ret = PTR_ERR(mmu); > > - goto fail; > > + return PTR_ERR(mmu); > > } else if (!mmu) { > > DRM_DEV_INFO(dev->dev, "no iommu, fallback to phys " > > "contig buffers for scanout\n"); > > @@ -458,8 +455,7 @@ static int mdp4_kms_init(struct drm_device *dev) > > if (IS_ERR(aspace)) { > > if (!IS_ERR(mmu)) > > mmu->funcs->destroy(mmu); > > - ret = PTR_ERR(aspace); > > - goto fail; > > + return PTR_ERR(aspace); > > } > > kms->aspace = aspace; > > @@ -468,7 +464,7 @@ static int mdp4_kms_init(struct drm_device *dev) > > ret = modeset_init(mdp4_kms); > > if (ret) { > > DRM_DEV_ERROR(dev->dev, "modeset_init failed: %d\n", ret); > > - goto fail; > > + return ret; > > } > > mdp4_kms->blank_cursor_bo = msm_gem_new(dev, SZ_16K, MSM_BO_WC | MSM_BO_SCANOUT); > > @@ -476,14 +472,14 @@ static int mdp4_kms_init(struct drm_device *dev) > > ret = PTR_ERR(mdp4_kms->blank_cursor_bo); > > DRM_DEV_ERROR(dev->dev, "could not allocate blank-cursor bo: %d\n", ret); > > mdp4_kms->blank_cursor_bo = NULL; > > - goto fail; > > + return ret; > > } > > ret = msm_gem_get_and_pin_iova(mdp4_kms->blank_cursor_bo, kms->aspace, > > &mdp4_kms->blank_cursor_iova); > > if (ret) { > > DRM_DEV_ERROR(dev->dev, "could not pin blank-cursor bo: %d\n", ret); > > - goto fail; > > + return ret; > > } > > dev->mode_config.min_width = 0; > > @@ -492,12 +488,6 @@ static int mdp4_kms_init(struct drm_device *dev) > > dev->mode_config.max_height = 2048; > > return 0; > > - > > -fail: > > - if (kms) > > - mdp4_destroy(kms); > > - > > - return ret; > > } > > static const struct dev_pm_ops mdp4_pm_ops = { > > -- With best wishes Dmitry