Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp767676pxb; Tue, 2 Feb 2021 18:05:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJzMAHQ080+RFbiSPrcZwXanlfoCn6oEo4kzxe8iUbiq19pNHuQV5rk/xfN0qP/XUZ/O4BRo X-Received: by 2002:a05:6402:79a:: with SMTP id d26mr847324edy.266.1612317914435; Tue, 02 Feb 2021 18:05:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612317914; cv=none; d=google.com; s=arc-20160816; b=RzkhLlS27XO4MuTu5rek9GPMl2xuxGwnQZ9SzL2Zg42+2QYwX1fBVbmlOH+BVviLg1 AowGtK4v/jbnw7XVTvzoYm7W2gxvj9Ovn/zJ4t5HTSyg863HALRh6Kp25D2yNukOaZM7 ARKBA68MGh30XZTHA1PSQulkiKLWgf2M26nbnJGt3YO59OOQu22x6RR655oCUPOOoPLW RTMdaUdg9qZUhLE+y8w+LR7/rGFQCtl5Di5yjr/3nhyco5/oOub4GMk5D+vMmKGDsDjW ig12TGYFg/e1k6VIqH/PQdlLAXMnxvbYAIXlVwadqGuTOk6LFVw+vxGQRV63/w4XiCQD DfBw== 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=S0yBDDhldxV2iYO/cPqiZyNYzasLg78o0532MxoSErU=; b=vMs068P57MHE0Yj5e5AlUGH6dTq6LnfRcrDkzDS4K/L/6iKv/c7NcHIj1S84+Dkaje dfJUfIqWy98U3bkS96wF3cJ9Q43Np4CVyNfnJ2zOPBiQppG7MKc4fRdm3lXJ9zvgughh vLYz6t+FLYKh/S52t5Rdu9etaMvZ+AsUFn+8ryMe2TgioVtyZmYOy7VnovJ004bX07Ft HestLkazG9cevtX6ZXXXjSp7gOflnLu7VG5B3dxeRaS+bx1g+addQoXzU4bZ53PX5Ryt kFAeQk75iyyX2yBru3zSMmq/V19sBIUSlc/aujnO1wuxKWh9AZjyaycor03i/Eozm/DF PhTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=eAuIujLJ; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n15si389655edy.14.2021.02.02.18.04.50; Tue, 02 Feb 2021 18:05:14 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=eAuIujLJ; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231423AbhBCCC2 (ORCPT + 99 others); Tue, 2 Feb 2021 21:02:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231616AbhBCCCZ (ORCPT ); Tue, 2 Feb 2021 21:02:25 -0500 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96DB1C061573 for ; Tue, 2 Feb 2021 18:01:44 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id g10so22449001wrx.1 for ; Tue, 02 Feb 2021 18:01:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=S0yBDDhldxV2iYO/cPqiZyNYzasLg78o0532MxoSErU=; b=eAuIujLJCRK5VQOo+RNddxdqNVmp3sP1qQVEwIO9l9WbKBk0/gGRR960Ty08EC+CrH XH1nxsTbHUbu9a99l5EmZorf1CbkbxKs9qmCBgxVOMv5a3AGYYFKtuY7zk24lNJw5nwK Ob6gUUMSjbMN6Ckq3GWVioxrsCT9wOMoeDTzWqlvHVcqXiTrezqiOSC0X8vvZR7a3Pyr PRJ8eq3hwxfc3ho/5KQo6qpuDcXOQYnwj/LhB1g7vNYD/N32+EDbiv4po67v0tLMA4Hr kdRiP2VRHvMmDRC0xeGyASke+cUDH05ejmIqcGQhkhwiXmhUwHAdG5IPZiSyvc+tfXfb sdDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=S0yBDDhldxV2iYO/cPqiZyNYzasLg78o0532MxoSErU=; b=aLMKRzGVFlCFdTT1F53eBvcErhrcdfQq0+o1RtqgJopU1ANa1u17Bzp1+sYkzHMU3N nko9dxjYB44asa5y7+rWW3reds/NccRYoy+T8f0WxgrouyhS03K4//mDuzuAoQclIt39 tDkjVVvHe3QaRUoz0nsxn6kKnUCb+Ftu/79pOOaAdCE+t4gS3kHetYouHQ1AHU5dfRQ6 p8cBfSPdYhHNkSN3wvGBvOCNfTV5f/YvGClvUeohHut+m4Dh5l5Lw6S0LUv50XTW7T7z xDTG3Jpee7tNKbB7P6RPlF6VOBtLEm2Oi+H5mCXfa0W1rF5VkPOfAv0fNSlp7CqRqeQc GDWA== X-Gm-Message-State: AOAM532TvwL6ZW1Zs8IgjSpbCFRuMcCnpeJkk2V7qwLsttk2VANRZm4c +tbU33Vyklrem62ilrEmm8zNxDWXuMToWYub6hA= X-Received: by 2002:a5d:52c5:: with SMTP id r5mr818861wrv.208.1612317703287; Tue, 02 Feb 2021 18:01:43 -0800 (PST) MIME-Version: 1.0 References: <20210127105121.20345-1-lukasz.luba@arm.com> <3d1b4696-0172-f88a-f41f-c66ac3baa429@arm.com> In-Reply-To: From: Qiang Yu Date: Wed, 3 Feb 2021 10:01:31 +0800 Message-ID: Subject: Re: [PATCH] drm/lima: Use delayed timer as default in devfreq profile To: Lukasz Luba Cc: Linux Kernel Mailing List , David Airlie , Daniel Vetter , lima@lists.freedesktop.org, dri-devel , Christian Hewitt Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 2, 2021 at 10:02 PM Lukasz Luba wrote: > > > > On 2/2/21 1:01 AM, Qiang Yu wrote: > > Hi Lukasz, > > > > Thanks for the explanation. So the deferred timer option makes a mistake that > > when GPU goes from idle to busy for only one poll periodic, in this > > case 50ms, right? > > Not exactly. Driver sets the polling interval to 50ms (in this case) > because it needs ~3-frame average load (in 60fps). I have discovered the > issue quite recently that on systems with 2 CPUs or more, the devfreq > core is not monitoring the devices even for seconds. Therefore, we might > end up with quite big amount of work that GPU is doing, but we don't > know about it. Devfreq core didn't check <- timer didn't fired. Then > suddenly that CPU, which had the deferred timer registered last time, > is waking up and timer triggers to check our device. We get the stats, > but they might be showing load from 1sec not 50ms. We feed them into > governor. Governor sees the new load, but was tested and configured for > 50ms, so it might try to rise the frequency to max. The GPU work might > be already lower and there is no need for such freq. Then the CPU goes > idle again, so no devfreq core check for next e.g. 1sec, but the > frequency stays at max OPP and we burn power. > > So, it's completely unreliable. We might stuck at min frequency and > suffer the frame drops, or sometimes stuck to max freq and burn more > power when there is no such need. > > Similar for thermal governor, which is confused by this old stats and > long period stats, longer than 50ms. > > Stats from last e.g. ~1sec tells you nothing about real recent GPU > workload. Oh, right, I missed this case. > > > But delayed timer will wakeup CPU every 50ms even when system is idle, will this > > cause more power consumption for the case like phone suspend? > > No, in case of phone suspend it won't increase the power consumption. > The device won't be woken up, it will stay in suspend. I mean the CPU is waked up frequently by timer when phone suspend, not the whole device (like the display). Seems it's better to have deferred timer when device is suspended for power saving, and delayed timer when device in working state. User knows this and can use sysfs to change it. Set the delayed timer as default is reasonable, so patch is: Reviewed-by: Qiang Yu Regards, Qiang > > Regards, > Lukasz > > > > > > Regards, > > Qiang > > > > > > On Mon, Feb 1, 2021 at 5:53 PM Lukasz Luba wrote: > >> > >> Hi Qiang, > >> > >> On 1/30/21 1:51 PM, Qiang Yu wrote: > >>> Thanks for the patch. But I can't observe any difference on glmark2 > >>> with or without this patch. > >>> Maybe you can provide other test which can benefit from it. > >> > >> This is a design problem and has impact on the whole system. > >> There is a few issues. When the device is not checked and there are > >> long delays between last check and current, the history is broken. > >> It confuses the devfreq governor and thermal governor (Intelligent Power > >> Allocation (IPA)). Thermal governor works on stale stats data and makes > >> stupid decisions, because there is no new stats (device not checked). > >> Similar applies to devfreq simple_ondemand governor, where it 'tires' to > >> work on a loooong period even 3sec and make prediction for the next > >> frequency based on it (which is broken). > >> > >> How it should be done: constant reliable check is needed, then: > >> - period is guaranteed and has fixed size, e.g 50ms or 100ms. > >> - device status is quite recent so thermal devfreq cooling provides > >> 'fresh' data into thermal governor > >> > >> This would prevent odd behavior and solve the broken cases. > >> > >>> > >>> Considering it will wake up CPU more frequently, and user may choose > >>> to change this by sysfs, > >>> I'd like to not apply it. > >> > >> The deferred timer for GPU is wrong option, for UFS or eMMC makes more > >> sense. It's also not recommended for NoC busses. I've discovered that > >> some time ago and proposed to have option to switch into delayed timer. > >> Trust me, it wasn't obvious to find out that this missing check has > >> those impacts. So the other engineers or users might not know that some > >> problems they faces (especially when the device load is changing) is due > >> to this delayed vs deffered timer and they will change it in the sysfs. > >> > >> Regards, > >> Lukasz > >> > >>> > >>> Regards, > >>> Qiang > >>>