Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp53575pxp; Tue, 15 Mar 2022 23:36:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPDlDDYaUPhP5MsdgN3/n1XeRjOQG7+3DBM3WBxr8hpitFrY3OK8qwIY/NUPL/KfguC0vx X-Received: by 2002:a17:906:9b95:b0:6db:38fc:5ff4 with SMTP id dd21-20020a1709069b9500b006db38fc5ff4mr24296402ejc.114.1647412562246; Tue, 15 Mar 2022 23:36:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647412562; cv=none; d=google.com; s=arc-20160816; b=MuxgREPvfGyHG/TzPuFYmn2x2mk7WFZGbjsuVpGiFEvXM/T8ONvCGRK8xtNmxbhUfO 4MAs3hP9flHKtdpwG/0nqZnNsYJMEaEh7iCzvgTFhBBHXoJhMC3GivpL3BN6ytNxEL6q l1BzfnZbJrF0uINpJyYEMP28ASkGiUdr+rv0/6sarYL3LtRJD/+jETqSL0LPQVz4Jqni N6x0HR7C+mqlKdirblaYO4e+pqhm/NMXmcnnCO7DgKwhzubrrzQWzqxLulv/gxWB6L2o p0KhTLKF9tYsHOUgKsYuxaMEyvPTBA9DrZuFNaoQYI6F/l1vaBidpM6EsqeyoV91St1P ZM/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=SWYiVcad4lyN3MTMCVaEe/kHD8SmjlJLnSNDNu5hEV8=; b=bI7sr4P9cd5tbv/BzhRgk5Z29no2yK/5vmhtg6Mh8MuPn7BgCJ5RECBqaQp1v+yd13 oJnD4ZoQ25K1m4I4umFiuSU3SsdGFN1i/RC2T2mvK1+JHCoCr4DMimWxoE8IwSxx9eK+ QFo0u0d67jnwfmBQzM0TH1VJC/2IhWPD8xuqw5M5S6kVWSs+xUp4nY7fjTtmL7ZyMNzY IwMe9juJgx3/rJi9t2cjq5Ic6gDIF/01YxZRqiqOisOwdwX2LSBZTB/7tjRB1paAmKym 4gM2uMYcjtcuuEo0A6bdUXQa8Z7CWWMuyyJWYlcn6UJQTO6df00Z7nePxXHth2wY1h30 sBsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dx89DPmQ; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w2-20020a1709067c8200b006b910bc0358si626750ejo.481.2022.03.15.23.35.37; Tue, 15 Mar 2022 23:36:02 -0700 (PDT) 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=@linaro.org header.s=google header.b=dx89DPmQ; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231644AbiCNMfF (ORCPT + 99 others); Mon, 14 Mar 2022 08:35:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245593AbiCNMdQ (ORCPT ); Mon, 14 Mar 2022 08:33:16 -0400 Received: from mail-yw1-x112b.google.com (mail-yw1-x112b.google.com [IPv6:2607:f8b0:4864:20::112b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78697260 for ; Mon, 14 Mar 2022 05:32:06 -0700 (PDT) Received: by mail-yw1-x112b.google.com with SMTP id 00721157ae682-2dbd8777564so161519867b3.0 for ; Mon, 14 Mar 2022 05:32:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=SWYiVcad4lyN3MTMCVaEe/kHD8SmjlJLnSNDNu5hEV8=; b=dx89DPmQPGELKQ9URRMTc+sGTgkEbGOiXMkgouXNqdU6gaEGEWf9ADvH/onhhTn9A0 i07Y+WDeSjXLEPXUwnNBLIzyoHrmbu+PIZZ56LGMx0d0FQ9XDJHHqdg5B425iKHO0uhY GeVnLJBk8jVDLd84298P3HM89dWltpY/eLhQZkpS27sg45OBX42hMGTtXK8ehdreVn/P jnIg+ChqnI+V8gxqyI8KZRxkMBzg/c6/lt79dm2zyzpe8FjryvOPjxeQhM723GIDLkDr rhNtFsEBSDzig95iZNJVTyfMhKMlVfXY81af0BTKizXB5c2HxE0fmzOMBfUq1Hw/6N38 KXKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=SWYiVcad4lyN3MTMCVaEe/kHD8SmjlJLnSNDNu5hEV8=; b=IrACiiqRTZjH2s3elUFBhtHtlyWQalcRAtWczw4oaJpEm9LfGo8PTSyKxuTw3LgHPs y0ds0eVDe9I+5JPbblpztfZwvYOfE/G0lAPSj13gzSb1yp6mtE5P8sClLZrs+45qJ41+ cP3JKGoAKyR2+TeTTkmFSlg2SEMTTYL0G+hvLbRDx4lLic7CUdX9C0SOtRmEtuMHTkWN Sk9xnneb3Ce1fiOmfSmQylhDSb2p61fZzvFngr5irTVIgPzFjDV15AWz359boMP5lNkb 5HqmEElxSPM9ga6+DXSHb3N662cLmg+G/hqzHymwpZPl210gkNNP6tKx1+O++x2Zq6zC Bllg== X-Gm-Message-State: AOAM531Wi/rb8xECnCsOC1Mqnaz7ACSWRkNJQf2fM6GkPaexkfOx8W73 GdgQe1eE4tNZM9XImfdub1fabubVga+s0+m4qUTRfQ== X-Received: by 2002:a0d:d187:0:b0:2dc:5d83:217d with SMTP id t129-20020a0dd187000000b002dc5d83217dmr18485669ywd.189.1647261125395; Mon, 14 Mar 2022 05:32:05 -0700 (PDT) MIME-Version: 1.0 References: <20220219183310.557435-1-robdclark@gmail.com> In-Reply-To: From: Naresh Kamboju Date: Mon, 14 Mar 2022 18:01:53 +0530 Message-ID: Subject: Re: [PATCH] drm/msm/gpu: Fix crash on devices without devfreq support To: Rob Clark , Linus Torvalds Cc: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, Rob Clark , Linux Kernel Functional Testing , Anders Roxell , Sean Paul , Abhinav Kumar , David Airlie , Daniel Vetter , open list Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org Hi Rob and Linus, On Mon, 7 Mar 2022 at 14:07, Naresh Kamboju wrote: > > Hi Rob, > > On Sun, 20 Feb 2022 at 00:02, Rob Clark wrote: > > > > From: Rob Clark > > > > Avoid going down devfreq paths on devices where devfreq is not > > initialized. > > > > Reported-by: Linux Kernel Functional Testing > > Reported-by: Anders Roxell > > Signed-off-by: Rob Clark > > I have tested this patch and the reported kernel crash is fixed [1]. > > Tested-by: Linux Kernel Functional Testing > > > --- > > drivers/gpu/drm/msm/msm_gpu_devfreq.c | 31 +++++++++++++++++++++------ > > 1 file changed, 25 insertions(+), 6 deletions(-) > > > > diff --git a/drivers/gpu/drm/msm/msm_gpu_devfreq.c b/drivers/gpu/drm/msm/msm_gpu_devfreq.c > > index 9bf319be11f6..26a3669a97b3 100644 > > --- a/drivers/gpu/drm/msm/msm_gpu_devfreq.c > > +++ b/drivers/gpu/drm/msm/msm_gpu_devfreq.c > > @@ -83,12 +83,17 @@ static struct devfreq_dev_profile msm_devfreq_profile = { > > static void msm_devfreq_boost_work(struct kthread_work *work); > > static void msm_devfreq_idle_work(struct kthread_work *work); > > > > +static bool has_devfreq(struct msm_gpu *gpu) > > +{ > > + return !!gpu->funcs->gpu_busy; > > +} > > + > > void msm_devfreq_init(struct msm_gpu *gpu) > > { > > struct msm_gpu_devfreq *df = &gpu->devfreq; > > > > /* We need target support to do devfreq */ > > - if (!gpu->funcs->gpu_busy) > > + if (!has_devfreq(gpu)) > > return; > > > > dev_pm_qos_add_request(&gpu->pdev->dev, &df->idle_freq, > > @@ -149,6 +154,9 @@ void msm_devfreq_cleanup(struct msm_gpu *gpu) > > { > > struct msm_gpu_devfreq *df = &gpu->devfreq; > > > > + if (!has_devfreq(gpu)) > > + return; > > + > > devfreq_cooling_unregister(gpu->cooling); > > dev_pm_qos_remove_request(&df->boost_freq); > > dev_pm_qos_remove_request(&df->idle_freq); > > @@ -156,16 +164,24 @@ void msm_devfreq_cleanup(struct msm_gpu *gpu) > > > > void msm_devfreq_resume(struct msm_gpu *gpu) > > { > > - gpu->devfreq.busy_cycles = 0; > > - gpu->devfreq.time = ktime_get(); > > + struct msm_gpu_devfreq *df = &gpu->devfreq; > > > > - devfreq_resume_device(gpu->devfreq.devfreq); > > + if (!has_devfreq(gpu)) > > + return; > > + > > + df->busy_cycles = 0; > > + df->time = ktime_get(); > > + > > + devfreq_resume_device(df->devfreq); > > } > > > > void msm_devfreq_suspend(struct msm_gpu *gpu) > > { > > struct msm_gpu_devfreq *df = &gpu->devfreq; > > > > + if (!has_devfreq(gpu)) > > + return; > > + > > devfreq_suspend_device(df->devfreq); > > > > cancel_idle_work(df); > > @@ -185,6 +201,9 @@ void msm_devfreq_boost(struct msm_gpu *gpu, unsigned factor) > > struct msm_gpu_devfreq *df = &gpu->devfreq; > > uint64_t freq; > > > > + if (!has_devfreq(gpu)) > > + return; > > + > > freq = get_freq(gpu); > > freq *= factor; > > > > @@ -207,7 +226,7 @@ void msm_devfreq_active(struct msm_gpu *gpu) > > struct devfreq_dev_status status; > > unsigned int idle_time; > > > > - if (!df->devfreq) > > + if (!has_devfreq(gpu)) > > return; > > > > /* > > @@ -253,7 +272,7 @@ void msm_devfreq_idle(struct msm_gpu *gpu) > > { > > struct msm_gpu_devfreq *df = &gpu->devfreq; > > > > - if (!df->devfreq) > > + if (!has_devfreq(gpu)) > > return; > > > > msm_hrtimer_queue_work(&df->idle_work, ms_to_ktime(1), FYI, This patch is missing on Linux 5.17-rc8 [1]. kernel crash log on arm64 db410c device [2] and details [3]. metadata: git_describe: v5.17-rc8 git_ref: master git_repo: https://gitlab.com/Linaro/lkft/mirrors/torvalds/linux-mainline git_sha: 09688c0166e76ce2fb85e86b9d99be8b0084cdf9 kernel-config: https://builds.tuxbuild.com/26LbbVLHqxjh5w5ZtjBMjGmh92P/config build: https://builds.tuxbuild.com/26LbbVLHqxjh5w5ZtjBMjGmh92P - Naresh [1] https://lore.kernel.org/dri-devel/20220219183310.557435-1-robdclark@gmail.com/ [2] https://lkft.validation.linaro.org/scheduler/job/4714905#L2795 [3] https://qa-reports.linaro.org/lkft/linux-mainline-master/build/v5.17-rc8/testrun/8446224/suite/linux-log-parser/test/check-kernel-oops-4714905/details/ > > -- > Linaro LKFT > https://lkft.linaro.org > > [1] https://lkft.validation.linaro.org/scheduler/job/4664600#L1894