Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3312051pxb; Sun, 7 Feb 2021 05:15:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJzIUqth9mWtXH9vNMCjmt5iCT+sS0a9RUunxq0XLDzm216csY42Y+GghknzNxh7j44Pn9C6 X-Received: by 2002:aa7:c58e:: with SMTP id g14mr12450355edq.362.1612703754419; Sun, 07 Feb 2021 05:15:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612703754; cv=none; d=google.com; s=arc-20160816; b=LbPrFomjuCbU6NM39XoExU5smFbBX0nV9OjcbtSH4vOpTLEBWC6KnrlLCgafngi4K6 8vHumPa2smMRJSniHY3vdB23LOKj4zVrPwJ5k4OjT5SSHGSlS6svzjxTeV2vZybwFphS ykHpHVhFmoADwax4mc2SMKfM5pLsG4xsTVdVowEj5PBolY3amX1EbZallnKeftB4PDVC DU+5xbpUgEh/x88HKJbbbGn0fKfQO8YAz9GTn6wYZlbPLoiz4SQz6L9E72/nm7xBZXr3 u68Ew7MAFDnPK53ksJZmYlS61NUXySj5xPNfpfv8GulJcu26C0dtG4ygdVACnTyyDqL+ bSTA== 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=SISOIgfsxj2z8VwmMOujp6fXedz5KiEYfI9wSyDzvC8=; b=wYY/vYZVHfQi1rcZTFMw3Yvvnn6LUJvDG9dxRnSCQ/ohhl87+2Q+RxLrlz6tZ5FZlG wY4Lxjco9ueyRSUDeQKSVA26hJ9INcd7CfAelPkx8ARnO3R7cNdMhtnONgctlaB20H1N wHxAYrFlj0HmXtXOxfVcXsu5b+4eCXW2DTRplh5yAoD0S74dq9ctfLVG3ChYUUknzx3R 0OyiFNAYtQ32tZwcp0+vWjL3enxCMeeD0KJRcTuXvau2wb0Wk0f1yjabT5KV/7w0KhQT DMHJWf6W3pY/q5dD37pZ+O71zEta4H+txQzkrrDGYrDUmXGNjImdkoU4O/uEnPTJaCd7 d5LQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=P4s3pEQ6; 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 de28si8931847edb.466.2021.02.07.05.15.31; Sun, 07 Feb 2021 05:15:54 -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=P4s3pEQ6; 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 S229912AbhBGNMq (ORCPT + 99 others); Sun, 7 Feb 2021 08:12:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229872AbhBGNMo (ORCPT ); Sun, 7 Feb 2021 08:12:44 -0500 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 961ECC061756 for ; Sun, 7 Feb 2021 05:12:03 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id j21so7938215wmj.0 for ; Sun, 07 Feb 2021 05:12:03 -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=SISOIgfsxj2z8VwmMOujp6fXedz5KiEYfI9wSyDzvC8=; b=P4s3pEQ6IBAC6p0W66KZ+YpQoB5L/STEiRT+HpSEyF8a4Buf+uBGMK7hwg0OHQWXiM lBfFugB60Ha4/KFYLslXclnx8NAAklo67yXfAe2C/qBcvL4yC93g4AykYrRB+xOwVWKf twHkNJvemF8Nqf+B2fpW79VF5NNHtEKgr5gYt98/qKJVza5AfEi4YSMM7KJZPUszSpGr MXUpFbk4StecqD7EIHJUGgclHLXsP+qIxe1gQ4UfW0BY0GifGGBS69M8LdW5iJjWH7lH xNzqbmy3KKWUj288/cJG9mLMBVL1+PCZN+0bsHs6mbIVjMlA957YCPc3iHkksjr810qt JlHg== 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=SISOIgfsxj2z8VwmMOujp6fXedz5KiEYfI9wSyDzvC8=; b=VP2STc5yM7LfoU40LFGlUlR4xYBYLKf/C+/9HvjzJPctj7tbJgRwqJ2plosTHWvrUy rwKcZKR1RdDnClLS6uUoko4x0HuNyR/EuYUR0UgdQPdN/9vdtnqtBFddP9GoXYO4VXPK PZQmb4N8p1qMad0dYh+6d4Yqv5GRW0R/8rVDuhihKXEXcjY+VPxisYjoWer1PW+8itLS axKT0kH/cBBZeoT1k9XmxYQSAzCnblkP+viLAVFIosYEZ/UHHlcMzOn54MAjuvHLLVnK lnlU1N5apo1ClgT76Yx63g8qzv7FOBgKHcnXaMqPvvHTF2l2098TG8hNmAbbfTEJ3mC+ XZgA== X-Gm-Message-State: AOAM530udIJfvSSEyIqHs+TDWyAU5Pj63N45R2cQLlOpjEcwso6FHgTc giAnlUMjfVAdBECEQGU+QTcfJfCQO8uRvHT0dmo= X-Received: by 2002:a1c:105:: with SMTP id 5mr11054556wmb.89.1612703522329; Sun, 07 Feb 2021 05:12:02 -0800 (PST) MIME-Version: 1.0 References: <20210127105121.20345-1-lukasz.luba@arm.com> <3d1b4696-0172-f88a-f41f-c66ac3baa429@arm.com> <0afa6299-1c35-ab98-702e-8dcd168bcaac@arm.com> In-Reply-To: From: Qiang Yu Date: Sun, 7 Feb 2021 21:11:51 +0800 Message-ID: Subject: Re: [PATCH] drm/lima: Use delayed timer as default in devfreq profile To: Lukasz Luba Cc: Robin Murphy , lima@lists.freedesktop.org, David Airlie , Christian Hewitt , Linux Kernel Mailing List , dri-devel Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Applied to drm-misc-next. Regards, Qiang On Thu, Feb 4, 2021 at 10:24 PM Lukasz Luba wrote: > > > > On 2/4/21 1:39 PM, Robin Murphy wrote: > > On 2021-02-03 02:01, Qiang Yu wrote: > >> 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. > > > > Doesn't devfreq_suspend_device() already cancel any timer work either > > way in that case? > > Correct, the governor should pause the monitoring mechanism (and timer). > > Regards, > Lukasz