Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1762257pxp; Mon, 7 Mar 2022 01:42:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJzsDvCrs30ytLkrgG9xftETOX6CXUYqEuDsLoJl1vRhfD28cYnPoC0j+dhckosqlot5oVgj X-Received: by 2002:a17:907:c1d:b0:6db:67b:a3cc with SMTP id ga29-20020a1709070c1d00b006db067ba3ccmr6816139ejc.356.1646646120093; Mon, 07 Mar 2022 01:42:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646646120; cv=none; d=google.com; s=arc-20160816; b=DuGv6a4E7BzccxQKLLfKTKgKbP7jOmIwfaJ53TqbHfy2PHye3G/kM5DYtMIX3q6U8c r0/Ng+IKhI1a8HhnpegaqxhgmmoOEAxz4/3YLqihbWtSRfMJ5DJgwc1FUsje9CrxxnXs 1yI55P0zKjUWVicoow82kLNvVabF0G8RWvbv4rqc2zuqOiDN5Fpm9/1cWJh/VNMhyQ1/ E/4UElIGmiHbGdHb9qfAfY6EMeNLmlk0lm8WP5Vj1IXgMHoaahH+pIMq7XyUGE8BRLsO CTIyjMP3mqTe0nzTfDTOxvtHsO9h5Y1saplbowacEDT7i5IhjWwQVAL+785PQHHl0rf7 UwYg== 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=E6x5yVDLBVFqVJQNZ+OEdQbw27fgZWH2Vrmnv9e+WIA=; b=WMXPF4KrMoxktDLb/YRFto+GjaCsU0qataVOob2bg6EFog9yrlGOi7OpUAcHwxMu3M 8iAZy2WwU9hJRprHCTcAZdBO5n1N7bPBO0W7EkB7sBA2XpeEtYnQIgnT9biZzC2CdnBF 0zFege7fN3CCBw/P9H5g/qf0jNCGF/PeDeaCq58lh2goNz5QUdCcY06f2oQz9mteLn+5 qDH477efAmnbXUbDrRwA96LJdljaNcVR8kmElZUInF5o2WFsJSJj3vlX9cpIO+xxWugD MzBakqmCdPJPcvlj8byAqoATxcBcRntXKMAb6TItMCp9fIYKBY19djCarY3uK44A1q8/ iH6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oNhgYRxf; 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 dk15-20020a0564021d8f00b00416180b9924si4521027edb.230.2022.03.07.01.41.37; Mon, 07 Mar 2022 01:41:59 -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=@linaro.org header.s=google header.b=oNhgYRxf; 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 S232663AbiCGIi0 (ORCPT + 99 others); Mon, 7 Mar 2022 03:38:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229648AbiCGIiY (ORCPT ); Mon, 7 Mar 2022 03:38:24 -0500 Received: from mail-yw1-x1131.google.com (mail-yw1-x1131.google.com [IPv6:2607:f8b0:4864:20::1131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACC9B1C6 for ; Mon, 7 Mar 2022 00:37:28 -0800 (PST) Received: by mail-yw1-x1131.google.com with SMTP id 00721157ae682-2d6d0cb5da4so154735737b3.10 for ; Mon, 07 Mar 2022 00:37:28 -0800 (PST) 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=E6x5yVDLBVFqVJQNZ+OEdQbw27fgZWH2Vrmnv9e+WIA=; b=oNhgYRxfC5S7Flav03PFuf0rKKCE1fufuLFFan6hXVBjpSOfsSMnXBp4h2wik/njKd 91RQgRcuaWeCEIreQbS23aCelM6cQM927Z6zYvena3xPhX/EbcZYVf1pXWn/UHGguVqO K2dcx/WFIciVIgUJg6j2gunB1QhflbZ9WWaz5mhcysoBCYf4XbjaXP2arDS86gyk6Whv Fy0TdFWNL6/dvv3rSHgocQnjfmtxiXyjTLLdqb6oxObw0ZLXSd2iTALIhmrpIPhT4yhx LPRRT2WhEJDGKz3oI1Udexe3bON05QXHXPqDUhbfXuQVslCHzamXeETBxry7RtIbIAS2 xMBg== 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=E6x5yVDLBVFqVJQNZ+OEdQbw27fgZWH2Vrmnv9e+WIA=; b=8Q9r+oAa3UC/F4lF3r1wGOZ/wDAUIix0HPp3oNLFTMe+cd+g5NeEY4EYuq7U3oSqZO StwuzeIRn5IKg/JWEmopI3Rszdb9gZslWZtD1uREfGn/U2HWitXR6VknTxPLkCTgbNfz IRt0xhNfsvsN2yGKkkQPvx/HXvZpbTODQarQ+B+D+eBSqm5snItJJMZbo3eDHgjYCLI6 C0mcu8vMkWkrLEc8R9tbVhkvnAuPyGCPeJzPuMW7Ez0hpq5WD+KYVXyez8zjKgoQg96w u7RBCVbZu+/+1MqZsNB53dr47smPUbTcxHe9vK+oUygD8TvoZU3EiDmXaoATjPoMU1M0 z5Sg== X-Gm-Message-State: AOAM532B/g1khjy3VkdMQcVONODiGCHI5o7qLEWCxr+EVq6ijoRPGk4y N20dOfJN96ZPBkDrqcIrutBQPWNCwHsAB52QTXVOocmI548V8j3k X-Received: by 2002:a81:c45:0:b0:2dc:59c4:3555 with SMTP id 66-20020a810c45000000b002dc59c43555mr7687451ywm.36.1646642247656; Mon, 07 Mar 2022 00:37:27 -0800 (PST) MIME-Version: 1.0 References: <20220219183310.557435-1-robdclark@gmail.com> In-Reply-To: <20220219183310.557435-1-robdclark@gmail.com> From: Naresh Kamboju Date: Mon, 7 Mar 2022 14:07:16 +0530 Message-ID: Subject: Re: [PATCH] drm/msm/gpu: Fix crash on devices without devfreq support To: Rob Clark 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, 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), > -- > 2.34.1 -- Linaro LKFT https://lkft.linaro.org [1] https://lkft.validation.linaro.org/scheduler/job/4664600#L1894