Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp379064pxb; Thu, 21 Jan 2021 09:11:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJwyPyqXCkIRhG9+NbApyTc1S3KCddxWTN9xUClzBNLBjlstwuV7Oi6iI8I5En0gQCh4pYwU X-Received: by 2002:a05:6402:3122:: with SMTP id dd2mr113914edb.262.1611249065108; Thu, 21 Jan 2021 09:11:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611249065; cv=none; d=google.com; s=arc-20160816; b=y4h7iWBgYw1q0KRco+WZERaVULTWp7QHmFqIfT/lOSujZkByuHlSPmcKjwX1Nbv5qx qb2qFLICzPICAI//jiMtJH6mem65wdPHM2SP9U1Us3SqB2+llVsMBThQnqFICxL+sbvp 9zr0z/kAavp2FKUYTqvs5LbyLvFXEQ07ip3VH5YTP3gxRzmGb+gTvqxc3wkLEy3GxwIA SE1fY60TKzKt0croUsWTJp0/jYhwpBuZACrmdOORfWpXp5Yqjngr2l0sRuzmCMbLLFID Pk1HkITGs4rVsoZsRr3omKb5e62pEAZJIsL6kXeBR50hQFpfR7iE1IL0XQEwvspWwhv1 evbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=Lq4WwJGQxGG1Bl8AKJwhmf8Jxhn8PbbURrLeBdbENOk=; b=K0v0D0lEZWlJ8Z0bX4uiVjrAWYSxvp0MPw+3ALBMQYdd5oRTydxev/rNsgajNmMhES Q7pNv7xMtZ37JoPAVeloSY3NYC8c4vA+RXXZuUXwG7G10mJDEAjxKI7aJfu9B4src+v3 AjwoMTeXFQ56PDNk2FnFn0hAdt7/zhTuHRbF9bVRgdYUsVreFDlQeq6Cy8VSP8Aiql/6 4itm9DmOH7xvaTLuQupZKJUrjkkhu5UiysE5E5BZBUvRFmrcUkmLB6ll/GJqTKUqPow4 9eUeW7yPAXnP/dNEF8T320D08gZ25RKzA982DBGF/jbrJF7+cen1cT4Gwbicqzm5skjg 49xw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n19si2000861ejc.352.2021.01.21.09.09.52; Thu, 21 Jan 2021 09:11:05 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732664AbhAURIJ (ORCPT + 99 others); Thu, 21 Jan 2021 12:08:09 -0500 Received: from foss.arm.com ([217.140.110.172]:41738 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387565AbhAURGN (ORCPT ); Thu, 21 Jan 2021 12:06:13 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8098911B3; Thu, 21 Jan 2021 09:05:15 -0800 (PST) Received: from e123648.arm.com (unknown [10.57.7.131]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id CDA7E3F66E; Thu, 21 Jan 2021 09:05:12 -0800 (PST) From: Lukasz Luba To: linux-kernel@vger.kernel.org, steven.price@arm.com, airlied@linux.ie, daniel@ffwll.ch Cc: robh@kernel.org, tomeu.vizoso@collabora.com, alyssa.rosenzweig@collabora.com, dri-devel@lists.freedesktop.org, daniel.lezcano@linaro.org, lukasz.luba@arm.com Subject: [PATCH] drm/panfrost: Add governor data with pre-defined thresholds Date: Thu, 21 Jan 2021 17:04:45 +0000 Message-Id: <20210121170445.19761-1-lukasz.luba@arm.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The simple_ondemand devfreq governor uses two thresholds to decide about the frequency change: upthreshold, downdifferential. These two tunable change the behavior of the governor decision, e.g. how fast to increase the frequency or how rapidly limit the frequency. This patch adds needed governor data with thresholds values gathered experimentally in different workloads. Signed-off-by: Lukasz Luba --- Hi all, This patch aims to improve the panfrost performance in various workloads, (benchmarks, games). The simple_ondemand devfreq governor supports tunables to tweak the behaviour of the internal algorithm. The default values for these two thresholds (90 and 5) do not work well with panfrost. These new settings should provide good performance, short latency for rising the frequency due to rapid workload change and decent freq slow down when the load is decaying. Based on frequency change statistics, gathered during experiments, all frequencies are used, depending on the load. This provides some power savings (statistically). The highest frequency is also used when needed. Example glmark2 results: 1. freq fixed to max: 153 2. these new thresholds values (w/ patch): 151 3. default governor values (w/o patch): 114 In future the devfreq framework would expose via sysfs these two tunables, so they can be adjusted by the middleware based on currently running workload (game, desktop, web browser, etc). These new values should be good enough, though. Regards, Lukasz Luba drivers/gpu/drm/panfrost/panfrost_devfreq.c | 10 +++++++++- drivers/gpu/drm/panfrost/panfrost_devfreq.h | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index 56b3f5935703..7c5ffc81dce1 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -130,8 +130,16 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) panfrost_devfreq_profile.initial_freq = cur_freq; dev_pm_opp_put(opp); + /* + * Setup default thresholds for the simple_ondemand governor. + * The values are chosen based on experiments. + */ + pfdevfreq->gov_data.upthreshold = 45; + pfdevfreq->gov_data.downdifferential = 5; + devfreq = devm_devfreq_add_device(dev, &panfrost_devfreq_profile, - DEVFREQ_GOV_SIMPLE_ONDEMAND, NULL); + DEVFREQ_GOV_SIMPLE_ONDEMAND, + &pfdevfreq->gov_data); if (IS_ERR(devfreq)) { DRM_DEV_ERROR(dev, "Couldn't initialize GPU devfreq\n"); ret = PTR_ERR(devfreq); diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.h b/drivers/gpu/drm/panfrost/panfrost_devfreq.h index db6ea48e21f9..1e2a4de941aa 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.h +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.h @@ -4,6 +4,7 @@ #ifndef __PANFROST_DEVFREQ_H__ #define __PANFROST_DEVFREQ_H__ +#include #include #include @@ -17,6 +18,7 @@ struct panfrost_devfreq { struct devfreq *devfreq; struct opp_table *regulators_opp_table; struct thermal_cooling_device *cooling; + struct devfreq_simple_ondemand_data gov_data; bool opp_of_table_added; ktime_t busy_time; -- 2.17.1