Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp2939656pxt; Mon, 9 Aug 2021 12:32:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwuPqU9/zc+OssqUN0ZwW7DsXmjdkk1GhEYNceETYqVk4R0Dr4EzcVf6pwBwWHfVq+BfunD X-Received: by 2002:a92:b705:: with SMTP id k5mr233523ili.92.1628537578287; Mon, 09 Aug 2021 12:32:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628537578; cv=none; d=google.com; s=arc-20160816; b=noe4ZoQ5Nha3QgGFQii9tSsqiKBmF4bIdFPqYAQgGa2vuVvMIDkN7AUn90EncAIu/+ pR2NVoUlgdsnnnepvUxZTQzSteLhWObW8RpnBTDO5GZ5IcV9rw8ZkHqiI1bD87H8E+3R KdFJx9xf/INM80ygApykFm6CYmtAvHol8sqTSRwreUvkNiZMV8ujDcUf/XaaBBUm57TU m/5KEczkZjtK/fWny46SJIqLH2x4sB9mmK4g+WJ1f7h9fiNwWe0qI+VGCqUOAAL6Dlma Crp+hqL6AYPsc1V+GsIRAzM9vUFaA9ck/rcAnpu6FaeiYU6+7axOORSiV1iEg/9kk6er s5mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dmarc-filter:sender:dkim-signature; bh=84DInYak3ob6ws+4P8+9QbEz8S5I95euQDi0WGUvz1I=; b=PJkAVKG+oUX3s6C+xgcDx/aUSKGcC9FnUN0oG9sMVcGJseGGPopuw5jOGG3DE2ahai 8PUIz4IE/Wi5fidbkR7mQubWa4j871k2ZizhBefiRiLVXnGSdp5QyZjrPKycAVMtMAJV GcypyVy2aGse+N9x7xVehfCuL1asj+KHE0IOqwUJ6ruO5IlpbE/W1USxJ0O54Tz0sv3p kIeHFbi7wBHNhsIkNRqnP1OohGtHIoseLbr00m9YoX1DPk6QJ1yurwuV0hwRo9votbXp CsX+PNRR0ttsCXbvCcl2/ctkwDMr3Ox+lQ/2OU82GpFCBWrBBN39b463d2qxFbRakiMr 6v5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=G3diNabJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s13si20557433ilp.102.2021.08.09.12.32.46; Mon, 09 Aug 2021 12:32:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=G3diNabJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233892AbhHIOxI (ORCPT + 99 others); Mon, 9 Aug 2021 10:53:08 -0400 Received: from so254-9.mailgun.net ([198.61.254.9]:14256 "EHLO so254-9.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231478AbhHIOxH (ORCPT ); Mon, 9 Aug 2021 10:53:07 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1628520767; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: Cc: To: Subject: Sender; bh=84DInYak3ob6ws+4P8+9QbEz8S5I95euQDi0WGUvz1I=; b=G3diNabJ1SvneaCUufua5OyZdOPrH6b9okYTQEVksiCxi1l/NwJOrr/bzJ7N9PWKkilx/UTn kzzLTMfxoquK+LwGPy0nmYtSOc8kerGB+wPrkwHp2hoesQx+JDvB9bmrXBX7CLO1BargPjaV ROrSYVKPPYLcG+mTyu0KEWWAq0Y= X-Mailgun-Sending-Ip: 198.61.254.9 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n06.prod.us-east-1.postgun.com with SMTP id 6111411a76c3a9a17283506d (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 09 Aug 2021 14:52:10 GMT Sender: akhilpo=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 5E9F5C433D3; Mon, 9 Aug 2021 14:52:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00, NICE_REPLY_A,SPF_FAIL,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from [192.168.1.105] (unknown [59.89.230.160]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: akhilpo) by smtp.codeaurora.org (Postfix) with ESMTPSA id 3B3AFC4338A; Mon, 9 Aug 2021 14:52:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 3B3AFC4338A Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=akhilpo@codeaurora.org Subject: Re: [PATCH] drm/msm: Disable frequency clamping on a630 To: Rob Clark , Caleb Connolly Cc: dri-devel , freedreno , linux-arm-msm , Rob Clark , Sean Paul , David Airlie , Daniel Vetter , Jordan Crouse , Jonathan Marek , Sai Prakash Ranjan , Bjorn Andersson , Sharat Masetty , open list , Stephen Boyd References: <20210729183942.2839925-1-robdclark@gmail.com> <1a38a590-a64e-58ef-1bbf-0ae49c004d05@linaro.org> <8aa590be-6a9f-9343-e897-18e86ea48202@linaro.org> From: Akhil P Oommen Message-ID: <6eefedb2-9e59-56d2-7703-2faf6cb0ca3a@codeaurora.org> Date: Mon, 9 Aug 2021 20:21:59 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/8/2021 10:22 PM, Rob Clark wrote: > On Sun, Aug 8, 2021 at 7:33 AM Caleb Connolly wrote: >> >> >> >> On 07/08/2021 21:04, Rob Clark wrote: >>> On Sat, Aug 7, 2021 at 12:21 PM Caleb Connolly >>> wrote: >>>> >>>> Hi Rob, Akhil, >>>> >>>> On 29/07/2021 21:53, Rob Clark wrote: >>>>> On Thu, Jul 29, 2021 at 1:28 PM Caleb Connolly >>>>> wrote: >>>>>> >>>>>> >>>>>> >>>>>> On 29/07/2021 21:24, Rob Clark wrote: >>>>>>> On Thu, Jul 29, 2021 at 1:06 PM Caleb Connolly >>>>>>> wrote: >>>>>>>> >>>>>>>> Hi Rob, >>>>>>>> >>>>>>>> I've done some more testing! It looks like before that patch ("drm/msm: Devfreq tuning") the GPU would never get above >>>>>>>> the second frequency in the OPP table (342MHz) (at least, not in glxgears). With the patch applied it would more >>>>>>>> aggressively jump up to the max frequency which seems to be unstable at the default regulator voltages. >>>>>>> >>>>>>> *ohh*, yeah, ok, that would explain it >>>>>>> >>>>>>>> Hacking the pm8005 s1 regulator (which provides VDD_GFX) up to 0.988v (instead of the stock 0.516v) makes the GPU stable >>>>>>>> at the higher frequencies. >>>>>>>> >>>>>>>> Applying this patch reverts the behaviour, and the GPU never goes above 342MHz in glxgears, losing ~30% performance in >>>>>>>> glxgear. >>>>>>>> >>>>>>>> I think (?) that enabling CPR support would be the proper solution to this - that would ensure that the regulators run >>>>>>>> at the voltage the hardware needs to be stable. >>>>>>>> >>>>>>>> Is hacking the voltage higher (although ideally not quite that high) an acceptable short term solution until we have >>>>>>>> CPR? Or would it be safer to just not make use of the higher frequencies on a630 for now? >>>>>>>> >>>>>>> >>>>>>> tbh, I'm not sure about the regulator stuff and CPR.. Bjorn is already >>>>>>> on CC and I added sboyd, maybe one of them knows better. >>>>>>> >>>>>>> In the short term, removing the higher problematic OPPs from dts might >>>>>>> be a better option than this patch (which I'm dropping), since there >>>>>>> is nothing stopping other workloads from hitting higher OPPs. >>>>>> Oh yeah that sounds like a more sensible workaround than mine . >>>>>>> >>>>>>> I'm slightly curious why I didn't have problems at higher OPPs on my >>>>>>> c630 laptop (sdm850) >>>>>> Perhaps you won the sillicon lottery - iirc sdm850 is binned for higher clocks as is out of the factory. >>>>>> >>>>>> Would it be best to drop the OPPs for all devices? Or just those affected? I guess it's possible another c630 might >>>>>> crash where yours doesn't? >>>>> >>>>> I've not heard any reports of similar issues from the handful of other >>>>> folks with c630's on #aarch64-laptops.. but I can't really say if that >>>>> is luck or not. >>>> It looks like this affects at least the OnePlus 6 and PocoPhone F1, I've done some more poking and the following diff >>>> seems to fix the stability issues completely, it seems the delay is required to let the update propagate. >>>> >>>> This doesn't feel like the right fix, but hopefully it's enough to come up with a better solution than disabling the new >>>> devfreq behaviour on a630. >>>> >>>> diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c >>>> index d7cec7f0dde0..69e2a5e84dae 100644 >>>> --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c >>>> +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c >>>> @@ -139,6 +139,10 @@ void a6xx_gmu_set_freq(struct msm_gpu *gpu, struct dev_pm_opp *opp) >>>> return; >>>> } >>>> >>>> + dev_pm_opp_set_opp(&gpu->pdev->dev, opp); >>>> + >>>> + usleep_range(300, 500); >>>> + >>> I am a bit confused. We don't define a power domain for gpu in dt, correct? Then what exactly set_opp do here? Do you think this usleep is what is helping here somehow to mask the issue? I feel we should just leave the new dcvs feature (shall we call it NAP?) disabled for a630 (and 10ms devfreq interval), until this is root caused. >>> Hmm, this is going to be in the critical path on idle -> active >>> transition (ie. think response time to user-input).. so we defn don't >>> want to do this unconditionally.. >>> >>> If I understand the problem, we just want to limit how far we jump the >>> gpu freq in one go.. maybe deleting the lowest (and perhaps highest) >>> OPP would accomplish that? Could that be done in the board(s)'s >>> toplevel dts files? >> That would be a workaround, however I'd really like to avoid limiting performance as a solution if I can help it, >> especially as the fix might just be "set the opp first, wait for it to apply, then set the core clock". >> >> Is there a sensible way to get a callback from the opp notify chain? Or from rpmh directly? Or is this solution really >> not the right way to go? > > It does seem a bit strange to me that we are telling GMU to change > freq before calling dev_pm_opp_set_opp().. if dev_pm_opp_set_opp() is > increasing voltage, it seems like you'd want to do that *before* > increasing freq (but reverse the order when decreasing freq).. But I'm > not an expert on the ways of the GMU.. maybe Akhil or Jordan knows > better how this is supposed to work. For legacy gmu, we trigger DCVS using DCVS OOB which comes later in this function. But the order between regulator and clock which you mentioned is correct. > > But the delay seems like papering something over, and I'm trying to go > in the other direction and reduce latency between user input and > pageflip.. > > BR, > -R > >>> >>> BR, >>> -R >>> >>>> gmu_write(gmu, REG_A6XX_GMU_DCVS_ACK_OPTION, 0); >>>> >>>> gmu_write(gmu, REG_A6XX_GMU_DCVS_PERF_SETTING, >>>> @@ -158,7 +162,6 @@ void a6xx_gmu_set_freq(struct msm_gpu *gpu, struct dev_pm_opp *opp) >>>> if (ret) >>>> dev_err(gmu->dev, "GMU set GPU frequency error: %d\n", ret); >>>> >>>> - dev_pm_opp_set_opp(&gpu->pdev->dev, opp); >>>> pm_runtime_put(gmu->dev); >>>> } >>>>> >>>>> Maybe just remove it for affected devices? But I'll defer to Bjorn. >>>>> >>>>> BR, >>>>> -R >>>>> >>>> >>>> -- >>>> Kind Regards, >>>> Caleb (they/them) >> >> -- >> Kind Regards, >> Caleb (they/them)